Heart Risk Case study Home

Not medical advice. Learning project on public data.

Can a simple model give an honest heart risk estimate from public data?

I started with a Framingham dataset from a class assignment, then rebuilt the idea on US national survey data with real death records, and added a Canadian view.

People in the modelNHANES, ages 40 to 7910,7271999 to 2008 exams
Heart disease deathsWithin 10 years23960 in the test set
Test AUCNHANES model0.776Framingham: 0.704
Canada, 35 and olderCCHS 2022, self reported8.9%Ontario: 9.2%

What I built

  • Joined five NHANES survey cycles to the CDC death records and kept adults with no heart disease or stroke at the exam.
  • Trained a logistic regression and exported it to a small JSON file, so the calculator runs in the browser with no server.
  • Put the Framingham model next to it, with calibration charts for both.
  • Added weighted Canadian figures by province, age, sex, smoking and BMI.

From my assignment, and what is new

  • From the assignment: the choice of Framingham data, the BioLINCC reference, and the pandas clean up work.
  • New: every model, metric and chart, the NHANES and CCHS work, the JSON export, the app and the model card.

What the numbers show

The NHANES model ranks people well on unseen data (AUC 0.776), and age, smoking and blood pressure medicine move the estimate most. It rests on 239 deaths and on public records that NCHS partly altered for privacy, so it is a learning tool, not a clinical one. Framingham predicts a broader outcome, so its numbers run higher.