We were very excited for the chance to talk with Stefan du Fresne at Medic Mobile about how they have been employing CouchDB in applications.
Medic Mobile is a nonprofit technology company that was founded in 2010 to improve health in hard to reach communities. They serve their mission by designing, building, delivering, and supporting world-class software that helps community health workers, managers, and clinical teams work together to provide equitable care.
Their offices in Nairobi, Kathmandu, and San Francisco (and 75 staff) support more than 18,000 health workers in 23 countries, improving how health systems work for more than 11 million people.
Stefan was kind enough to share some specifics of their work with CouchDB.
How did you hear about CouchDB, and why did you choose to use it?
Many years ago CouchDB was picked for its master to master replication abilities, and resilience. We wanted to allow for multiple field deployments that worked well separately, and would push data upstream to an aggregator when network connectivity allowed.
Over time as our tools have evolved our use of CouchDB has grown. While many of our CHWs still send in data via SMS, CouchDB (with PouchDB) has allowed us to build a fully offline webapp that a growing number of our CHWs use.
More detail can be found in this blog post.
Did you have a specific problem that CouchDB solved?
We needed to be able to provide our application to our users in a consistent way, regardless of whether they have network connectivity. Seamless replication meant we didn’t need to worry about getting all data into one place and then relying on that place for functionality.
For the folks who are unsure of how they could use CouchDB–because there are a lot of databases out there—could you explain the use case?
Specifically for us, CouchDB (with PouchDB) allows us to have a fully functional offline first progressive web app that flawlessly synchronizes between a master datastore and any number of other datastores with almost no infrastructural effort. It is literally half a dozen lines of code to set up continuous replication.
More generally, CouchDB lets you push arbitrary JSON to a datastore that seamlessly replicates to other datastores whenever it is convenient to you. You can also combine it with PouchDB in the front-end as we have done, and you have a really low effort base for an offline-first web app.
What would you say is the top benefit of using CouchDB?
- Simplicity. CouchDB can be accessed completely over REST. Being able to curl your way to database glory is really appealing. It makes it really easy to get started with a fresh DB, inspect an existing database, or quickly build up scripts/tooling around your data
- Replication. This is a really hard problem, and CouchDB gives it you for free. It’s hard to understate how cool this is.
- JSON. Because the database doesn’t enforce a schema, you can be very flexible in how you store and manage your data.
What tools are you using in addition for your infrastructure? Have you discovered anything that pairs well with CouchDB?
PouchDB is definitely a big one for us.
In general though, since CouchDB is exposed in a RESTian way whatever your favourite web service tool is (curl, httpie, insomnia, postman…) it will work great with CouchDB. And since the responses are all JSON, you can get surprisingly far debugging and mucking about with your databases with curl and jq (or even sed if you’re feeling adventurous).
We’ve been using Kanso, Gardener, Dashboard and Garden Market for deploying new versions of our software. These tools were great, but they have a lot going on within them, and a lot of their potential has not been realised over time. We’re currently building our cheekily named replacement Horticulturalist, which should reduce the amount of code we need to get deployments out the door, and generally give us more flexibility and stability in how we deploy our software.
We are also using couch2pg, a small utility to replicate data from a couchdb instance into PostgreSQL. This lets us build more complicated SQL based analytics where required.
What are your future plans with your project? Any cool plans or developments you want to promote?
We’re in a scaling phase, and expect to be supporting 200,000 health workers providing care for 100 million people by 2021. We believe community health workers have an important role to play in healthcare systems that reach everyone.
As we scale up the number of health workers using the software, we’ll also be adding to the support we provide to each health worker and family. Today, health workers use the app to diagnose and treat sick children, register and screen pregnancies and newborns, deliver modern contraceptives to advance family planning, help keep track of immunization visits, screen for malnutrition, and monitor for infectious disease outbreaks. In the near future, we’ll help address the burdens of HIV/AIDS, Tuberculosis, and non-communicable diseases.
We’re getting the offline-first app into the hands of more people on the community health team, including nurses and frontline managers. We’re also exploring ways for household caregivers to interact with and use the app as they provide care for their families, extending the health system even further.
Health systems and health workers want the newly-accessible data to guide their work – so, we’re planning to build risk profiles and targeting algorithms to answer questions like, “Which child is most likely to be sick?” Our goal is to improve coverage and equity, and we’ll release our code, processes, and learnings. Finally, the app will serve as an integration point for technologies that will help health workers deliver great care, including biometrics and low-cost diagnostics.
Use cases are a great avenue for sharing useful technical information. Please consider joining the fun! Additionally, if there’s something you’d like to see covered on the CouchDB blog, we would love to accommodate. Email us!
For more about CouchDB visit couchdb.org or follow us on Twitter at @couchdb.
CouchDB Weekly News, September 21, 2017 – CouchDB Blog
Open Source Your Summer! – CouchDB Blog