File size: 1,408 Bytes
ae9d4b1
f2f8e74
 
ae9d4b1
f2f8e74
ae9d4b1
f2f8e74
ae9d4b1
f2f8e74
 
ae9d4b1
 
f2f8e74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: Gallstone Risk Demo
emoji: 🩺
colorFrom: green
colorTo: gray
sdk: docker
app_port: 8000
pinned: false
license: mit
short_description: Rural adaptation of UCI Gallstone (GB + SHAP + bioimpedance)
---

# Gallstone Risk — FastAPI backend

Rural-adaptation inference API for a gallstone disease ML case study.
Serves a scikit-learn `Pipeline(StandardScaler → GradientBoostingClassifier)`
trained on the UCI Gallstone dataset (319 records, 25 features — no blood lab
work), plus a SHAP `TreeExplainer` and a bioimpedance template generator.

- **Model metrics:** Accuracy 0.7708, AUC 0.8138
- **Frontend:** [gallstone.rosewt.dev](https://gallstone.rosewt.dev) (Next.js / Vercel)
- **Source:** [github.com/rosewt-upc/WinterProject](https://github.com/rosewt-upc/WinterProject)

## Endpoints

| Method | Path | Purpose |
|---|---|---|
| `GET` | `/health` | Liveness + model/explainer load state |
| `GET` | `/model/info` | Metrics JSON from training run |
| `POST` | `/predict/rural` | 25-feature payload → probability + risk_level |
| `POST` | `/explain/rural` | Same payload → SHAP values + base_value |
| `POST` | `/generate/bioimpedance` | Demographics → 15 synthetic bioimpedance vars |

Validate with the Postman collection shipped in the source repo
(`demo/backend/postman_collection.json`, 31 assertions).

---

_Academic project · UPC 2024 · Does not replace medical diagnosis._