TransitionRx - 30-Day Readmission Risk (Diabetes Encounters)
Gradient-boosted classifier that ranks diabetes inpatient discharges by risk of a 30-day
readmission, so limited pharmacist and case-manager time can be targeted at the patients most
likely to bounce back.
Intended use
Use: ranking discharges to prioritize pharmacist-led medication reconciliation and
post-discharge follow-up under a fixed staffing capacity.
Not for: clinical diagnosis, treatment decisions, denying care, or any individual-level
determination made without a clinician. The model predicts readmission risk, not
preventability and not responsiveness to intervention.
Data
Cohort construction:
- Expired and hospice discharges removed (disposition IDs 11, 13, 14, 19, 20, 21) - these
patients cannot be readmitted.
- First encounter per patient only - prevents outcome leakage across the train/test split.
- Target:
readmitted == '<30'. Prevalence approximately n/a.
Features
116 features engineered from medication columns, prior utilization, discharge
disposition, and diagnosis groupings. Headline engineered features:
complexity_index - diabetes drug count + 2 x regimen changes
regimen_change_score - dose escalations + de-escalations during the stay
prior_inpatient_band, prior_emergency_band - prior-year utilization
home_no_services, transferred_facility - care-transition quality proxies
Performance (held-out test set)
| Metric | Value |
|---|
| ROC-AUC | 0.6546 |
| PR-AUC | 0.1661 (base rate n/a) |
| Operating threshold | 0.57 |
| Recall at threshold | 0.3795 |
| Precision at threshold | 0.1771 |
ROC-AUC in the mid-0.60s is the realistic ceiling for this dataset and consistent with
published work on it. Administrative billing data contains no vital signs, lab trends, social
determinants, medication adherence, or discharge-summary text. This is a ranking tool for
allocating a scarce resource, not a clinical diagnostic.
Threshold is a business decision
The default 0.5 cutoff is not used. The operating threshold of 0.57 corresponds to
reviewing roughly the top 20% of discharges - a pharmacist capacity constraint,
not a statistical optimum. Re-tune it to your own capacity.
Files
| File | Purpose |
|---|
transitionrx_xgb_model.pkl | Tuned XGBoost classifier (ranking) |
transitionrx_calibrated_model.pkl | Isotonic-calibrated version (probabilities) |
transitionrx_metadata.json | Metrics, params, threshold, assumptions |
transitionrx_feature_columns.csv | Exact feature order required at inference |
Use the calibrated model for anything involving expected cost. scale_pos_weight distorts
raw probabilities upward; they rank well but are not literal probabilities.
Usage
1import joblib, pandas as pd
2from huggingface_hub import hf_hub_download
3
4model = joblib.load(hf_hub_download("erikabear95/transitionrx-readmission-xgboost", "transitionrx_xgb_model.pkl"))
5cols = pd.read_csv(hf_hub_download("erikabear95/transitionrx-readmission-xgboost", "transitionrx_feature_columns.csv"))["feature"]
6
7X_new = X_new.reindex(columns=cols, fill_value=0) # column order must match exactly
8risk = model.predict_proba(X_new)[:, 1]
Limitations
- Data is 1999-2008; coding practice and care patterns have changed.
- No vitals, lab trends, social determinants, adherence, or clinical notes.
- Trained on 130 US hospitals; case mix at your site will differ.
- Subgroup performance across race, age, and payer was not audited. Do this before any
real deployment.
- The intervention-effectiveness assumption used in the value model is drawn from literature,
not measured here. A prospective pilot is required to validate it.