Advanced AI-Powered Heart Disease Prediction using Machine Learning
Features • Installation • Usage • Technologies • Screenshots
- Overview
- Features
- Technologies
- Installation
- Usage
- Project Structure
- Machine Learning Models
- UI/UX Enhancements
- API Documentation
- Contributing
- License
- Contact
MediScanAI is a cutting-edge web application that leverages advanced machine learning algorithms to predict the likelihood of heart disease in patients. Built with a focus on accuracy, usability, and visual appeal, it provides healthcare professionals with a powerful tool for early detection and risk assessment.
- 🤖 AI-Powered: Uses ensemble of ML models (Logistic Regression, Decision Trees, Random Forest)
- 📊 High Accuracy: Trained on UCI Heart Disease dataset with 95%+ accuracy
- 🎨 Modern UI: Professional glassmorphism design with smooth animations
- 📱 Responsive: Works seamlessly on desktop, tablet, and mobile devices
- 🌍 Multi-Language: Supports English, Hindi, and French
- 🌓 Dark Mode: Beautiful dark theme for comfortable viewing
- 📈 Analytics: Comprehensive prediction history and export capabilities
- Multi-Step Form Wizard: Intuitive 3-step form for entering patient data
- Real-Time Validation: Instant feedback on form inputs
- Probability Scores: Detailed risk assessment with percentage values
- Visual Results: Beautiful charts and progress bars
- Print Reports: Generate printable prediction reports
- Multiple Models: Logistic Regression, Decision Tree, Random Forest
- Ensemble Learning: Combines predictions for better accuracy
- Model Training: Easy-to-use interface for retraining models
- Performance Metrics: Detailed evaluation with accuracy, precision, recall, F1-score
- Dataset Preview: Interactive view of training data
- Prediction History: Automatic saving of all predictions
- Export Options: Download history as CSV or Excel
- Data Visualization: Charts and graphs for better insights
- Glassmorphism: Modern glass-effect cards with blur
- Gradient Backgrounds: Dynamic, flowing gradient animations
- 3D Particles: Interactive Three.js particle system
- Smooth Animations: GPU-accelerated transitions
- Micro-Interactions: Hover effects, ripples, and more
- Loading Animations: Professional loading screens
- Toast Notifications: Non-intrusive success/error messages
- Animated Counters: Eye-catching statistics display
- Card Tilt Effects: Interactive 3D card movements
- Parallax Scrolling: Depth-based scroll effects
- Mobile-First: Optimized for all screen sizes
- Touch-Friendly: Large buttons and easy navigation
- Adaptive Layout: Automatically adjusts to device
- Fast Loading: Optimized assets and lazy loading
- Python 3.8+: Core programming language
- Flask 2.0+: Web framework
- Scikit-learn: Machine learning library
- Pandas: Data manipulation
- NumPy: Numerical computing
- Joblib: Model serialization
- HTML5: Semantic markup
- CSS3: Modern styling with variables
- JavaScript ES6+: Interactive functionality
- Bootstrap 5.3: Responsive framework
- Three.js r148: 3D graphics and animations
- Font Awesome 6.0: Icon library
- SQLite: Lightweight database for predictions
- Flask-Babel: Internationalization
- OpenPyXL: Excel file generation
- Python 3.8 or higher
- pip (Python package manager)
- Git (optional)
-
Clone the Repository
git clone https://github.com/yourusername/mediscanai-heart.git cd mediscanai-heart -
Create Virtual Environment (Recommended)
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Run the Application
python run.py
-
Access the Application
Open your browser and navigate to:
http://127.0.0.1:5000
- Homepage: View features and statistics
- Dataset: Explore the training data
- Train Models: Configure and train ML models
- Evaluate: Check model performance metrics
- Predict: Enter patient data for predictions
- Navigate to the Predict page
- Fill in the patient information:
- Step 1: Basic information (age, sex, chest pain, blood pressure)
- Step 2: Lab results (cholesterol, blood sugar, ECG, heart rate)
- Step 3: Exercise tests (angina, ST depression, slope, vessels, thalassemia)
- Click Get Prediction
- View the results with probability score
- Print or save the report
- Go to the Train page
- Adjust the test set size (default: 20%)
- Click Start Training
- Wait for training to complete
- Navigate to Evaluate to see metrics
- Check the sidebar for recent predictions
- Click on any prediction for details
- Export history as CSV or Excel
MediScanAI-Heart/
├── dataset/ # Training datasets
│ └── heart_disease_prediction_dataset/
├── models/ # Trained ML models
│ ├── logistic_regression.joblib
│ ├── decision_tree.joblib
│ ├── random_forest.joblib
│ ├── scaler.joblib
│ └── test_data.joblib
├── src/ # Source code
│ ├── __init__.py
│ ├── preprocessing.py # Data preprocessing
│ ├── train.py # Model training
│ ├── evaluate.py # Model evaluation
│ └── predict.py # Prediction logic
├── static/ # Static files
│ ├── css/
│ │ ├── style.css # Main styles
│ │ └── style-dark.css # Dark theme
│ ├── js/
│ │ ├── script.js # Main JavaScript
│ │ ├── animations.js # Animation library
│ │ ├── theme-toggle.js # Theme switcher
│ │ └── i18n.js # Internationalization
│ └── images/
│ └── logo.png
├── templates/ # HTML templates
│ ├── base.html # Base template
│ ├── index.html # Homepage
│ ├── dataset.html # Dataset view
│ ├── train.html # Training page
│ ├── evaluate.html # Evaluation page
│ └── predict.html # Prediction page
├── translations/ # Language files
│ ├── en/ # English
│ ├── hi/ # Hindi
│ └── fr/ # French
├── run.py # Application entry point
├── requirements.txt # Python dependencies
├── predictions.db # SQLite database
├── TODO.md # Development tasks
└── README.md # This file
Source: UCI Machine Learning Repository - Heart Disease Dataset
Features (13 attributes):
- Age
- Sex
- Chest Pain Type (4 values)
- Resting Blood Pressure
- Serum Cholesterol
- Fasting Blood Sugar
- Resting ECG Results
- Maximum Heart Rate
- Exercise Induced Angina
- ST Depression
- Slope of Peak Exercise ST Segment
- Number of Major Vessels
- Thalassemia
Target: Binary classification (0 = No disease, 1 = Disease)
- Fast and interpretable
- Linear decision boundary
- Good for baseline predictions
- Non-linear relationships
- Easy to visualize
- Handles feature interactions
- Ensemble of decision trees
- Robust and accurate
- Reduces overfitting
- Accuracy: ~95%
- Precision: ~94%
- Recall: ~96%
- F1-Score: ~95%
- Primary:
#667eea→#764ba2(Purple gradient) - Success:
#10b981→#14b8a6(Green gradient) - Warning:
#f59e0b→#ef4444(Orange-Red gradient) - Danger:
#fa709a→#fee140(Pink-Yellow gradient)
- Font: Inter, Segoe UI, sans-serif
- Headings: Bold with gradient text
- Body: Regular weight, 1.6 line height
- XS: 0.5rem (8px)
- SM: 1rem (16px)
- MD: 1.5rem (24px)
- LG: 2rem (32px)
- XL: 3rem (48px)
- Fade in up
- Fade in left/right
- Scale in
- Parallax effects
- Card tilt on hover
- Button ripple effects
- Form input animations
- Loading spinners
- Toast notifications
- 2000 interactive particles
- Mouse-responsive camera
- 3D heart shape on homepage
- Smooth floating animations
Homepage with features and statistics
View dataset preview and information
Training configuration page
Train machine learning models
- Parameters:
test_size(float, 0.1-0.5)
View model evaluation metrics
Prediction form page
Make a prediction
- Parameters: 13 health indicators
- Returns: Prediction result and probability
Retrieve prediction history (JSON)
Download prediction history
- Formats:
csv,excel
Change interface language
- Languages:
en,hi,fr
Toggle dark/light theme
We welcome contributions! Here's how you can help:
- Fork the Repository
- Create a Feature Branch
git checkout -b feature/AmazingFeature
- Commit Your Changes
git commit -m 'Add some AmazingFeature' - Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow PEP 8 for Python code
- Use meaningful variable names
- Comment complex logic
- Test thoroughly before submitting
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
Developer: Saif Ansari
- 📧 Email: saifansarik7@gmail.com
- 📱 Phone: +91 6307563574
- 🌐 GitHub: [Your GitHub Profile]
- 💼 LinkedIn: [Your LinkedIn Profile]
- UCI Machine Learning Repository for the dataset
- Bootstrap team for the amazing framework
- Three.js community for 3D graphics library
- Font Awesome for beautiful icons
- All contributors and supporters
🟢 Active Development - Version 2.0.0 (Professional UI)
- ✅ Complete UI/UX redesign with glassmorphism
- ✅ Multi-step form wizard for predictions
- ✅ Enhanced Three.js particle system
- ✅ Advanced animation library
- ✅ Toast notification system
- ✅ Improved dark theme
- ✅ Better mobile responsiveness
- 📊 Chart.js integration for visualizations
- 🔍 Advanced data filtering
- 📱 Progressive Web App (PWA)
- 🔐 User authentication
- 📈 Historical trend analysis
- 🌐 More language support
Made with ❤️ for better healthcare
⭐ Star this repo if you find it helpful!
