❤️ HeartSense AI
Personalized Cardiovascular Risk & Progression Companion
🌟 Inspiration
Cardiovascular diseases (CVDs) remain one of the leading causes of death worldwide, especially in developing countries where early screening and continuous monitoring are often inaccessible.
The inspiration behind HeartSense AI came from a simple question:
“What if anyone could estimate their heart risk early, using just basic health inputs, directly from a browser?”
As a Computer Science Engineering student, I wanted to build a practical, AI-powered healthcare companion that bridges the gap between medical knowledge and everyday users—without requiring expensive tests or devices.
🧠 What I Learned
Through this project, I gained hands-on experience in:
- Applying Machine Learning (Random Forest) to real-world health data
- Understanding feature importance in cardiovascular risk prediction
- Building a full-stack ML web application using Python & Flask
- Integrating data preprocessing, model training, and prediction into a single workflow
- Deploying a local AI system accessible via a web browser
I also learned how critical data validation, error handling, and user-friendly design are when building health-related applications.
🛠️ How I Built the Project
1. Data Layer
- Used a cardiovascular dataset (
cardio_data.csv) containing attributes such as:- Age, Gender
- Blood Pressure (Systolic)
- Smoking & Physical Activity status
- Selected medically relevant features to avoid noise and overfitting.
2. Machine Learning Model
- Algorithm used: Random Forest Classifier
- Steps involved:
- Data splitting (Train/Test)
- Feature scaling using StandardScaler
- Model training and probability-based prediction
The predicted output is a risk probability:
[ \text{CVD Risk (\%)} = P(\text{Cardio Disease} = 1) \times 100 ]
3. Risk Interpretation Logic
Based on the predicted risk:
- 🟢 Low Risk: ( < 20\% )
- 🟡 Moderate Risk: ( 20\% \leq \text{Risk} < 50\% )
- 🔴 High Risk: ( \geq 50\% )
Additionally, the system generates personalized lifestyle advice using rule-based logic (e.g., smoking, inactivity, high BP).
4. Web Interface
- Built using python + HTML + CSS+jss
- Runs entirely in the browser
- Users input health details step-by-step
- Output includes:
- Risk percentage
- Risk level (color-coded)
- Actionable health suggestions
🚧 Challenges Faced
🔹 Environment & Dependency Issues
- Missing Python libraries (
sklearn,pandas) - Path and interpreter configuration in VS Code
✅ Solved by proper virtual environment setup and dependency installation.
🔹 Data & Feature Mismatch
- Errors due to missing or misaligned dataset columns
- Handling incorrect or incomplete user inputs
✅ Fixed using explicit feature selection and validation checks.
🚀 Final Outcome
HeartSense AI is now:
- ✅ Fully functional
- 🌐 Browser-accessible
- 🤖 AI-powered
- 🧑⚕️ Designed for early heart-risk awareness
This project strengthened my confidence in building end-to-end intelligent systems and showed me how technology can make a real social impact in healthcare.
🔮 Future Enhancements
- Add diastolic BP and BMI
- Time-based risk progression visualization
- User accounts & report downloads
- Integration with wearable devices
HeartSense AI is not a diagnostic tool, but a smart companion for awareness, prevention, and healthier choices.
❤️