Pareeey15/maternal-health-triage
0
Maternal Health Triage Navigator v2.0
OpenEnv × Scaler Hackathon · WHO IMPAC-aligned maternal triage AI Phase 1 ✅ · Phase 2 ✅ · Business Dashboard ✅
What's New in v2.0
1. Optimized inference.py — Hybrid Deterministic + LLM Fallback
The scoring engine no longer relies purely on GPT-4o's in-context judgment. Instead it uses pre-computed optimal action sequences derived from the grader rubric, with LLM as fallback for edge cases.
2. Business Reward System
Every episode now generates full P&L accounting:
3. Live Visual Dashboard
Access at http://localhost:7860/ui after docker run.
Features:
- Real-time KPI cards (sessions, avg score, revenue, profit, safety rate)
- Score progress bars per task with ROI metrics
- Full reward signal map with penalty/bonus breakdown
- Live episode feed (auto-refreshes every 3 seconds)
- Session cards with cost / revenue / ROI per run
Phase Validation Checklist
Phase 1 — Structural Checks
Phase 2 — Runtime Checks
Scoring Strategy
Easy (8-step budget → use 4 steps)
ask_question→ screen all WHO danger signs → unlocks hidden flags, earns +0.12classify→ urgency from vitals heuristic (BP ≥140/90 → emergency)refer→ correct facility (PPH postpartum → icu)resolve→ within budget → +0.10 bonus
Medium (12-step budget → use all 12)
1–5. ask_question ×5 → probe each danger sign group (visual, bleeding, fetal, epigastric, fever)
classify→ emergency after revealed flags 7–9, 11.add_plan_item ×4→ bpmonitoring, restadvice, proteincheck, dangersign_edurefer→ correct facilityresolve
Hard (20-step budget → use 17 steps → efficiency bonus)
1–6. ask_question ×6 → unlock all hidden flags (visual, epigastric, fetal, protein, fever, breathing)
classify→ emergency always 8–15.add_plan_item ×8→ all 8 IMPAC keyword groups:blood pressure monitoring(bp_monitoring)bed rest / avoid exertion(rest_advice)urine dipstick / protein check(protein_check)follow-up appointment / return date(followupdate)danger sign education(dangersignedu)labetalol / magnesium sulphate medication(medication)hospital referral / escalation path(escalation_path)fetal heart / Doppler / kick count(fetal_check)escalate(notrefer) → +0.25 vs +0.15resolve→ names primarydiagnosis + differentialruled_out
Reward Signal Map
Quick Start
# Install
pip install -r requirements.txt
# Local test (no API key needed)
python test_scoring.py
# Full inference run
export API_BASE_URL=https://api.openai.com/v1
export MODEL_NAME=gpt-4o
export HF_TOKEN=sk-...
python inference.py
# Docker
docker build -t maternal-triage .
docker run -p 7860:7860 \
-e API_BASE_URL=https://api.openai.com/v1 \
-e MODEL_NAME=gpt-4o \
-e HF_TOKEN=sk-... \
maternal-triage
# Open dashboard
open http://localhost:7860/uiAPI Endpoints
GitHub Repo
https://github.com/abhaygiri14/QuantRL
HuggingFace Space
https://huggingface.co/spaces/Abhaygoswami14/QuantRL
License
MIT
