Free 30-minute AI & automation audit with a senior engineer. You keep the notes. Book yours

Use case · Public health

Predicting which overdue patients will return to care, so health workers call them first

Machine-learning scores that rank overdue hypertension patients by their chance of returning to care, synced to the mobile devices health workers already use.

Client details are kept confidential. This use case describes the problem and what we built.

The brief

A public-health programme runs a clinical platform that helps primary-care teams manage hypertension and diabetes patients across several countries. Missed follow-ups are one of the biggest risks to blood-pressure control, and nurses have limited time for reminder calls.

We built a machine-learning scoring pipeline that predicts which overdue patients are most likely to return to care. We then extended the platform’s server so these scores sync to health workers’ devices, along with several other improvements contributed to the main codebase.

The challenge

What needed solving

Too many overdue patients, too little time

Primary-care facilities in a large hypertension-control programme have long lists of patients who missed follow-up visits. Health workers can't call everyone, so they need to know whom to call first.

Different behaviour after a call

Patients who have already been contacted behave differently from those who haven't. A single model would blur these two groups.

Scores must reach offline phones

Health workers use a mobile app that syncs with a central server. Any score has to travel through that sync reliably, without dropped or duplicated records.

The solution

What we built

  1. Two-track model design

    Separate scikit-learn pipelines for patients who were already called and those who weren't. Each pairs a random-forest classifier (will the patient visit?) with a regressor (how long until they do?).

  2. Combined likelihood score

    The two outputs are combined into one score: the chance a patient returns within 30 days. Validation scripts report AUC, precision, recall and the ranking quality of the combined score.

  3. Reproducible training pipeline

    Numbered scripts cover extraction, splitting, training, validation and evaluation, and they run in Docker. Scores are written back to a PostgreSQL table by a batch scoring job.

  4. Sync API for patient scores

    We added a read-only sync endpoint to the Ruby on Rails server with (updated_at, id) keyset pagination and UTC-safe process tokens, so devices receive every score exactly once.

  5. Platform improvements

    We also added a feature-flagged district and facility filter for patient de-duplication, country-specific reporting configuration, and a QA pipeline.

The outcome

What changed

Prioritised call lists

Health workers can sort overdue patients by their chance of returning, instead of working through lists in date order.

Reliable delivery to devices

Keyset pagination removed the skipped and duplicated records that timestamp-only sync could cause.

Technology used

  • Python
  • scikit-learn
  • pandas
  • PostgreSQL
  • Ruby on Rails
  • RSpec
  • Docker

Have a similar problem to solve?

Share a few lines about your project. A senior engineer — not a salesperson — replies within one business day.

Free AI audit Let’s talk