Public
AI-powered thyroid disease detection and risk prediction
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ€“ all from the browser, and deployed in milliseconds.

๐Ÿฆ‹ Thyroid Disease Detection

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.

Features

  • 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)

How it works

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.

Files

FilePurpose
main.tsxHono HTTP server + API routes
predict.tsPrediction + risk + explainability engine
report.tsPrintable HTML/PDF report builder
index.htmlPatient input UI (Twind styling)
app.jsClient-side form + results rendering

Extending to a trained ML model

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:

  1. Train offline on a labelled thyroid dataset (e.g. UCI Thyroid).
  2. Export the model (ONNX / JSON weights) and load it in predict.ts.
  3. Use SHAP values at training time to seed the contribution weights.

The UI and report layers need no changes.