MaternaGuard is a maternal health risk triage platform for low-resource settings. It combines a trained ML risk model, a FastAPI backend, and a React web app to help identify high-risk pregnancy cases early and support faster escalation.
To open the deployed app:
- Open https://materna-guard.vercel.app in a browser.
- Go to Log and submit vitals.
- The frontend calls the Render backend for prediction.
- View risk result, dashboard updates, and alerts.
70,000+
Maternal deaths in India/year
67%
Preventable with early detection
< 5s
Time to triage result
800M+
Underserved Indians in rural
SDG-3 Aligned • Good Health & Well-being • Ayushman Bharat Integration Ready • NHM Programme Compatible
- Saves lives — flags high-risk before crisis, not after
- Empowers ASHA workers with clinical AI on basic Android
- Fills last-mile gap — no hospital infrastructure needed
- Auto SMS referral eliminates manual escalation delay
- ₹0 Zero-cost stack — free-tier tools, no licensing fees
- Scales nationally via REST API + Ayushman Bharat stack
- Reduces unnecessary referrals — saves transport & tertiary costs
- Open-source — publishable for global maternal health research
- Sustainable: runs on existing phones, no new hardware needed
Input vitals used in app prediction flow:
- Age
- Systolic BP
- Diastolic BP
- Blood Sugar
- Body Temperature
- Heart Rate
The system predicts one of three classes:
- Low Risk
- Mid Risk
- High Risk
For high-risk predictions, the app records an in-app visual alert mimicking a referral SMS push.
- Data Harmonization: Integrated DS1 (UCI), DS2 (Mendeley), and DS3 (Mendeley - translated Bengali features) and defensively cleaned ambiguous 'non high' labels.
- Class Balancing: Upgraded from SMOTE to ADASYN, specifically targeting the Low/Mid risk confusion zone.
- Cross-Validation & Tuning: Transitioned to 10-fold/5-fold Stratified K-Fold CV with
GridSearchCVhyperparameter tuning. - MaternalNET-RF Feature Fusion: Extracted 16-dimensional activations from the ANN's penultimate layer, concatenated with original features, and fed into the Random Forest and SVM models for non-linear representation.
- Selective PCA: Optimized Gradient Boosting trees using a PCA dimensional reduction pipeline.
- Stacking Meta-Learner: Replaced basic probability averaging with an SVM (RBF Kernel, C=10, gamma=1) meta-learner that intelligently combines the output matrices of RF, SVM, ANN, XGB, and GBT.
Based on the merging of unifying DS1, DS2, and DS3 with ADASYN and our Stacking architecture, here are the evaluation results for all models we developed:
Random Forest (Feature Fused)
- Overall Accuracy: 0.8155
- Macro F1: 0.7866
- High Risk Recall: 0.8658
SVM (RBF Kernel)
- Overall Accuracy: 0.7267
- Macro F1: 0.6986
- High Risk Recall: 0.7718
ANN
- Overall Accuracy: 0.6629
- Macro F1: 0.6275
- High Risk Recall: 0.7450
XGBoost
- Overall Accuracy: 0.8360
- Macro F1: 0.8009
- High Risk Recall: 0.9128
Gradient Boosting (PCA piped)
- Overall Accuracy: 0.7790
- Macro F1: 0.7486
- High Risk Recall: 0.8121
Ensemble Meta-Learner (SVM Stacking)
- Overall Accuracy: 0.9021
- Macro F1: 0.8722
- High Risk Recall: 0.9463
- DS1: Ahmed, M. (2020). UCI ML Repository #863. IoT-collected, rural Bangladesh. 1,014 records, 6 features, 3-class labels (Low/Mid/High Risk). CC BY 4.0.
- DS2: Mojumdar et al. (2024). Mendeley Data, DOI: 10.17632/p5w98dvbbk.1. 12 features incl. BMI, prev. complications, gestational diabetes, mental health. CC BY 4.0.
- DS3: Chayan, A.R. (2024). Mendeley Data, DOI: 10.17632/8k9pvpmykk/1. Obstetric history: gravida, gestational age, fetal heart rate, anemia. IEEE DataPort.
Dataset composition metrics and evaluation data are preserved in ml_new/docs/.
MaternaGuard uses a highly scalable, free-tier optimized Three-Tier Serverless Architecture:
- Frontend (Vercel): React + Vite. Features a robust Offline-First PWA design that gracefully handles network drops and backend cold-starts by queuing assessments locally and auto-syncing when connectivity is restored.
- Backend (Render): FastAPI + SQLAlchemy + PostgreSQL. Handles authentication, patient data, offline-sync conflict resolution, and Twilio SMS routing. Configured automatically via
render.yaml. - ML Inference (AWS Lambda): Containerized Python 3.12 (arm64) running Scikit-Learn, TensorFlow, and XGBoost, all hosted on serverless infrastructure. Separating ML from the backend reduces memory costs and allows the ML models to scale independently.
Supporting root deployment files:
render.yaml- Automated Render blueprint for PostgreSQL & FastAPIlambda_ml/Dockerfile- AWS Lambda inference container configurationdeploy_lambda.sh- Automated script to build and push the arm64 Lambda imagecreate_api_gateway.sh- Automated script to expose Lambda securely via AWS API Gateway
Backend:
- Create and activate a Python virtual environment.
- Install dependencies from
requirements.txt. - Copy
.env.exampleto.envand update variables (leaveLAMBDA_PREDICT_URLempty to run ML locally). - Start API with
uvicorn backend.app:app --reload.
Frontend:
- Open
app/. - Install Node packages.
- Start with
npm start.
- Frontend: Vercel. Set
VITE_API_BASE_URLto your Render backend domain. - Backend: Render. Connect your GitHub repository using the "Blueprint" option to automatically deploy the Postgres Database and FastAPI service based on
render.yaml. - ML Inference: AWS Lambda. Run
./deploy_lambda.shto push the container, then./create_api_gateway.shto generate the public endpoint. Add this endpoint to the Render dashboard asLAMBDA_PREDICT_URL.
Done:
- Model integration with backend prediction API.
- Frontend prediction workflow and dashboard risk display.
- Demo-level high-risk alert behavior.
- Multi-model training artifacts and reports in
ml_new/docs.
Pending for real-world deployment:
- Formal clinical validation.
- Government and hospital process integration.
- Operational referral workflow approvals.
- Production identity and access management.