AI-powered preventive health system for Tunisia — chronic disease risk detection using ML ensemble (RF + XGBoost), SHAP explainability, and INS Tunisia data integration.
# Sanad AI — سند
> **National Preventive Health System for Tunisia** — An intelligent platform for early detection of chronic diseases (diabetes, cardiovascular disease), adapted to the Tunisian context by integrating socio-environmental INS data for each governorate (wilaya).
---
## 🎯 Features
- **ML Model** — Random Forest + XGBoost ensemble (81.5% recall on positive class)
- **Tunisia Layer** — 12 real INS indicators across all 24 wilayas
- **SHAP Explainability** — top 3 determining risk factors per prediction
- **Ministry Dashboard** — interactive choropleth risk map of Tunisia
- **React Interface** — citizen and nurse modes
- **JWT Authentication** — 3 roles (nurse, minister, admin)
- **PostgreSQL** — persistent storage of predictions
---
## Screenshots
### Ministry Dashboard — National KPIs
### Interactive Risk Map by Wilaya
### Patient Risk Simulator
### SHAP Explainability — Top Risk Factors
### Secure JWT Login
### React Interface — Citizen Mode
### React Interface — Nurse Mode
---
## Architecture
```
sanad/
├── api/ → FastAPI backend (/predict, /heatmap, /login)
├── dashboard/ → Streamlit Ministry dashboard
├── data/geo/ → Tunisia INS data (ins_tunisia.py)
├── db/ → PostgreSQL schema and functions
├── frontend/ → React interface (citizen + nurse)
├── model/ → Trained models (.pkl)
├── notebooks/ → Jupyter notebooks (Sprint 1, 2, 3)
└── docs/ → Project report (PDF) +presentation
```
---
## How It Works
```
┌──────────────┐ ┌─────────────────┐ ┌──────────────────┐
│ Patient │────▶│ Feature Vector │────▶│ RF + XGBoost │
│ Input │ │ + Tunisia Layer │ │ Ensemble │
└──────────────┘ │ + INS Data │ └────────┬─────────┘
└─────────────────┘ │
▼
┌────────────────┐ ┌──────────────┐
│ SHAP │◀───│ Risk Score │
│ Explanation │ │ + Level │
└────────────────┘ └──────────────┘
```
The mod …