Advanced AI-Powered Cardiovascular Risk Assessment System
CardioPredict Pro is a comprehensive machine learning application that provides intelligent cardiovascular risk assessment using multiple advanced algorithms. Built with a professional medical interface, it offers detailed risk analysis, PDF report generation, and optional database integration for clinical environments.
Try CardioPredict Pro live on Hugging Face Spaces!
Professional cardiovascular risk assessment powered by AI - no installation required
- 4 Advanced ML Models: Logistic Regression, Random Forest, SVM, Gradient Boosting
- Ensemble Prediction: Consensus-based risk assessment for higher accuracy
- Confidence Scoring: Reliability metrics based on model agreement
- Real-time Analysis: Instant cardiovascular risk evaluation
- Clinical-Grade UI: Professional medical theme with intuitive workflow
- Comprehensive Input Form: 13+ clinical parameters including demographics, vitals, lab results
- Interactive Visualizations: Real-time charts and risk probability distributions
- Responsive Design: Optimized for both desktop and mobile medical environments
- Professional PDF Reports: Medical-grade documentation with clinical formatting
- Comprehensive Analysis: Patient demographics, clinical parameters, AI results
- Risk Stratification: HIGH/MODERATE/LOW risk categories with recommendations
- Medical Disclaimer: Proper clinical disclaimers and usage guidelines
- Database Integration: Optional Supabase PostgreSQL for patient records (HIPAA considerations)
- Analytics Tracking: Optional WandB integration for model performance monitoring
- Cloud Deployment: Ready for Hugging Face Spaces deployment
- Extensible Architecture: Modular design for easy customization and scaling
# Python 3.8+ required
python --version
# Git for cloning
git --version- Clone the repository
git clone https://github.com/Raghav0079/cardiopredict-pro.git
cd cardiopredict-pro- Create virtual environment
# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Launch the application
python app.py- Access the interface
- Open your browser and navigate to:
http://localhost:7860 - The professional medical interface will be ready for use
- Open your browser and navigate to:
-
Patient Information
- Enter patient name for PDF report generation
- Input demographic information (age, sex)
-
Clinical Parameters
- Vital Signs: Blood pressure, heart rate
- Laboratory Results: Cholesterol, blood glucose
- Cardiac Diagnostics: ECG findings, stress test results
- Advanced Studies: Angiography, perfusion imaging
-
AI Analysis
- Click "π Analyze Cardiovascular Risk"
- Review multi-model predictions and consensus
- Download comprehensive PDF report
| Risk Level | Model Consensus | Clinical Action |
|---|---|---|
| π¨ HIGH | 3-4 models positive | Urgent cardiology consultation |
| β‘ MODERATE | 2 models positive | Schedule follow-up within 2-4 weeks |
| β LOW | 0-1 models positive | Continue preventive care |
cardiopredict-pro/
βββ π Main Application
β βββ app.py # Primary Gradio application
β βββ gradio_interface.py # Alternative interface implementation
β βββ requirements.txt # Python dependencies
β
βββ π Data & Models
β βββ Cardio_vascular.csv # Sample cardiovascular dataset
β βββ cardio_vascular.ipynb # Jupyter notebook for analysis
β
βββ π Enhanced Features
β βββ database_integration.py # Supabase PostgreSQL integration
β βββ wandb_integration.py # WandB experiment tracking
β βββ test_logging.py # Database logging testing utilities
β
βββ π Advanced Version (cardiopredict-pro/)
β βββ app.py # Enhanced version with full features
β βββ database_integration.py # Advanced database operations
β βββ wandb_integration.py # Professional analytics
β βββ setup_database.py # Database initialization
β βββ test_db.py # Database testing utilities
β βββ view_database.py # Database administration
β
βββ π Documentation
β βββ README.md # This comprehensive guide
β βββ HUGGINGFACE_DEPLOYMENT.md # Deployment instructions
β βββ SUPABASE_SETUP.md # Database setup guide
β βββ WANDB_README.md # Analytics setup guide
β βββ CONTRIBUTING.md # Contribution guidelines and setup
β βββ SECURITY.md # Security policy and best practices
β
βββ π GitHub Templates
β βββ .github/
β βββ ISSUE_TEMPLATE/
β β βββ bug_report.yml # Structured bug report template
β β βββ feature_request.yml # Feature request template
β β βββ medical_question.yml # Medical/clinical inquiry template
β βββ pull_request_template.md # PR template for contributions
β
βββ π Configuration
βββ requirements.txt # Production dependencies
βββ database_schema.sql # Database structure
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore patterns
# Model Ensemble Architecture
models = {
'Logistic Regression': LogisticRegression(C=1, solver='liblinear'),
'Random Forest': RandomForestClassifier(n_estimators=100),
'SVM': SVC(probability=True, kernel='rbf'),
'Gradient Boosting': GradientBoostingClassifier()
}
# Consensus Decision Making
risk_assessment = majority_vote(model_predictions)
confidence_score = calculate_agreement(model_probabilities)| Component | Technology | Purpose |
|---|---|---|
| Frontend | Gradio 5.49.1 | Professional medical UI |
| ML Models | Scikit-learn 1.7.2 | Advanced ensemble algorithms |
| Data Processing | Pandas 2.3.3, NumPy 2.3.5 | Clinical data handling |
| Visualizations | Matplotlib 3.10.7, Seaborn 0.13.2 | Interactive medical charts |
| PDF Generation | ReportLab 4.2.5 | Medical-grade report creation |
| Database | Supabase PostgreSQL | Patient record management |
| Analytics | WandB | Model performance tracking |
| Deployment | Hugging Face Spaces | Cloud hosting |
# Clone and run locally
git clone https://github.com/Raghav0079/cardiopredict-pro.git
cd cardiopredict-pro
pip install -r requirements.txt
python app.pyAutomatic Deployment:
- Fork this repository
- Create new Space on Hugging Face
- Connect your GitHub repository
- Automatic deployment with:
- Free GPU/CPU compute
- Global CDN delivery
- Automatic SSL/HTTPS
- Version control integration
Manual Upload:
- Create new Gradio Space
- Upload
app.py,requirements.txt,README.md - Space will build and deploy automatically
# Dockerfile for containerized deployment
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 7860
CMD ["python", "app.py"]- AWS: Deploy on EC2 with Load Balancer
- Google Cloud: App Engine or Compute Engine
- Azure: Container Instances or Web Apps
- Heroku: Direct git deployment
# Test database connectivity and logging
python test_logging.py
# Verify database setup
python test_db.py
# View stored predictions
python view_database.py# Run with verbose logging
DEBUG=1 python app.py
# Test specific features
python -m pytest tests/ -v # If test suite availableUse the provided .env.example template to configure optional features:
# Copy the template
cp .env.example .env
# Edit with your actual values
# Database Integration (Optional)
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_anon_key
# Analytics Tracking (Optional)
WANDB_API_KEY=your_wandb_api_key
WANDB_PROJECT=cardiopredict-pro
# Email Notifications (Optional)
SMTP_SERVER=your_smtp_server
SMTP_EMAIL=your_email
SMTP_PASSWORD=your_password# Customize ML models in app.py
models['Custom Model'] = YourCustomClassifier(
# Your parameters
)# Modify Gradio theme and styling
demo = gr.Blocks(
theme=gr.themes.YourCustomTheme(),
css=your_custom_css
)- Accuracy: ~85-90% on cardiovascular datasets
- Precision: High specificity for medical applications
- Recall: Optimized for clinical sensitivity
- F1-Score: Balanced performance across risk categories
- Response Time: <2 seconds for risk assessment
- Concurrent Users: 50+ users (Hugging Face Spaces)
- PDF Generation: <3 seconds for comprehensive reports
- Uptime: 99.9% (managed cloud deployment)
- No Data Storage: Default mode stores no patient information
- Optional Database: Secure Supabase integration with encryption
- HIPAA Considerations: Follow healthcare compliance guidelines
- SSL/TLS: Secure data transmission
- Educational Use: Clearly marked for research/educational purposes
- Medical Disclaimers: Comprehensive warnings and limitations
- Professional Review: Requires qualified healthcare interpretation
- Audit Trail: Optional logging for clinical environments
We welcome contributions to improve CardioPredict Pro! Please read our CONTRIBUTING.md guide for detailed instructions.
Before you start:
- Review our Security Policy for security guidelines
- Use our GitHub issue templates for bug reports and feature requests
- Follow the pull request template for structured contributions
# Fork the repository
git clone https://github.com/YourUsername/cardiopredict-pro.git
cd cardiopredict-pro
# Create feature branch
git checkout -b feature/your-improvement
# Install development dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt # If available
# Make your changes and test
python app.py
# Commit and push
git add .
git commit -m "Add: Your improvement description"
git push origin feature/your-improvement
# Create Pull Request- π§ ML Models: Add new algorithms or improve existing ones
- π¨ UI/UX: Enhance the medical interface design
- π Analytics: Improve reporting and visualization features
- π Security: Strengthen data protection and compliance
- π Documentation: Improve guides and examples
- π§ͺ Testing: Add comprehensive test coverage and debugging tools
- π₯ Medical Compliance: Help improve medical disclaimers and safety features
We provide structured templates to help you:
- Bug Reports: Report technical issues
- Feature Requests: Suggest new features
- Medical Questions: Clinical/medical inquiries
- Deployment Guide: Detailed deployment instructions
- Database Setup: PostgreSQL integration guide
- Analytics Guide: WandB experiment tracking
- Contributing Guide: How to contribute to the project
- Security Policy: Security best practices and reporting
- Environment Setup: Configuration template for optional features
- GitHub Templates: Issue and PR templates for structured contributions
- Cleveland Heart Disease Dataset
- Cardiovascular Risk Assessment Guidelines
- Machine Learning in Cardiology
This project is licensed under the MIT License - see the LICENSE file for details.
IMPORTANT: CardioPredict Pro is designed for educational and research purposes only. This tool:
- β Does NOT replace professional medical diagnosis
- β Should NOT be used for clinical decision making
- β Cannot account for individual medical history or comorbidities
- β Requires interpretation by qualified healthcare professionals
- β Is intended for educational and research use only
Always consult qualified healthcare professionals for medical advice, diagnosis, and treatment decisions.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Project Wiki
- Developer: Raghav Mishra
- GitHub: @Raghav0079
- Portfolio: raghav0079.github.io