Skip to content

RC-15-coder/HeartRisk_Ai

Repository files navigation

HeartRisk AI – Heart Disease Risk Predictor

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.


🚀 Features

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

🛠️ Tech Stack

  • 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

🖥️ How It Works

  1. User registers or logs in.
  2. Enters biometric data via a secure, validated form.
  3. Frontend calls the API with user input.
  4. Backend API forwards input to Python ML service.
  5. ML service preprocesses input and returns prediction.
  6. Frontend displays risk estimate and visualizations.
  7. Users can view history and personalized recommendations.

🌍 Live Website

Live website is available at: HeartRisk


📊 Model Performance

  • Accuracy: 91.8%
  • ROC-AUC: 0.965
  • Validation: Evaluated on held-out test data with cross-validation.
  • Model: Random Forest (Python, scikit-learn)

⚠️ Disclaimer

This application is intended for educational/demo purposes only and not for medical use.
Always consult a medical professional for actual health advice.


📄 License

This project is MIT Licensed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published