Deploy Medic Mobile

Our tools are used by large organizations supporting thousands of frontline health workers, as well as local organizations and clinics. Learn more about your options for deploying Medic Mobile.


Explore the Tools

Want to learn more about our latest software toolkit? On our tools page you can request a walkthrough – our team is happy to give you a tour!


BLOG

Why did Medic Mobile choose CouchDB?

Couch Db

August 18, 2016

Posted by: Jill Shah

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.

To limit our development efforts to a single codebase while maintaining a native-like experience, we made the desktop medic-webapp responsive, and embedded it in a thin container built around an Android WebView (medic-android). Under the hood, the app uses PouchDB, a JavaScript database designed to run in the browser and sync with CouchDB. The CHWs are set up as their own little node, on a phone!

Pouchdb

That’s the story! Stay tuned for the next chapter of our experience with CouchDB.

BLOG
No. 23 of 53
#}