Skip to content

aaanishaaa/HeartByte

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

78 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

HeartByte - Heart Failure Readmission Prediction

** DEPLOYED LINK: https://heart-byte.vercel.app **

Problem Statement

Heart failure is a prevalent and serious medical condition that often leads to hospital readmissions, which pose risks to patient health and contribute to significant healthcare costs. This project aims to predict the likelihood of heart failure patients being readmitted to the hospital within 30 days after discharge using machine learning models. Early identification of patients at risk of readmission can help healthcare providers allocate resources more effectively and offer timely interventions.

Dataset

The dataset used for this project is from the MIMIC-III database, which includes information about heart failure patients, their hospital admissions, diagnoses, and more. Specifically, the dataset contains:

  • ADMISSIONS: Details about each hospital admission, such as discharge time.
  • PATIENTS: Patient demographic data, including age and gender.
  • DIAGNOSES_ICD: Diagnosis codes (ICD-9) for each patient, used to filter heart failure diagnoses.

ICD-9 Codes for Heart Failure:

  • '39891', '40201', '40211', ... , '4289'

Objective

The goal is to predict whether a patient will be readmitted within 30 days after discharge. This can help healthcare providers take proactive measures to reduce readmissions, ultimately improving patient outcomes and reducing the financial burden on hospitals.

Description of Key Folders:

  • backend/: Contains the Python-based ML model, data processing, and results evaluation scripts.
  • frontend/: Contains the ReactJS frontend to interact with the backend for prediction results.

Dependencies

To run this project, you'll need the following Python libraries:

  • pandas
  • numpy
  • matplotlib
  • seaborn
  • scikit-learn
  • flask

Install the dependencies by running:

pip install -r requirements.txt

Along with accurate predictions, we made sure to create user-friendly website with secure user authentication.

Figma Link: https://www.figma.com/design/srSKD2Pv2H9etMUhTxjQo8/Heartbyte?node-id=0-1&t=MDm4zEBP9bXFPA8u-1

Desktop - 1 (1)

Machine Learning Model Description

Please for more details refer : https://github.com/SakshamTyagii/heartbyte

πŸ“Š Dataset Overview

  • Total Patients: 10,272
  • Total Admissions: 16,756
  • Average Admissions per Patient: 1.63
  • 30-day Readmission Rate: 9.75%
  • Readmissions within 30 days: 1,634

βš™οΈ Data Processing Pipeline

Located in src/data_processing.py, this pipeline performs:

  • βœ… Table merging: patients, admissions, diagnoses, procedures
  • βœ… Missing value imputation (mean for numerical, mode for categorical)
  • βœ… One-hot encoding for categorical features
  • βœ… Feature normalization (StandardScaler)
  • βœ… Readmission target creation (30-day window)
  • βœ… Stratified train/test splitting

πŸ” Key Findings

🧬 Comorbidity Analysis

Top ICD-9 codes associated with high readmission rates:

  • 42843 β†’ 12.84%
  • 42841 β†’ 10.96%
  • 42833 β†’ 10.82%

πŸ₯ Clinical Patterns

  • Longer hospital stay increases readmission risk
  • Previous admissions strongly correlate with future readmissions
  • Multiple diagnoses lead to higher readmission probability

πŸ€– Machine Learning Models

Three models were trained and evaluated:

  1. Logistic Regression (Baseline, final model)
  2. Random Forest (Ensemble, better generalization)
  3. XGBoost (Best performing, high complexity)

πŸ“ˆ Evaluation Metrics

  • Precision, Recall, F1-Score
  • ROC-AUC
  • Confusion Matrix
  • Feature Importance Rankings

πŸ”Ž Model Interpretation with SHAP

Used SHAP (SHapley Additive exPlanations) for interpretability:

  • SHAP Summary Plot – Overall feature impact
  • Dependence Plot – How a feature affects predictions
  • Waterfall Plot – Step-by-step explanation of a prediction
  • Force Plot – Visualizes contributions per feature

OUTCOME:

  1. Healthy Patient

    image

  2. At-Risk Patient

    image

UNIT TESTING

  1. When the readmission is high image

  2. When the patient has not authenticated image

  3. When the doctor tries to predict for a Patient that does not exist image

ADDITIONAL FEATURES

Personalized Diet Plan for Patients

This part of the project provides personalized diet recommendations using the Groq LLM API. The system uses a Flask backend to interact with Groq's powerful language models for generating customized meal plans. The project also includes a Node.js backend and components for machine learning models .

image

OFFICIAL DOCUMENTATION

https://docs.google.com/document/d/1v5DqrDbMslF0bF4KlzYulq0jqkfomoN9_nI8mE18rhs/edit?usp=sharing

EXPLANATION VIDEO

https://drive.google.com/file/d/13GFURuUzPL4jqGMBaUWtf_b2dhaU1FM3/view?usp=drivesdk

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •