@@ -6,7 +6,8 @@ An autonomous AI system that analyzes patient data, estimates health risk, expla
66
77This project combines:
88
9- - A machine learning risk model (` LogisticRegression ` ) for baseline probability estimation
9+ - A machine learning risk model for baseline probability estimation
10+ - A Kaggle-trained production model path using the CDC Diabetes Health Indicators dataset
1011- An orchestrator agent that coordinates specialized agents
1112- LLM-powered explanation and recommendation generation
1213- Retrieval-augmented context from a local medical knowledge base
@@ -33,7 +34,9 @@ Detailed diagram: [`docs/architecture.md`](docs/architecture.md)
3334
3435## Key Features
3536
36- - ** Risk prediction** from patient vitals and demographic inputs
37+ - ** Risk prediction** from patient vitals, demographics, lifestyle, and access inputs
38+ - ** Production training pipeline** for CDC BRFSS diabetes indicators on Kaggle
39+ - ** Persisted model artifact loading** with local CSV fallback for development
3740- ** Internal BMI computation** from height and weight
3841- ** Risk classification** into Low / Medium / High
3942- ** SHAP explainability** to show feature impact on risk
@@ -49,10 +52,12 @@ Detailed diagram: [`docs/architecture.md`](docs/architecture.md)
4952
5053- ** Language** : Python 3.10+
5154- ** ML** : scikit-learn, pandas, shap
55+ - ** Training** : Kaggle, persisted ` joblib ` artifacts, model card + metrics JSON
5256- ** LLM** : OpenAI API
5357- ** Memory/Vector Store** : ChromaDB
5458- ** Backend API** : FastAPI, Uvicorn
5559- ** Frontend** : Streamlit
60+ - ** Deployment** : Docker, AWS App Runner, ECR, Terraform
5661
5762## Project Structure
5863
@@ -63,12 +68,22 @@ healthcare-agent-system/
6368│ ├── explainer.py
6469│ ├── recommender.py
6570│ └── retriever.py
71+ ├── artifacts/
72+ │ └── risk_model.joblib
6673├── api/
6774│ └── app.py
6875├── data/
6976│ ├── patients.csv
7077│ ├── medical_knowledge.jsonl
7178│ └── chroma/
79+ ├── docs/
80+ │ ├── aws_deployment.md
81+ │ └── kaggle_training.md
82+ ├── infra/
83+ │ └── aws/apprunner/
84+ ├── kaggle/
85+ │ ├── kaggle_train.py
86+ │ └── kernel-metadata.json
7287├── memory/
7388│ └── store.py
7489├── models/
@@ -87,11 +102,11 @@ healthcare-agent-system/
87102
88103## How the System Works
89104
90- 1 . User provides patient attributes (` age ` , ` height_cm ` , ` weight_kg ` , ` blood_pressure ` , optional ` glucose ` )
105+ 1 . User provides patient attributes (` age ` , ` height_cm ` , ` weight_kg ` , ` bp ` , optional ` glucose ` , and optional BRFSS-style health indicators )
911062 . System computes BMI internally (` kg / m^2 ` )
921073 . Risk model predicts probability of elevated risk
931084 . Risk classifier maps probability -> ` Low ` / ` Medium ` / ` High `
94- 5 . SHAP computes feature contribution scores
109+ 5 . Feature explainer computes SHAP or local sensitivity contribution scores
951106 . Retrieval agent fetches relevant medical context
961117 . Memory agent retrieves similar historical cases and stores new case
971128 . Explanation and recommendation agents generate human-friendly outputs
@@ -127,10 +142,45 @@ Create a `.env` file (or export directly):
127142
128143``` bash
129144export OPENAI_API_KEY=" your_api_key_here"
145+ export MODEL_ARTIFACT_PATH=" ./artifacts/risk_model.joblib"
130146```
131147
132148> The explanation/recommendation agents require a valid OpenAI key.
133149
150+ If ` MODEL_ARTIFACT_PATH ` points to a trained Kaggle artifact, the app loads it at
151+ startup. If the artifact is missing, the app falls back to ` data/patients.csv ` .
152+
153+ ## Train The Production Model On Kaggle
154+
155+ Training runs on Kaggle against the CDC Diabetes Health Indicators dataset
156+ (` alexteboul/diabetes-health-indicators-dataset ` ). Your machine only uploads the script
157+ and downloads the trained artifact.
158+
159+ ``` bash
160+ chmod +x scripts/kaggle_run.sh
161+ ./scripts/kaggle_run.sh
162+ ```
163+
164+ Kernel: ` aditya2402/healthcare-ai-diabetes-risk-training `
165+ Script: [ ` kaggle/kaggle_train.py ` ] ( kaggle/kaggle_train.py )
166+
167+ See [ ` docs/kaggle_training.md ` ] ( docs/kaggle_training.md ) and [ ` kaggle/README.md ` ] ( kaggle/README.md ) .
168+
169+ ## Deploy To AWS
170+
171+ The API deploys as a Dockerized FastAPI service on AWS App Runner with ECR and Terraform.
172+
173+ ``` bash
174+ cd infra/aws/apprunner
175+ terraform init
176+ terraform apply -target=aws_ecr_repository.api
177+ terraform apply -var " api_token=replace-with-a-strong-token"
178+ ```
179+
180+ After the first targeted apply creates ECR, build and push the Docker image from the
181+ repo root, then run the full apply. See [ ` docs/aws_deployment.md ` ] ( docs/aws_deployment.md ) and
182+ [ ` infra/aws/apprunner/README.md ` ] ( infra/aws/apprunner/README.md ) .
183+
134184## Run the Project
135185
136186### Run CLI demo
@@ -177,7 +227,7 @@ Typical `/predict` response includes:
177227
178228- Risk probability + risk label
179229- Calculated BMI
180- - SHAP feature impacts
230+ - Feature impact scores
181231- Retrieved medical context
182232- Similar past cases
183233- Explanation text
@@ -213,7 +263,7 @@ Each record includes timestamp, request ID, normalized patient summary, risk res
213263 "age" : 45 ,
214264 "height_cm" : 175 ,
215265 "weight_kg" : 78 ,
216- "blood_pressure " : 130 ,
266+ "bp " : 130 ,
217267 "glucose" : 165
218268}
219269```
@@ -227,10 +277,10 @@ Always consult qualified healthcare professionals for real medical advice.
227277
228278## Current Limitations
229279
230- - Model training data is currently small/synthetic
280+ - Kaggle artifact must be trained/downloaded before production deployment
231281- Recommendations are generated by LLM and may require strict clinical guardrails
232282- No full production security/compliance pipeline yet (PHI/HIPAA hardening)
233- - Evaluation and fairness benchmarking should be expanded
283+ - Fairness, calibration, and drift monitoring should be expanded
234284
235285## Roadmap
236286
@@ -244,11 +294,10 @@ Always consult qualified healthcare professionals for real medical advice.
244294
245295### Planned (Phase 3+)
246296
247- - Better datasets and stronger model validation
297+ - Fairness reports, calibration plots, and drift monitoring
248298- Safety guardrails and escalation logic
249299- Automated tests and CI pipeline
250300- Better observability and decision tracing
251- - Containerized deployment (Docker)
252301- Feedback loops for continuous learning
253302
254303### Implemented in Phase 3
@@ -274,6 +323,14 @@ Always consult qualified healthcare professionals for real medical advice.
274323- Added local pre-commit hooks for code quality
275324- Added Dependabot automation for pip and GitHub Actions updates
276325
326+ ### Implemented in Phase 5
327+
328+ - Added Kaggle training workflow for the CDC Diabetes Health Indicators dataset
329+ - Added persisted ` joblib ` artifact loading with local fallback
330+ - Expanded API/UI inputs for BRFSS-style health indicators
331+ - Added production training script with model comparison and metrics output
332+ - Added AWS App Runner Terraform deployment stack
333+
277334## Security Notes
278335
279336See [ ` docs/security.md ` ] ( docs/security.md ) for PII handling guidance, retention policy, and hardening recommendations.
0 commit comments