THINKMD Delivers a Frontline Healthcare Assessment Platform on Heroku

Heroku’s CI/CD tools and Postgres followers streamline delivery of localized, offline-first diagnostic apps.

Around 6.2 million children under five years of age die each year from treatable conditions. In most cases, the underlying cause is lack of access to healthcare. That's because in many low and middle income countries in Africa, Asia, and South America, there is an average of one doctor per 20,000 to 100,000 people.

To help address this humanitarian crisis, a pair of Vermont physicians and professors at the University of Vermont Larner College of Medicine put their minds to finding a solution. Ideally, they would want to increase the number of pediatric doctors or nurses in the impacted regions, however, even if possible, it would take many years before the funding and infrastructure could be put into place. In the meantime, the physicians recognized that mobile technology can empower local people, even if they have no medical training. The result was THINKMD, a healthcare technology company that develops solutions to expand quality healthcare coverage for anyone, anywhere in the world.

For the small THINKMD engineering team, Heroku has enabled them to quickly build, test, and deliver localized versions of their apps while remaining in compliance with the strict quality controls necessary for medical software. Heroku has also simplified THINKMD’s collaboration with regional doctors, making it easy for them to review language, cultural references, and medical advice before deployment.

The THINKMD app running on two mobile devices

Unreliable mobile connections demand an offline-first app

THINKMD’s mobile clinical assessment app is designed to be used in the field by frontline medical workers, such as trained nurses, NGO staff, community agents, school teachers, and others. The mobile app connects to a data and analytics platform on the back-end to share aggregate data to drive data driven solutions for regional healthcare planning purposes.

When assessing a sick child, THINKMD’s mobile app prompts the healthcare worker to run through a series of diagnostic questions similar to those that a pediatrician would ask. Based on the answers given, the app then recommends a treatment plan for the child. THINKMD’s validation trials, published in the American Journal of Tropical Medicine and Hygiene, show that the app’s clinical recommendations match those of an in-person doctor between 85% to over 95% of the cases.

However, in many rural areas across the globe, internet access is a rarity. When working in remote villages, it’s not uncommon for frontline workers to go for weeks without a mobile network connection. Even when they do have internet access, mobile data allowances can be as low as 20 MB per month.

To address the many challenges of remote users, the THINKMD team built an offline-first progressive web app using VueJS that can work on any mobile device that has a web browser. Those with a Chrome browser on Android devices can also use the app offline. Health assessment processing takes place entirely on the device, with all the necessary logic stored locally at install time. When the app detects an internet connection, it fetches updates and sends anonymized diagnostic data back to ThinkMD servers for analysis and reporting.

Heroku Postgres automates data replication, both locally and globally

THINKMD's model puts unusual demands on its platform infrastructure. Onboarding a new regional partner, such as an NGO, results in a burst of activity as local workers install the clinical assessment app on their devices. After that, devices sync data with the platform's back-end sporadically.

That back-end is made up of a microservices architecture, developed using Node.js and running in both Heroku's U.S. and European regions. For each deployment of the mobile app, the THINKMD team links that particular version to the Heroku region that offers the best performance for the country in question.

Heroku Postgres is THINKMD's operational database, with a primary instance running in Heroku's U.S. region. The app's offline-first model means that the interaction between the app and the database is somewhat unusual. Rather than making constant calls to the database, the app receives its diagnostic data from Heroku Postgres at the time that it is installed on a mobile device. It is only the THINKMD engineers who write to the database, such as when preparing a new regional version of the app. As a result, THINKMD's data usage profile is read-heavy, meaning that the database itself changes less frequently than in a typical app architecture. The platform's European Heroku Postgres instance, therefore, operates as a follower of the U.S. data store. Follower databases are a unique technology, available only in Heroku Postgres, that stream changes in real time from a primary database to a read-only copy.

Similarly, each developer codes against their own Heroku Postgres instance, which is a copy of the staging database. That means there’s no need to manage local PostgreSQL instances, and it reduces the risk of the development database going too far out of sync with production.

The follower database is just one way that Heroku enables THINKMD’s small engineering team to have a much greater impact than equivalently sized teams who use unmanaged cloud services. One other way is in the scaling flexibility than Heroku enables. Rather than having to spin up, configure, network, and then take care of the ongoing administration of individual virtual machines, the THINKMD team can scale up and down on Heroku with just a click or CLI command.

Running two regional instances of our database would have taken weeks of planning and management in a traditional environment. Instead, setting up a follower Heroku Postgres instance took just a few hours. Alex Broussard, CTO, THINKMD

While THINKMD improves health outcomes for individuals, it also plays a vital role in forming an understanding of regional and national health trends. By aggregating data from each instance of the app, ThinkMD’s platform provides their partner organizations with an interface to query and visualize population health statistics, such as average weight and prevailing illnesses.

