Authored by Estelle Comment, Software Developer at Medic
Medic Mobile’s web app is built on top of CouchDB. Why, do you ask? Good question.
We noticed a common workflow in paper-based (or non-Medic-software-based) health organizations that we worked with: Community Health Workers (CHWs) would collect information, send it to their local manager for revisions, and the local manager would send it on to HQ to be aggregated with other data from the program.
Medic Mobile needed to support that workflow, including its offline requirements: while local managers would probably have internet, they wouldn’t be online at all times because the network (whether mobile data or wifi) may be spotty, unreliable, and expensive. The CHWs would be using SMS, as the most available and reliable technology, so they would never get online at all. This is a setting of “ground computing” rather than cloud computing, as Caolan, a pioneer Medic collaborator, quipped!
We chose CouchDB for its master-to-master replication feature, so that we could set up each local manager with their own local CouchDB server, with data propagating back and forth to the main office’s server. The replication algorithm is robust enough to work even with interrupted connection and slow networks. CHWs would send SMS into the local server’s SMS gateway, which would pass it to the CouchDB application to be saved in the local CouchDB, and on it would go by replication to the HQ’s computer. The replication algorithm also deals with conflicts (what happens if a national admin edits a patient’s profile while the local manager did the same offline?).
CouchDB apps are also easy to pull down to new CouchDB servers, or to update on existing ones. With Garden Dashboard, we can keep our users on the latest codebase with a single click.
Fast forward a few years: CHWs are coming online on Android! They also work offline most of the time, so they need local storage for their data on their phone.
That’s the story! Stay tuned for the next chapter of our experience with CouchDB.