A full-stack web application for estimating 10-year heart disease risk. Users can enter their health metrics, view instant personalized predictions, and track results over time. The project seamlessly integrates a machine learning backend (Python/Scikit-learn) with a Next.js (React 19, TypeScript, TailwindCSS) frontend, focusing on usability, transparency, and healthcare impact.
- Instant Risk Prediction: Enter biometric data—age, sex, blood pressure, cholesterol, diabetes, smoking status, and more—to get a personalized 10-year heart disease risk estimate.
- State-of-the-art Model: Powered by a Random Forest classifier (scikit-learn), trained on the Framingham Heart Study dataset. Achieved 91.8% accuracy and ROC-AUC 0.965 on test data.
- User-Friendly Frontend: Responsive UI built with React 19, TypeScript, TailwindCSS, and Radix UI. Accessible on both desktop and mobile.
- Robust Form Validation: Utilizes Zod and React Hook Form for type-safe, real-time form validation and clear error messaging.
- Interactive Dashboards: Visualize individual risk results, model performance (confusion matrix, ROC curve), and risk history over time.
- Personalized Health Tips: Dashboard displays actionable advice based on user results and risk category.
- Secure API Endpoints: All user data and prediction requests handled by secure Next.js API routes.
- Layered Architecture: Clean separation of concerns between frontend, backend, and machine learning microservice for maintainability.
- Automated Testing: Includes unit/integration tests with Jest and React Testing Library.
- Frontend: Next.js 15, React 19, TypeScript, TailwindCSS, Radix UI, React Hook Form, Zod
- Backend API: Next.js API routes (TypeScript)
- ML Service: Python (Flask/FastAPI), scikit-learn, pandas, joblib (for model serialization)
- Data: Framingham Heart Study dataset
- Testing: Jest, React Testing Library
- Deployment: Vercel (frontend), Render (Python ML microservice)
- Version Control: Git/GitHub
- User registers or logs in.
- Enters biometric data via a secure, validated form.
- Frontend calls the API with user input.
- Backend API forwards input to Python ML service.
- ML service preprocesses input and returns prediction.
- Frontend displays risk estimate and visualizations.
- Users can view history and personalized recommendations.
Live website is available at: HeartRisk
- Accuracy: 91.8%
- ROC-AUC: 0.965
- Validation: Evaluated on held-out test data with cross-validation.
- Model: Random Forest (Python, scikit-learn)
This application is intended for educational/demo purposes only and not for medical use.
Always consult a medical professional for actual health advice.
This project is MIT Licensed.