Upload folder using huggingface_hub
Browse files- .gitignore +11 -0
- README.md +70 -0
.gitignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.pyc
|
| 3 |
+
*.pkl
|
| 4 |
+
*.db
|
| 5 |
+
.env
|
| 6 |
+
venv/
|
| 7 |
+
.DS_Store
|
| 8 |
+
simulator/offline_buffer.jsonl
|
| 9 |
+
*.log
|
| 10 |
+
.vscode/
|
| 11 |
+
.idea/
|
README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# π₯ Smart Health Monitor
|
| 2 |
+
|
| 3 |
+
Edge-AI health monitoring system with **offline-first architecture**, **multi-signal fusion**, and **adaptive personal baselines**.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Quick Start (3 terminals)
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
# 1. Install dependencies
|
| 11 |
+
pip install -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# 2. Train the model (run once)
|
| 14 |
+
python -m ml.train_model
|
| 15 |
+
|
| 16 |
+
# Terminal A β Start Flask API
|
| 17 |
+
python -m backend.app
|
| 18 |
+
|
| 19 |
+
# Terminal B β Run IoT simulator
|
| 20 |
+
python -m simulator.simulate --patient_id 1 --count 60 --anomaly_rate 0.2
|
| 21 |
+
|
| 22 |
+
# Terminal C β Launch Streamlit dashboard
|
| 23 |
+
streamlit run dashboard/app.py
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
## Architecture
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
IoT Sensor β Kalman Filter β Edge ML β Multi-Signal Fusion β Tiered Alert
|
| 32 |
+
β
|
| 33 |
+
SQLite (offline buffer)
|
| 34 |
+
β
|
| 35 |
+
Sync to cloud on reconnect
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## Alert Levels
|
| 41 |
+
|
| 42 |
+
| Level | Trigger | Action |
|
| 43 |
+
|-------|------------------|---------------------------------|
|
| 44 |
+
| 0 | No anomaly | β |
|
| 45 |
+
| 1 | Mild (score>0.4) | Local buzzer |
|
| 46 |
+
| 2 | Moderate (β₯2 signals) | SMS via GSM / 2G |
|
| 47 |
+
| 3 | Critical (score>0.85 or 3+ signals) | Push notification |
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## API Endpoints
|
| 52 |
+
|
| 53 |
+
| Method | Path | Description |
|
| 54 |
+
|--------|-----------------------------|--------------------------|
|
| 55 |
+
| GET | `/api/patients` | List all patients |
|
| 56 |
+
| POST | `/api/patient` | Register new patient |
|
| 57 |
+
| POST | `/api/vitals` | Ingest sensor reading |
|
| 58 |
+
| GET | `/api/vitals/<id>` | Get vitals history |
|
| 59 |
+
| GET | `/api/alerts/<id>` | Get anomaly alerts only |
|
| 60 |
+
| GET | `/api/baseline/<id>` | Get adaptive baseline |
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Key Innovations
|
| 65 |
+
|
| 66 |
+
- **Adaptive Personal Baseline** β Welford online algorithm, no raw history stored
|
| 67 |
+
- **Multi-Signal Fusion** β Alert requires β₯2 independent signals to fire
|
| 68 |
+
- **Kalman Filter** β Real-time noise reduction before ML inference
|
| 69 |
+
- **Offline-First** β SQLite buffer + auto-sync on reconnect
|
| 70 |
+
- **ABDM-Ready** β `health_id` field on every patient for Ayushman Bharat integration
|