An AI-powered clinical decision-support web app that predicts Hypothyroidism, Hyperthyroidism, or Normal thyroid function from patient lab + clinical data, explains why (SHAP-style feature contributions), scores risk, and generates a printable medical report.
โ ๏ธ Decision support only โ not a substitute for a licensed physician's diagnosis.
- Multi-class prediction with confidence + per-class probabilities
- Risk scoring: Low / Medium / High
- Explainable AI โ ranked contributing factors (e.g. "High TSH and Low T3 contributed 75% to Hypothyroidism")
- Personalized recommendations (diet, exercise, medical advice, pregnancy alerts)
- Printable PDF report (via browser print)
Rendering mermaid diagram...
The engine in predict.ts is a transparent clinical scoring model using standard
adult reference ranges (TSH 0.4โ4.0 mIU/L, etc.). High TSH โ hypothyroid; low TSH โ
hyperthyroid, weighted alongside T3/TT4/FTI and symptoms (heart rate, weight change,
fatigue, family history). Every score is traceable, which is what powers the
explainability view โ no black box.
| File | Purpose |
|---|---|
main.tsx | Hono HTTP server + API routes |
predict.ts | Prediction + risk + explainability engine |
report.ts | Printable HTML/PDF report builder |
index.html | Patient input UI (Twind styling) |
app.js | Client-side form + results rendering |
To swap the rule-based engine for a real trained model (Random Forest / XGBoost /
neural net per the project brief), keep the same predict() signature and:
- Train offline on a labelled thyroid dataset (e.g. UCI Thyroid).
- Export the model (ONNX / JSON weights) and load it in
predict.ts. - Use SHAP values at training time to seed the contribution weights.
The UI and report layers need no changes.