Tangerine-Community / Tangerine

Digitize your offline data collection. Create your Forms online with Tangerine Editor, conduct them offline with the Tangerine Android App. All results you collect can be exported as a CSV file, easy for processing in a spreadsheet. Tangerine has been used in over 1 million assessments and surveys in over 60 countries and in 100 languages.
http://www.tangerinecentral.org/
GNU General Public License v3.0
49 stars 30 forks source link

Improved Conflict Management for Case Documents #2400

Open rjcorwin opened 3 years ago

rjcorwin commented 3 years ago
chrisekelley commented 3 years ago

re: Implement Case Documents as a log of Actions - would this be an immutable log, like a couchdb or (gasp) blockchain?

rjcorwin commented 3 years ago

(gasp) blockchain

Lol, well for starters in order for a Tablet to write to the log that would require all tablets to be connected to the Internet in order for a network of miners to process Proof of Work or Proof of Stake so that's probably not going to work for most scenarios.

How about a checkpoint id or version id for each commit of this log? Or would this simply adding Couchdb on top of Couchdb?

Sounds like what you are proposing is we put the logs for a Case in the Case's own Document. I think that's one way, another is that each log is its own Document. The latter has the advantage that for each change to a Case, everyone only needs to download the data for that one change, meanwhile if each change for Case was in the Case doc itself, you would be downloading the record of all changes every time there is one change. So, "One Doc Per Change in a Case" vs. "All Changes for a Case in one Doc". The first downside I can think of for "One Doc Per Change in a Case" is that CouchDB would now no longer flag when there is a conflict, that is if the State of a Case is the sum of Log Docs. Tablets would never be writing to the same doc so CouchDB would never catch a conflict. However a trick might be is that when writing a Log Doc you also write some minimal data to the Canonical Case Doc, like toggle a boolean flag on it, then you would generate a revision on a common doc and CouchDB would be able to catch that as a conflict.