Heart Disease Risk Predictor
Cardiovascular disease is the leading cause of death worldwide, and early risk identification from routine clinical data can guide timely intervention. This project built and deployed a classification model that predicts a patient's heart disease risk from clinical features, with both an interactive web interface and a programmatic API.
Dataset
UCI: Cleveland Heart Disease Dataset
Key Questions
- Which clinical features are most predictive of heart disease presence?
- Can a simple, interpretable model achieve clinically useful accuracy?
- How can predictions be delivered through both an interactive interface and a programmatic API?
Methods
- Data cleaning and preprocessing of 303 patient records across 13 clinical features
- Logistic regression model training with train/test split validation
- ROC-AUC and accuracy evaluation with feature importance analysis
- Streamlit interface with a risk gauge and feature importance visualisations
- FastAPI REST endpoint with Pydantic input validation for programmatic predictions
Results
The logistic regression model achieved 87% test accuracy and a ROC-AUC of 0.952 in distinguishing patients with heart disease from those without. Chest pain type, maximum heart rate achieved, and ST depression (oldpeak) were among the strongest predictors.
Recommendations
- Use the model as a screening aid alongside clinical judgement, not a diagnostic replacement
- Prioritise review of patients flagged high-risk with elevated oldpeak or abnormal thalassemia results
- Add authentication to the FastAPI backend before any clinical deployment
- Retrain periodically on more diverse patient populations to improve generalisability
Limitations
The training dataset (303 patients from the Cleveland Clinic) is small and dates from the 1980s, so it may not reflect current patient populations or generalise across demographics. The model produces a screening risk score and should not be used for clinical diagnosis without professional review.