chap-scheduler¶
A FastAPI service that drives chap disease-forecast predictions against a DHIS2 instance on a schedule, using Prefect for orchestration. Packaged for Docker.
Prototype only
This project is exploratory. APIs, behaviour, dependencies, data shapes,
and operational conventions will change without notice. Don't rely on it
for operational, clinical, or otherwise critical workloads. The embedded
Prefect UI is unauthenticated; the default compose.yml binds to
127.0.0.1 only. See the README for the full safety note.
What it does¶
For each configured model with data source registered in chap, the flow:
- Probes DHIS2 for the freshest period where every required covariate has
data, and uses that as the prediction's end period (operators can override
via the
end_modedropdown:fixed+end_dateoroffset+end_period_offset). - Pulls the analytics rows + organisation-unit GeoJSON from DHIS2.
- Builds a chap
make-prediction-with-data-sourcerequest and submits it over the DHIS2 → chap proxy routes (/api/routes/chap/run/*). - Polls the chap job until it terminates and stores the result.
- Emits a markdown run-report artifact in the Prefect UI summarising per-model outcomes, failures, and any rejections.

Where to start¶
- Prefect primer — five-minute orientation on flows, blocks, deployments, and work pools. The rest of the docs assume the vocabulary.
- Architecture — how the FastAPI app, embedded Prefect server, worker, DHIS2, chap, and Postgres fit together (with a diagram).
- Operations — triggering a run, scheduling via the Prefect UI, reading the run-report, and common troubleshooting.
- Quick-start, env, CLI — see the README on GitHub.
Project links¶
- Source: dhis2-chap/chap-scheduler
- Tracking issue: CLIM-638
- Deferred work: ROADMAP.md