Even with sporadic data syncing, THINKMD's mobile apps in the field still send substantial volumes of data back to the platform. Because low-end devices can only store data for one transmission at a time, it's important that the THINKMD platform always be available to receive a data upload. As such, the immediate priority is to accept the data and then process it later. The THINKMD team has built a hybrid data architecture that first stores the data uploads in a simple AWS S3 data bucket. Code running in Heroku then processes the data asynchronously and loads it in a usable form into Tableau. It is then through an interface within Tableau that ThinkMD's partners can query the data to strengthen their understanding of health trends in their region.

A woman and man testing children using the THINKMD app

CI/CD tools ensure quality control during development

The THINKMD engineering team must balance two competing needs. On one hand, they want to ensure that their app never declares someone to be healthy when the data they entered actually suggests they are not. On the other, it’s important that the app recommends only the level of care that is appropriate for their condition and the resources available in their locality. Therefore, the THINKMD team puts quality assurance at the heart of everything they do and applies the same rigorous development standards as the FDA demands for a medical device.

Heroku is essential to meeting those requirements. As a small team, THINKMD's developers look to maximize the useful work they can do, rather than spend time configuring and managing their multiple environments for development, testing, and so on. Heroku CI plays an essential role in quality assurance by automatically running THINKMD's test suite against each Git commit. That way, code that fails the test suite never even makes it into the build process, let alone into staging or production.

For code that makes it through the test suite, Heroku Pipelines provides separate environments for pre-production deployment. In particular, Heroku Review Apps enable the team to spin up disposable instances of their platform directly from the GitHub development branch. That approach simplifies the review process by ensuring that only the code from the specific development branch is deployed for testing, rather than commits from multiple works in progress as might happen in a general purpose testing environment.

Review Apps are ideal for internal quality assurance, however, they really come into their own when seeking review from local partners. Each new THINKMD deployment requires the approval of local physicians to ensure that the language and cultural aspects of the app are correctly localized. With a review app, the THINKMD QA team can provide reviewers with a straightforward HTTPS link that requires no additional effort on the reviewer’s part. From the reviewer’s perspective, the review app works just like the production app.

Heroku’s CI/CD tools, like Review Apps, Pipelines, and CI, allow us to maintain quality standards internally, as well as enable regional physicians to test localized versions of the app right from their browser. Alex Broussard, CTO, THINKMD

Simplified deployment enables a rapid response to COVID-19

When the COVID-19 pandemic hit, the THINKMD team foresaw that the virus would have a significant impact on the health of people in under-resourced regions. As their platform already supported multiple healthcare tracks – such as newborn health, maternal health, and so on – they set about creating a track to help screen people for COVID-19 and educate them about the disease. Rather than rolling the app out to a relatively small number of local healthcare workers, this time they wanted the COVID-19 app to be available to the general public.

It soon became apparent that the demand on a COVID-19 screening app would be substantially greater than the THINKMD team had handled so far. Beginning work in March 2020, the company’s engineering team wanted to get the app into users’ hands in as short a time as possible. However, in order to support the increased usage, they recognized the need to refactor aspects of the platform.

Heroku’s simplified deployment pipeline again came into its own. For the THINKMD engineering team, the starting point of what would become version four of their platform was a simple matter of forking their GitHub repo, connecting the new repo to Heroku, and copying the pipeline from their existing app. In all, it took only two months to refactor their platform and add data in collaboration with medical experts to deliver the new app.

Today, the COVID-19 app has been distributed to more than 300,000 people in Indonesia through a midwife-led initiative, and it is available to more than a billion mobile phone subscribers throughout Africa.

Heroku empowers a small team to improve the health of thousands

The THINKMD team calculates that for every 1,000 healthcare workers using the app, 300 children’s lives will be saved. As a piece of software engineering, the THINKMD platform must overcome obstacles that might be deemed impossible if only the stakes weren’t so high. By providing an easily scalable deployment platform and a repeatable technology stack, Heroku enables THINKMD to focus on innovative technologies that improve people’s health around the world.

There’s nothing I’d change about Heroku. It has grown with us and supported our journey at every stage. Alex Broussard, CTO, THINKMD

Inside THINKMD on Heroku

The THINKMD platform runs on a Node.js microservices architecture in both the U.S. and European Heroku regions, which supports a VueJS progressive web app deployed to healthcare worker devices. The platform uses Heroku Postgres as its operational data store, with a primary instance in the US region and a follower in Europe. The ThinkMD engineering team put Heroku Pipelines, Heroku Review Apps, and Heroku CI at the heart of their development process. The team uses Tableau to share data with partners.

Code[ish] podcast icon

Listen to the Code[ish] podcast featuring Meg McLaughlin: Saving Lives at Scale: Part One, and the podcast featuring Alex Broussard: Saving Lives at Scale: Part Two.