Inspiration
In rural India, Community Health Workers (ASHA workers) often screen patients during ~5-minute doorstep visits under intermittent connectivity and frequently without point-of-care glucometers or HbA1c analyzers. Most clinical AI demos fail in the field because they assume stable internet, mandatory lab tests, black-box risk scores, and English-only interfaces.
Sanjeevni Healthcarer (built by Team Aparajit) bridges this gap with an offline-first, bilingual (English / हिन्दी), explainable clinical screening & triage platform engineered for safety, transparency, and real-world rural constraints.
Research Prototype Disclaimer: Sanjeevni Healthcarer is an investigational clinical decision-support prototype, not a diagnostic medical device, and never replaces examination by a qualified physician.
What It Does
- 5-Minute Guided Doorstep Visit (
ASHA Workerrole): Walks workers through Basic Vitals → Blood Pressure → PHQ-9 Mental Health → Triage & Referral with voice read-aloud (EN / हिन्दी), No-Lab Mode toggle, and WhatsApp follow-up sharing. - Dual-Path Clinical Risk Engine (Full-Lab & No-Lab): Automatically routes to a dedicated No-Lab XGBoost model whenever glucose/HbA1c readings are unavailable—clearly flagging predictions as unconfirmed estimates requiring confirmatory glucometer/lab testing.
- Non-Downgradable Clinical Safety Layer: Deterministic clinical rules sit above ML predictions (
shared/triage_thresholds.json), strictly enforcingGREEN -> YELLOW -> REDescalations based on ADA 2024 (Glucose $\ge 300\text{ mg/dL}$, HbA1c $\ge 12.0\%$), AHA/ACC ($BP \ge 180/120\text{ mmHg}$), and PHQ-9 crisis thresholds (Item 9 $> 0$ or total $\ge 20$). Rules can only escalate, never downgrade. - PHC Doctor Triage Queue & HL7 FHIR R4 Export: Sorts patients strictly RED → YELLOW → GREEN, tracks longitudinal vitals, and exports LOINC-coded HL7 FHIR R4 Bundles (
Patient,Observation,RiskAssessment). - Explainable AI & Counterfactuals: Sub-2s SHAP
TreeExplainerdrivers with bilingual plain-language explanations, plus DiCE counterfactuals constrained strictly to modifiable lifestyle features (bmi,HbA1c_level,smoking_history)—never altering immutable attributes like age or gender. - Offline-First PWA: Service Worker (
sw.js) caches the app shell, IndexedDB queues visits with client-generated UUID idempotency, and an offline balancedLogisticRegressionscorer shares identical cutoffs viashared/triage_thresholds.json. - PHQ-9 & Bilingual Hindi RAG Guide: Built-in depression screener with Indian crisis helplines (Tele-MANAS 14416, KIRAN, 112) and Unicode Devanagari RAG over grounded ADA/AHA/PHQ-9 documents.
Data Science, Calibration & Fairness Governance
Trained and evaluated on 100,992 records (80/20 stratified split, 8.5% positive prevalence, RANDOM_SEED = 42):
| Model Path | ROC-AUC | Sensitivity | Specificity | Precision | Brier Score (Uncal → Cal) | ECE (Uncal → Cal) |
|---|---|---|---|---|---|---|
| Full-Lab XGBoost + Platt | 0.9773 | 91.61% | 90.02% | 46.02% | 0.0598 → 0.0258 |
0.0961 → 0.0232 |
| No-Lab XGBoost + Platt | 0.8324 | 78.45% | 72.69% | 21.06% | 0.1697 → 0.0667 |
0.2612 → 0.0076 |
| Offline Balanced Logistic (Full-Lab) | 0.9616 |
— | — | — | 0.0781 | — |
| Offline Balanced Logistic (No-Lab) | 0.8209 |
— | — | — | 0.1756 | — |
Honest Fairlearn Subgroup Audit (100,974 records)
Rather than hiding bias, our live Model Governance Card exposes subgroup metrics directly in the UI:
- Gender Parity: Full-Lab DP Diff
0.0406, EO Diff0.0228(Female recall91.5%, Male recall93.7%). - Age Disparity Limitation: Under-30 recall drops sharply without labs (
66.1%Full-Lab vs3.6%No-Lab), while60+FPR rises (27.9%Full-Lab vs76.1%No-Lab). Our UI explicitly warns clinicians to confirm younger symptomatic patients and60+alerts with lab testing.
How We Built It
- Backend & ML: Python, FastAPI, XGBoost, scikit-learn (Platt calibration + balanced LogisticRegression), SHAP
TreeExplainer, DiCE, Fairlearn, SQLAlchemy + SQLite, JWT RBAC (worker,doctor,admin) with zero-PII audit logs. - Frontend: React 19, TypeScript, Vite 8 PWA (
sw.js+ IndexedDB), Tailwind CSS,i18next(fullEN / हिन्दीparity), Recharts, Framer Motion, Three.js. - Deployment & CI: GitHub Actions (
pytest+npm run build), Docker + Gunicorn/Uvicorn on Render (Backend), and Vercel (Frontend).
Challenges We Faced
- Unfairness & Miscalibration in Raw Tree Models: Raw XGBoost probabilities showed high Expected Calibration Error (
0.2612in No-Lab); Platt scaling reduced No-Lab ECE to0.0076and Full-Lab Brier to0.0258. - Online/Offline Triage Drift: Preventing divergence between the Python backend and browser offline mode required unifying thresholds and logistic weights in a single
shared/triage_thresholds.jsoncontract. - Hindi RAG Tokenization: Standard ASCII regex tokenizers dropped Devanagari scripts; we implemented a Unicode-aware Devanagari tokenizer routing Hindi queries to localized clinical docs with strict refusal ("जानकारी नहीं है") outside grounded guidelines.
Demo Credentials (Quick Select on Login Page)
- ASHA Worker:
[email protected]/Password@123 - PHC Doctor:
[email protected]/Password@123 - Admin:
[email protected]/password123
(Note: Backend runs on Render free tier and may take ~30–50s on the initial cold request.)
Built With
- docker
- fairlearn
- fastapi
- hl7-fhir
- indexeddb
- pwa
- python
- react
- render
- scikit-learn
- shap
- sqlalchemy
- tailwindcss
- typescript
- vercel
- vite
- xgboost