Raya is a robust, offline-first clinical decision support system designed for Community Health Extension Workers (CHEWs) in Nigeria. Its core objective is to reduce maternal and neonatal mortality in remote areas by detecting high-risk pregnancies (like pre-eclampsia) early, routing dynamic data via DHIS2 Tracker, and supporting an SMS/USSD fallback logic layer for immediate triage when mobile internet is scarce.
This project integrates four critical infrastructure layers:
- CommCare XForms - For complex, strictly offline data collection on Android.
- Africa's Talking USSD Fallback - A zero-data triage fallback for feature phones.
- DHIS2 Provisioning - Idempotent REST API scripts to map healthcare hierarchies and tracker metadata.
- MOTECH Data Bridge - A Node.js middleware server that listens to CommCare Webhooks and syncs JSON data securely into the unified DHIS2 Tracker via
axios.
commcare/anc_form.xml: The standalone offline XForm. Contains native OpenRosa (Javarosa) calculations and binding constraints to evaluate gestational age and blood pressure locally.webhook/index.js: The Express.js backend Server executing Phase 2 and Phase 4. Handles dynamic USSD prompts onPOST /ussdand processes CommCare XML syncs onPOST /commcare/webhookusingfast-xml-parser.scripts/provision_dhis2.js: A secure, idempotent Node.js script designed to map Tracker metadata directly to DHIS2 v2.40+.local_setup/.env.example: Reference configuration for managing PAT (Personal Access Tokens), API keys, and Sandbox credentials.
Before diving in, copy the example environment template:
cp local_setup/.env.example local_setup/.envEnsure your DHIS2 credentials (e.g., from play.dhis2.org) and Africa's Talking Sandbox API keys are configured inside your new .env file.
To initialize the backend tracker infrastructure:
# Run the idempotent setup
node scripts/provision_dhis2.jsNote: Due to its idempotent design, you can run this multiple times without duplicating OrgUnits or Programs!
We use Ngrok to tunnel our local server so CommCare and Africa's Talking can reach it securely.
cd webhook
npm install
node index.jsIn a new terminal tab, launch Ngrok for port 3000:
ngrok http 3000- Take your dynamically generated Ngrok URL (e.g.,
https://xxxx.ngrok-free.app) and paste it into the Africa's Talking Sandbox Dashboard under your USSD callback appending/ussd. - Paste the exact same URL appended with
/commcare/webhookinto your CommCare HQ Data Forwarding webhook settings.
- USSD Danger Sign Triage: Open the Africa's Talking Sandbox Simulator. Dial your registered shortcode (e.g.,
*384*56224#). Hit option1for severe signs (Bleeding) to see the immediate session logic terminate and instruct an emergency referral seamlessly. - Offline XForms Sync: Import
anc_form.xmlinto CommCare HQ App Builder Settings -> Advanced -> Import XForm. Open the Android application fully offline, trigger a "High Risk" blood pressure condition, and witness the dynamic Referral Slip UI pop up. - Once the Android device hits a 2G/WiFi connection, CommCare's sync fires the XML data straight into our
POST /commcare/webhook. Notice the terminal logs parse the XML, extract theis_high_riskflag, and trigger the Axios Tracker POST securely to DHIS2.
- Node.js 20+ (ES Modules)
- Express / fast-xml-parser / Axios
- DHIS2 REST API v2.36+ (Tracker)
- CommCare Javarosa XForms
- Africa's Talking API