Advanced healthcare risk assessment with temporal projections, intervention simulation, and AI-powered care pathways
HealthGuard AI represents a breakthrough in preventive healthcare analytics, combining ensemble machine learning, temporal risk projection, and agentic AI to provide comprehensive multi-disease risk assessment and personalized care planning.
- Multi-Disease Ensemble: 9 models across 3 diseases (Diabetes, Heart Disease, Kidney Disease)
- Temporal Risk Projection: Predict future risk trajectories with uncertainty quantification
- Intervention Simulator: Interactive "what-if" scenarios showing how lifestyle changes affect risk
- Explainability Trinity: SHAP technical analysis + Natural language explanations + Counterfactual analysis
- Agentic Care Pathways: LangGraph-powered 12-week personalized intervention plans
- Medical Knowledge Graph: Evidence-based recommendations with RAG system
Patient Input
|
v
Multi-Disease Ensemble Models
|
v
Temporal Risk Projector + Intervention Simulator
|
v
Explainability Trinity (SHAP + LLM + Counterfactual)
|
v
LangGraph Agent + Medical Knowledge Graph
|
v
Personalized Care Pathway + PDF Report
- Diabetes: Logistic Regression ensemble with feature engineering
- Heart Disease: Ensemble model with cardiovascular risk factors
- Kidney Disease: Predictive model with renal function markers
- 6-month and 1-year risk projections
- Uncertainty quantification with confidence intervals
- Natural disease progression modeling
- Interactive sliders for BMI and glucose changes
- Real-time risk recalculation
- Multiple intervention scenarios (Lifestyle, Aggressive, Exercise-only)
- Level 1: SHAP waterfall plots for technical interpretation
- Level 2: LLM-generated patient-friendly explanations
- Level 3: Counterfactual analysis ("What would it take to be low risk?")
- 12-week phased intervention plans
- Evidence-based recommendations
- Follow-up scheduling
- Progress monitoring metrics
- Real-time risk visualization
- Interactive timeline charts
- Batch processing capabilities
- PDF report generation
- Ensemble Models: scikit-learn, XGBoost
- Explainability: SHAP
- Temporal Modeling: Custom projection with bootstrap uncertainty
- LLM: Groq API (Llama 3.1-8b-instant)
- Agent Framework: LangGraph
- Knowledge Retrieval: FAISS + Sentence Transformers
- UI Framework: Streamlit
- Visualization: Plotly
- PDF Generation: ReportLab
- Data Manipulation: pandas, numpy
- Feature Engineering: Custom pipelines
- Model Persistence: joblib
- Python 3.8+
- Git
-
Clone the repository
git clone https://github.com/your-username/HealthGuard-AI.git cd HealthGuard-AI -
Install dependencies
pip install -r requirements.txt
-
Train ensemble models
python ensemble_training.py
-
Build knowledge base index
python rag/build_index.py
-
Run the application
streamlit run healthguard_app.py
For full AI-powered care pathway generation:
export GROQ_API_KEY="your_groq_api_key_here"- Enter patient demographics and clinical measurements
- Click "Comprehensive Risk Analysis"
- Review multi-disease risk assessment
- Explore temporal projections and intervention scenarios
- Generate personalized care pathway
- Download PDF report
- Navigate to "Batch Processing" tab
- Upload CSV file with patient data
- Click "Analyze Batch"
- Review results and download analysis
- Best Model: Logistic Regression (with class balancing)
- ROC-AUC: 0.826 ± 0.022
- Accuracy: 74.0%
- Features: 8 clinical measurements + engineered categories
- Best Model: Logistic Regression
- ROC-AUC: 0.750 ± 0.060
- Accuracy: 66.7%
- Features: 14 cardiovascular risk factors
- Best Model: Logistic Regression
- ROC-AUC: 1.000 (perfect separation on dataset)
- Accuracy: 100.0%
- Features: 24 renal function markers
HealthGuard-AI/
|
|--- data/ # Dataset files
| |--- diabetes.csv
| |--- heart/
| |--- kidney/
|
|--- models/ # Trained models and artifacts
| |--- *_model.pkl
| |--- *_scaler.pkl
| |--- metrics.json
|
|--- agent/ # LangGraph agent system
| |--- state.py
| |--- nodes.py
| |--- graph.py
|
|--- rag/ # Knowledge retrieval system
| |--- knowledge_base/
| |--- build_index.py
| |--- retriever.py
|
|--- utils/ # Utility functions
| |--- pdf_export.py
|
|--- healthguard_app.py # Main application
|--- ensemble_training.py # Model training pipeline
|--- temporal_projector.py # Risk projection system
|--- explainability.py # Explainability trinity
ensemble = MultiDiseaseEnsemble()
ensemble.train_all_models()
ensemble.save_artifacts()projector = TemporalRiskProjector()
result = projector.project_forward('diabetes', patient_data, 6)explainer = ExplainabilityTrinity()
explanation = explainer.get_comprehensive_explanation('diabetes', patient_data)agent = get_agent()
analysis = agent.analyze_patient(patient_data)- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This system is for educational and informational purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of qualified healthcare providers with any questions you may have regarding a medical condition.
If you use this software in your research, please cite:
@software{healthguard_ai,
title={HealthGuard AI: Multi-Disease Risk Intelligence System},
author={[Your Name]},
year={2024},
url={https://github.com/your-username/HealthGuard-AI}
}- Pima Indians Diabetes Dataset (National Institute of Diabetes and Digestive and Kidney Diseases)
- Cleveland Heart Disease Dataset (UCI Machine Learning Repository)
- Chronic Kidney Disease Dataset (various sources)
- Groq for providing free API access for LLM inference
- Streamlit for the excellent web framework
- Open-source community for the amazing ML and AI tools