Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

As shown in the EC Data Model diagram, the client app runs on two SQLite databases. One is used by Cloudant sync API to save EC data in form of JSON documents whereas the other is used to store registers view data in relational tables for easier display,searching and sorting. Whenever a user saves a form submission or syncs data from the server, the data (EC) is stored in the cloudant db and after either of the two operations is complete the process of converting EC data to the case model is started immediately by invoking ClientProcessor.getInstance(mContext).processClient() method. To be able to break down events and clients JSON documents to different cases (register tables), two JSON config mapping files are required in each site module as the reference point to ClientProcessor Java logic to determine which fields to pull from the EC documents and which table to populate in the registers database. To listen on when sync process is completed, in CloudantSyncHandler.reloadReplicationSettings(), CloudantSyncHandler class is registered as a listener to both pull and push replicator instances. Further, a method (complete()) is created inĀ CloudantSyncHandler class with the annotationĀ @Subscribe and cloudant ReplicationCompleted param type and it's the method Cloudant API will invoke on completing the replication process.

...

This table stores a unique entity_id, key, value row meaning that, for each field the latest value is the only one that's stored here