← Back to Projects

MedPredicts: Hospital Readmission Forecasting

Oct 2025 - Nov 2025
Healthcare Analytics / Forecasting / RAG

Project Type

  • Association: University of Missouri-Kansas City
  • Role: Data Scientist / Healthcare ML Developer
  • Dataset: 100K+ diabetic hospital encounter records enriched with weather, PM2.5 air quality, and holiday context
  • Problem Focus: Predicting 30-day readmission risk and translating risk scores into actionable follow-up plans
  • System Layer: XGBoost risk prediction with RAG-powered clinical reasoning using SentenceTransformer, FAISS, and Qwen-32B

Objective

Built a context-aware clinical decision-support system for 30-day hospital readmission forecasting. The system enriches 100K+ diabetic hospital encounter records with weather, PM2.5 air quality, and holiday context, predicts patient readmission risk using XGBoost, assigns follow-up actions by risk tier, and uses a RAG-powered LLM reasoning layer to explain why each patient may be at risk. The project focuses on making readmission prediction more actionable, interpretable, and useful for care coordination and operational planning.

Tools & Technologies

PythonPandasXGBoostData CleaningExploratory AnalysisRAGForecastingClinical Reasoning

Project Details

Problem: Hospital readmission prediction is not only a classification problem. A patient may be flagged as high risk, but hospitals still need to understand why the patient is at risk and what type of follow-up action should happen next. Traditional predictive systems can identify risk, but they often miss the surrounding context that affects recovery, such as poor air quality, severe weather, holidays, delayed follow-ups, or care-access barriers. Goal: This project built a context-aware clinical decision-support system that predicts 30-day hospital readmission risk, explains the risk drivers behind each prediction, and converts model outputs into actionable follow-up recommendations for care teams.

Clinical Dataset: I used the Diabetes 130-US Hospitals dataset, which contains 100K+ diabetic patient hospital encounter records with demographic, admission, diagnosis, medication, lab, and utilization-related fields. Contextual Data: To make the system more realistic, I enriched the clinical dataset with external context such as weather, PM2.5 air quality, and holiday indicators. These features were added because recovery and follow-up access can be affected by real-world conditions outside the hospital. Purpose: This enrichment helped the project move beyond purely clinical prediction and include environmental and operational signals that may influence readmission risk.

Clinical Filtering: I removed unrealistic or misleading cases, including expired or hospice-related patients marked as readmitted, because those records do not represent normal post-discharge readmission behavior. Missing and Unknown Values: I reviewed missing, unknown, and inconsistent categorical values across medical specialty, admission details, diagnosis information, and medication-related fields. Interpretability Focus: Categorical fields were encoded in a clinically interpretable way so the downstream model and explanation layer could support meaningful reasoning rather than only numerical prediction.

Clinical Features: I used patient encounter information, medical specialty, admission details, discharge indicators, diagnosis-related fields, and medication variables to capture clinical risk patterns. Utilization Features: I included prior healthcare utilization signals such as emergency, outpatient, and inpatient visit history because these features can indicate patients with recurring care needs. Diabetes Stability Features: I numerically encoded max_glu_serum and A1Cresult and combined them into a stronger indicator of diabetic instability and readmission risk. Context Features: I added weather, PM2.5 air quality, holiday, and week-based signals to capture external conditions that may affect recovery, follow-up timing, and readmission probability.

Imbalance Problem: The dataset showed imbalance between readmitted and non-readmitted patients, which could make a model over-focus on the majority class. SMOTE Strategy: I applied SMOTE only on the training data to generate realistic minority-class samples and improve the model’s ability to learn readmission-risk patterns. Evaluation Integrity: The test set was kept separate from the oversampling process so model performance would be evaluated on untouched data rather than synthetic test examples.

Models Compared: I tested multiple supervised classification models, including LDA, Logistic Regression, Decision Trees, Random Forest-style tree models, CatBoost, and XGBoost. Selection Criteria: I compared the models based on their ability to balance predictive performance, precision, recall, and practical usefulness for readmission-risk forecasting. Final Model: XGBoost was selected because it provided the best practical balance between precision and recall, helping the system identify high-risk patients while controlling unnecessary false positives.

Risk Probability: After training, the XGBoost model generated a readmission probability for each patient encounter. Risk Tiers: I converted model probabilities into actionable risk categories. Patients with probability greater than or equal to 0.6 were classified as High Risk, patients with probability greater than or equal to 0.3 were classified as Moderate Risk, and patients below 0.3 were classified as Low Risk. Operational Value: This made the model output easier for care teams to use because each risk score was translated into a clear intervention level instead of remaining as a raw probability.

High-Risk Patients: High-risk patients were assigned faster follow-up, typically within 2–5 days, with Doctor call or Home visit recommendations. Moderate-Risk Patients: Moderate-risk patients were assigned Nurse call follow-up so care teams could check recovery status and reduce potential readmission triggers. Low-Risk Patients: Low-risk patients were assigned automated SMS or email follow-up within a longer window, allowing staff effort to be prioritized toward patients with greater risk. Purpose: This connected machine learning prediction with staffing and care coordination decisions.

Why RAG: A readmission-risk score alone does not explain why a patient may be at risk. To make predictions more interpretable, I added a RAG-powered explanation layer. Retrieval System: The system used SentenceTransformer embeddings and FAISS to retrieve relevant clinical and contextual knowledge from a curated knowledge base, including clinical rules and environmental risk factors. LLM Reasoning: Retrieved context was passed to Qwen-32B, which generated a short human-readable explanation describing why the patient may be at risk. Outcome: This transformed the system from a black-box predictor into a more explainable clinical reasoning workflow.

Pipeline Flow: The system starts with clinical and contextual feature preparation, passes the processed data into the XGBoost readmission-risk model, converts predicted probabilities into risk tiers, assigns follow-up methods, retrieves relevant evidence using RAG, and generates an explanation using an LLM. Main Components: The architecture combines structured clinical ML, contextual feature enrichment, risk-tier logic, FAISS-based retrieval, SentenceTransformer embeddings, and Qwen-32B reasoning. Design Goal: The goal was to create a pipeline that supports prediction, explanation, and action rather than only returning a binary readmission label.

Predictive Evaluation: The model was evaluated by comparing multiple classifiers and selecting the model that balanced prediction accuracy with precision and recall. Operational Evaluation: I also evaluated whether the outputs could be translated into useful follow-up actions, such as doctor calls, nurse calls, home visits, or automated messages. Explainability Evaluation: The RAG layer was assessed based on whether it could produce concise, understandable explanations connected to clinical and contextual risk factors.

Outcome: The final system predicts 30-day hospital readmission risk, classifies patients into high, moderate, and low risk tiers, recommends follow-up actions, and explains the reasoning behind each prediction. Impact: The project demonstrates how healthcare ML can become more useful when predictive modeling is combined with contextual intelligence, operational planning, and human-readable reasoning. Key Learning: A strong healthcare AI system should not stop at prediction. It should help users understand the risk, prioritize action, and make the output transparent enough for real decision-support workflows.