AI Chronic Disease Risk Screener

Screening for 5 Conditions from a Questionnaire, Nail Photo and Retina Photo

PythonPyTorchXGBoostLightGBMScikit-learnOptunaONNXFastAPINext.jsReactTypeScriptTailwind CSS
Project Overview

Built an end-to-end screening app for five common conditions: hypertension, type 2 diabetes, chronic kidney disease, anemia and diabetic retinopathy. Questionnaire models are trained on 17,296 US adults from the CDC's NHANES survey with labels from real measurements, not self-report; the anemia model estimates haemoglobin from fingernail colour; and the retinopathy model grades fundus photos. Every model is tested on data it never saw, reported with confidence intervals, and documented with a model card. Educational and research project, not a medical device.

Key Features
  • 5 conditions screened in about 5 minutes, with no blood test
  • Questionnaire models (XGBoost / LightGBM) calibrated so "30% risk" really means ~30 in 100
  • Automatic nail detection (Faster R-CNN): users upload a plain photo, no cropping needed
  • Retinopathy grading (0–4) with a 5-model EfficientNet-B0 ensemble
  • Explainability: SHAP feature importance and class-activation maps
  • Fairness audit across sex, age band and ethnicity
  • Results as low / moderate / high risk with next steps, savable as PDF, mobile-friendly
  • Photos processed in memory, never stored; 54 automated tests
Results
  • Diabetic retinopathy: 0.972 AUROC for referable DR on a 400-image held-out test set, with 92% sensitivity / 89% specificity
  • Retinopathy grading agreement with ophthalmologists: 0.852 quadratic weighted kappa (above 0.8 = strong)
  • Anemia from a fingernail photo: 0.846 AUROC (cross-validated, 250 adults)
  • Questionnaire models on later survey data (2021–2023): diabetes 0.806, hypertension 0.789, kidney disease 0.786 AUROC
  • Nail detector finds 99.7% of nails automatically
Technical Challenges
  • Avoiding over-optimistic results from random test splits
  • Only 250 people in the anemia dataset
  • Users upload plain photos, not cropped nails
  • Running deep learning models cheaply and fast
Solutions Implemented
  • Trained on 2011–2018 NHANES surveys and tested on people surveyed in 2021–2023; folds grouped by person or photo session to prevent leakage
  • Compared 10 approaches; frozen EfficientNet-B0 embeddings + ridge regression won, because full fine-tuning overfit
  • Trained a Faster R-CNN nail detector that finds 99.7% of nails, with no accuracy loss vs hand-drawn boxes (0.846 vs 0.840 AUROC)
  • Exported image models to ONNX to run on CPU in FastAPI, with no GPU or PyTorch on the server and predictions well under a second
Technology Stack
PythonPyTorchXGBoostLightGBMScikit-learnOptunaONNXFastAPINext.jsReactTypeScriptTailwind CSS

Interested in Similar Projects?

Let's discuss how I can help bring your ideas to life with modern technologies and data-driven solutions.