Methods
This is a retrospective cohort study where we developed multiple prediction models from patient individual data in EHRs. We follow Transparent Reporting of a multivariable prediction model for Individual Prognosis or Diagnosis (TRIPOD) guidelines [ 11 ].
We used anonymized patient data from patients aged 18 or older who had at least one visit to Hospital da Luz Lisboa (HLL) between 2007 and 2022. It is the largest private hospital in Portugal, located in Lisbon, with 380 beds that provides both inpatient and outpatient care, including a primary care clinic ambulatory and multiple specialized chronic disease clinics managing patients with multimorbidity.
The study was approved by the local Institutional Review Board (ethical approval number by IRB is CES/03/2021/ME). No informed consent was collected because the project entails secondary analysis of anonymous data, extracted by a fully automated processes (no human intervention required).
Clinical data was initially extracted from various systems at HLL records, transformed into the Observational Medical Outcomes Partnership Common Data Model (OMOP) Common Data Model (CDM) version 5.4 [ 12 ], and loaded into an OMOP database instance. In this study we used data from person , visit occurrence , drug exposure , measurement , procedure occurrence and condition occurrence tables of the OMOP CDM.
Preliminary data quality assessment was performed, followed by a data cleaning step with removal of all patients who had incomplete data such as missing patient identifier or implausible age, as well as temporal inconsistencies. The cleaned dataset was then randomly allocated into training (70%), validation (15%), and test (15%) sets at the patient level to ensure temporal independence. Subsequently, patients with only a single visit were excluded from each split. Two cohorts were derived from the resulting dataset: Cohort 1 included all patients with at least two visits ( n = 650,486) for predicting emergency department visits, hospital admissions, and unplanned admissions. Cohort 2 consisted of a subset of Cohort 1 patients who had at least one prior hospital admission ( n = 147,068), enabling prediction of hospital readmissions. The same train-validation-test split was maintained across both cohorts (Fig. 2 ). Fig. 2 Flow diagram showing participant selection for model development and validation. The OMOP CDM dataset from Hospital da Luz Lisboa (2007–2022) containing 1,200,910 patients underwent data cleaning to remove non-adults and patients with incomplete data. The cleaned dataset was randomly allocated into training (70%), validation (15%), and test (15%) sets at the patient level. Patients with only a single visit were subsequently excluded from each split. Two cohorts were derived: Cohort 1 ( n = 650,486) included all patients with at least two visits for predicting emergency department visits, hospital admissions, and unplanned admissions. Cohort 2 ( n = 147,068) was a subset of Cohort 1 restricted to patients with at least one prior hospital admission, enabling prediction of hospital readmissions. Prediction instances excluded the final visit per patient to prevent right-censoring bias
Flow diagram showing participant selection for model development and validation. The OMOP CDM dataset from Hospital da Luz Lisboa (2007–2022) containing 1,200,910 patients underwent data cleaning to remove non-adults and patients with incomplete data. The cleaned dataset was randomly allocated into training (70%), validation (15%), and test (15%) sets at the patient level. Patients with only a single visit were subsequently excluded from each split. Two cohorts were derived: Cohort 1 ( n = 650,486) included all patients with at least two visits for predicting emergency department visits, hospital admissions, and unplanned admissions. Cohort 2 ( n = 147,068) was a subset of Cohort 1 restricted to patients with at least one prior hospital admission, enabling prediction of hospital readmissions. Prediction instances excluded the final visit per patient to prevent right-censoring bias
After data cleaning, we developed custom Python scripts to create a dataframe with one row per patient visit. The dataframe includes attributes such as visit type, visit duration, age at the visit, gender, number of prior visits, number of previously prescribed medications and comorbidity data.
In this work we predict four mutually exclusive hospital visit types, each at four future time windows (30, 90, 180 and 365 days): Emergency-department (ED) visit : any encounter recorded in the ED. Hospital admission : an inpatient stay of \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\ge$$\end{document} 24 h in any ward (ED time excluded). Unplanned admission : an inpatient stay of \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\ge$$\end{document} 24 h that follows an ED visit in the next 48 h. Hospital readmission : a new inpatient stay of \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\ge$$\end{document} 24 h that starts within the chosen prediction window after discharge.
Emergency-department (ED) visit : any encounter recorded in the ED.
Hospital admission : an inpatient stay of \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\ge$$\end{document} 24 h in any ward (ED time excluded).
Unplanned admission : an inpatient stay of \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\ge$$\end{document} 24 h that follows an ED visit in the next 48 h.
Hospital readmission : a new inpatient stay of \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\ge$$\end{document} 24 h that starts within the chosen prediction window after discharge.
We built three feature blocks at each index-visit, that are used as predictors for each outcome-time window. An index-visit was any ambulatory, ED or inpatient visit the patient experienced at the hospital, that was not the last one (i.e. the last visit was systematically excluded, including patients with single visits). A diagram of the feature and outcome assessment process is depicted in Fig. 3 . Feature blocks included: Demographics : gender and age (years) at that visit. Healthcare utilisation (history up to the index visit): total number of previous outpatient visits total number of previous ED visits up to the index visit (not used for future ED prediction). total number of drugs dispensed in outpatient setting, in the past 365 days before index visit. Number of unique drugs dispensed in outpatient setting, in the past 365 days before index visit. Multimorbidity : raw disease count plus four weighted indices: Charlson Comorbidity Index (ChCI) [ 13 ], Elixhauser Index (EI) [ 14 ], Multimorbidity Weighted Index (MWI) [ 15 ], and RxRisk [ 7 ]. Multimorbidity indexes are calculated including all previous chronic disease documentation, including data recorded during the index visit. Fig. 3 Temporal alignment of input features and prediction windows. Healthcare-utilisation variables include utilization (e.g., prior outpatient and ed visits) that use the entire historical record before the index visit and drug features that refer to the 365-day window before index visit. Multimorbidity indices include chronic conditions documented up to–and including–the index stay; Outcomes are forecast from the index visit date or discharge date (in the case of multi-day admissions) across four horizons (30, 90, 180, 365 days)
Demographics : gender and age (years) at that visit.
Healthcare utilisation (history up to the index visit): total number of previous outpatient visits total number of previous ED visits up to the index visit (not used for future ED prediction). total number of drugs dispensed in outpatient setting, in the past 365 days before index visit. Number of unique drugs dispensed in outpatient setting, in the past 365 days before index visit.
total number of previous outpatient visits
total number of previous ED visits up to the index visit (not used for future ED prediction).
total number of drugs dispensed in outpatient setting, in the past 365 days before index visit.
Number of unique drugs dispensed in outpatient setting, in the past 365 days before index visit.
Multimorbidity : raw disease count plus four weighted indices: Charlson Comorbidity Index (ChCI) [ 13 ], Elixhauser Index (EI) [ 14 ], Multimorbidity Weighted Index (MWI) [ 15 ], and RxRisk [ 7 ]. Multimorbidity indexes are calculated including all previous chronic disease documentation, including data recorded during the index visit.
Temporal alignment of input features and prediction windows. Healthcare-utilisation variables include utilization (e.g., prior outpatient and ed visits) that use the entire historical record before the index visit and drug features that refer to the 365-day window before index visit. Multimorbidity indices include chronic conditions documented up to–and including–the index stay; Outcomes are forecast from the index visit date or discharge date (in the case of multi-day admissions) across four horizons (30, 90, 180, 365 days)
We chose these features based on previous literature and assuming they all capture dimensions of care engagement, care needs and treatment complexity [ 16 ]. At each patient visit, we calculate all these features, creating multiple prediction opportunities across different future time horizons (Fig. 3 ). This approach mirrors how clinicians actually make decisions with the information available at each point in time. For instance, when predicting a patient’s 30-day unplanned readmission risk during an outpatient appointment, our model uses their complete medical history up to that moment: all prior healthcare utilization, known chronic conditions, and prescriptions from the past year. When the patient returns for their next visit, the model automatically updates all features with any new information about demographics, medications, hospital care, and comorbidities, generating fresh risk predictions based on this updated clinical picture.
Missing data was handled as follows: age and gender showed no missing values in our cleaned cohort (i.e. records with missing data were removed between original dataset and Cleaned Dataset - see Fig. 2 ). All conditions, procedures, measurements, and drug prescriptions codes were treated as binary attributes. Hence, chronic condition phenotyping consisted of binary indicators (1 if evidence exists, 0 if no evidence found). This design treats absence of medical records as absence of the condition rather than missing data. Healthcare utilization features (i.e. prior number emergency visits and outpatient visits, and drug prescriptions) are aggregated counts over predefined look back windows, which naturally produce zero values rather than missing entries when no events occurred. All features were used for all visit predictions in all time windows. We excluded previous ED visit counts only from future ED visit prediction, in order to avoid circularity bias.
We explored three distinct chronic condition phenotyping methods to capture chronic conditions at the end of each visit: Rule-based Clinical Phenotyping Dictionary: We employed a previously developed and validated dictionary of 55 clinically relevant chronic conditions, incorporating mappings from conditions, procedures, medications, and clinical measurements codes [ 17 ]. This comprehensive phenotyping approach ensures capture of conditions through multiple evidence sources other than condition codes, such as specific laboratory measurement values or condition-specific procedures. The full dictionary rules are referred in Appendix B . Clinical Classification Software Refined (CCSR)-based Chronic Condition Mapping: We implemented a systematic mapping from all condition codes to the Clinical Classifications Software Refined (CCSR) categories using CCSR for ICD-10-CM version 2025.1 [ 18 ]. The AHRQ Chronic Condition Indicator tool for ICD-10-CM version 2025.1 was then applied to identify 274 chronic conditions within these categories, providing a standardized approach to chronic disease identification [ 19 ]. Drug-based Condition Mapping: We utilized a published mapping from Anatomical Therapeutic Chemical (ATC) codes to 46 RxRisk comorbidity categories, allowing inference of chronic conditions through prescription patterns [ 7 ].
Rule-based Clinical Phenotyping Dictionary: We employed a previously developed and validated dictionary of 55 clinically relevant chronic conditions, incorporating mappings from conditions, procedures, medications, and clinical measurements codes [ 17 ]. This comprehensive phenotyping approach ensures capture of conditions through multiple evidence sources other than condition codes, such as specific laboratory measurement values or condition-specific procedures. The full dictionary rules are referred in Appendix B .
Clinical Classification Software Refined (CCSR)-based Chronic Condition Mapping: We implemented a systematic mapping from all condition codes to the Clinical Classifications Software Refined (CCSR) categories using CCSR for ICD-10-CM version 2025.1 [ 18 ]. The AHRQ Chronic Condition Indicator tool for ICD-10-CM version 2025.1 was then applied to identify 274 chronic conditions within these categories, providing a standardized approach to chronic disease identification [ 19 ].
Drug-based Condition Mapping: We utilized a published mapping from Anatomical Therapeutic Chemical (ATC) codes to 46 RxRisk comorbidity categories, allowing inference of chronic conditions through prescription patterns [ 7 ].
After applying the 3 above methods to identify different sets of chronic conditions, we computed the five aforementioned multimorbidity indexes (ChCI, EI, MWI, RxRisk and disease counts) with each of the phenotyping methods, therefore generating 15 different features for multimorbidity. The encoding rules, weight assignments, and condition matching process – including acknowledgment of partial completeness where exact matches were not possible – are provided in the Supplementary Material (Appendix B , C and D ).
Analysis was performed at visit level, where each healthcare encounter was treated as an independent observation with three feature sets: demographics, healthcare utilization, and multimorbidity, as previously defined. Data were split at the patient level to prevent information leakage, ensuring that all visits from the same patient were kept together within the same data partition. Therefore, we partitioned the data into 70% for training, 15% for hyperparameter tuning and 15% for testing by patient. Post-hoc analysis confirmed good balance of features and outcomes across splits (Table ??). We defined four prediction horizons (30, 90, 180, and 365 days) so that for each outcome and time window, three model configurations could be evaluated: Demographics only, Demographics + Multimrobidity, Demographics + Healthcare utilization and Demographics + Healthcare utilization + Multimorbidity (All features). We first trained Logistic Regression (LR) for Demographics+Multimorbidity using all phenotyping combinations in all outcomes. We then chose the best phenotyping strategy per outcome-time window for further modeling. We trained LR independently to assess performance of Demographics only, Demographics+Multimorbidity, Demographics+Healthcare utilization and the three feature sets combined (all features). Additionally, we developed XGBoost, using all features only, to further validate our findings.
For LR models an L2-penalized LR with balanced class weights was applied using scikit-learn [ 20 ]. We used validation set to test regularization strength parameters (C values of 0.1, 1.0, and 10) with a fixed maximum iteration value of 200, optimizing for Area Under the receiver Operating Characteristic curve (AUROC). Final models were trained on the complete training dataset using the best hyperparameters. We implemented stratified bootstrap sampling with 500 iterations, maintaining class proportions in each bootstrap sample to ensure stable estimates for imbalanced datasets. For each bootstrap iteration, we sampled with replacement from each class proportionally, then shuffled the combined indices before calculating performance metrics. Confidence intervals (CI) were computed using the percentile method (2.5th and 97.5th percentiles). This approach was applied to all AUROC and AUPRC metrics on the test set to quantify uncertainty in model performance estimates. For XGBoost we used a gradient boosting framework implemented in the XGBoost library [ 21 ]. We used validation set to select the best hyperparameter combination among learning rates (0.01, 0.1, 0.3), maximum tree depths (3, 5, 7), number of estimators (100, 200, 300), subsample ratios (0.8, 1.0), column sampling per tree (0.8, 1.0), and minimum child weights (1, 3). To address class imbalance, we calculated and applied the scale_pos_weight parameter based on the ratio of negative to positive examples in the training data. All XGBoost models used the binary logistic objective function with AUROC as the evaluation metric.
Since repeated visits from a single individual can induce intra-cluster correlation that can inflate apparent model performance, we therefore executed two complementary sensitivity analyses: 1) We trained inverse-frequency weighting models to down-weight patients with many visits, where each encounter received a weight equal to \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$1/n_i$$\end{document} , where \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$n_i$$\end{document} is that patient’s total visit count in the test set (Table ?? 2) We performed a patient-level modeling of all outcomes using a random patient visit as input, therefore eliminating within-patient correlation ( \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$n$$\end{document} visits = \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$n$$\end{document} patients), using the same logistic regression parameters and evaluation metrics as the main analysis (Table ??).
Performance was evaluated using multiple metrics on the test set: discrimination via AUROC and Area Under Precision-Recall Curve (AUPRC), calibration accuracy via Expected Calibration Error (ECE), and overall performance via Brier score [ 22 ]. In addition, for each model, we determined the optimal decision threshold that maximized F1-score validation data and used it to evaluate classification metrics (precision, recall, specificity, and NPV) on test set. For feature importance analyses we evaluated LR weights and for XGBoost we evaluated SHAP values using the shap package [ 23 ]. All data handling and transformation tasks were performed in Python using pandas
1 and polars
2 , while model development and evaluation were conducted with scikit-learn [ 20 ] and xgboost [ 21 ] packages.
Results
The study population comprised 925,508 patients with 9,714,508 visits. Patients had a mean age of 49.3 years (SD 18.0), with female predominance (61.4%). Tables 1 and 2 detail the patient characteristics of the overall population, and the outcome prevalence across the two cohorts analyzed. Table 1 Baseline characteristics and healthcare utilization patterns across study cohorts Characteristic All patients Cohort 1 Cohort 2 ( n = 925,508) ( n = 650,486) ( n = 147,068) Demographics Number of visits, n 9,714,635 9,439,613 4,777,431 Age, mean (SD) 49.3 (18.0) 49.5 (18.0) 54.9 (18.0) Female, n (%) 570,104 (61.4%) 399,727 (61.9%) 88,344 (60.1%) Healthcare Utilization H. adm., total, n 358,477 286,722 286,722 H. adm., median (IQR) 0.00 (0.00–1.00) 0.00 (0.00–1.00) 0.00 (0.00–1.00) Unpl. adm, total, n 24,748 19,693 19,693 Unpl. adm., median (IQR) 0.00 (0.00–0.00) 0.00 (0.00–0.00) 0.00 (0.00–0.00) ED visits, total, n 1,038,723 802,471 331,265 ED visits, median (IQR) 1.00 (0.00–2.00) 1.00 (0.00–2.00) 0.00 (0.00–2.00) Outpatient visits, total, n 9,661,228 7,699,934 4,012,376 Outpatient visits, median (IQR) 6.00 (2.00–17.00) 8.00 (3.00–21.00) 8.00 (3.00–20.00) N days in hospital, total, n 10,209,795 9,877,556 8,579,166 N days in hospital, (mean (SD)) 11.0 (60.4) 15.2 (71.0) 58.3 (139.3) Medications Total medications, total, n 740,460 640,316 192,501 Total medications, (mean (SD)) 0.8 (2.2) 1.0 (2.5) 1.3 (3.4) Unique medications, total, n 614,689 521,657 149,939 Unique medications, (mean (SD)) 0.7 (1.6) 0.8 (1.8) 1.0 (2.3) Multimorbidity Dictionary-based conditions Total conditions, n 544,934 522,383 264,562 0 conditions, n (%) 649,028 (70.1%) 394,377 (60.6%) 49,302 (33.5%) 1 condition, n (%) 160,644 (17.4%) 142,088 (21.8%) 38,395 (26.1%) 2+ conditions, n (%) 115,836 (12.5%) 114,021 (17.5%) 59,371 (40.4%) CCSR conditions Total conditions, n 239,968 228,805 117,094 0 conditions, n (%) 766,944 (82.9%) 502,520 (77.3%) 82,949 (56.4%) 1 condition, n (%) 112,985 (12.2%) 102,838 (15.8%) 37,968 (25.8%) 2+ conditions, n (%) 45,579 (4.9%) 45,128 (6.9%) 26,151 (17.8%) RxDrug-based conditions Total conditions, n 280,031 271,953 126,230 0 conditions, n (%) 779,544 (84.2%) 511,237 (78.6%) 94,443 (64.2%) 1 condition, n (%) 83,176 (9.0%) 77,589 (11.9%) 23,824 (16.2%) 2+ conditions, n (%) 62,788 (6.8%) 61,660 (9.5%) 28,801 (19.6%) Notes: All patients represents the initial cohort. Cohort 1 refers to patients used for development and assessment of any patient, ED visit, any hospital admission or unplanned hospital admissions. Cohort 2 refers to patients used for development and assessment of hospital readmission Table 2 Outcome prevalence at 30, 90, 180 and 365 days by cohort Outcome (time window) Cohort 1 Cohort 2 n of events (%) n of events (%) 30-day outcomes ED visit 510,807 (5.83%) – Any hospital admission 729,327 (8.32%) – Unplanned hospital admission 41,448 (0.47%) – Hospital readmission – 69,332 (24.18%) 90-day outcomes ED visit 995,890 (11.36%) – Any hospital admission 1,121,163 (12.79%) – Unplanned hospital admission 71,999 (0.82%) – Hospital readmission – 87,501 (30.52%) 180-day outcomes ED visit 1,509,896 (17.22%) – Any hospital admission 1,403,176 (16.01%) – Unplanned hospital admission 104,817 (1.20%) – Hospital readmission – 95,202 (33.20%) 365-day outcomes ED visit 2,203,508 (25.13%) – Any hospital admission 1,711,393 (19.52%) – Unplanned hospital admission 148,254 (1.69%) – Hospital readmission – 104,844 (36.57%) Notes: Cohort 1 percentages are calculated based on 8,766,908 visit-level predictions. Cohort 2 percentages are calculated based on 286,722 hospital admissions
Baseline characteristics and healthcare utilization patterns across study cohorts
Notes: All patients represents the initial cohort. Cohort 1 refers to patients used for development and assessment of any patient, ED visit, any hospital admission or unplanned hospital admissions. Cohort 2 refers to patients used for development and assessment of hospital readmission
Outcome prevalence at 30, 90, 180 and 365 days by cohort
Notes: Cohort 1 percentages are calculated based on 8,766,908 visit-level predictions. Cohort 2 percentages are calculated based on 286,722 hospital admissions
Multimorbidity burden varied by phenotyping strategy: the rules-based dictionary identified 29.9% of patients with \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\geq$$\end{document} 1 chronic condition and 12.5% with \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\geq$$\end{document} 2 (average: 0.59 conditions/patient), while CCSR and medication-based approaches identified 17.1% and 15.8% of patients with \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\geq$$\end{document} 1 condition, respectively. Although the prevalence of chronic conditions increases with age across all strategies, the phenotyping approaches vary among different age groups, as shown in Fig. 4 . Between ages 20 and 65, drugs phenotyping strategy identifies more patients with chronic conditions. However, after 65 years-old, the phenotyping dictionary detects a higher number of chronic conditions, with the difference becoming more pronounced as age increases. The most common chronic conditions identified by each phenotyping strategy are described in Tables 3 , 4 and 5 . Fig. 4 Prevalence of any chronic condition by phenotyping approaches, across age groups. The figure displays the prevalence across different age groups, according to the three phenotyping methods employed: Rule-based Clinical Phenotyping Dictionary (blue), condition codes with Clinical Classification Software Refined (CCSR) mapping (orange), and drug codes through RxRisk mapping (green). RxRisk phenotyping leads to higher chronic condition identification until approximately age 65, while rule-based dictionary identifies more conditions in patients aged 65 and older Table 3 Top 20 chronic conditions by rules-based dictionary phenotyping Rank Condition Count Prevalence (%) 1 Hyperlipidemia 77,865 8.41 2 Anemia 70,157 7.58 3 Hypertension 29,008 3.13 4 Vertebral Column Disorder 21,660 2.34 5 Thyroid Disorders 20,323 2.20 6 Depression 20,058 2.17 7 Chronic Kidney Disease 19,828 2.14 8 Upper Digestive Disease 19,797 2.14 9 Cancer 19,792 2.14 10 Benign Prostate Hypertrophy 17,853 1.93 11 Coronary Artery Disease 17,683 1.91 12 Heart Failure 17,552 1.90 13 Anxiety Disorder 17,152 1.85 14 Chronic Bowel Disease 15,553 1.68 15 Osteoarthritis 15,009 1.62 16 Diabetes Mellitus 12,062 1.30 17 Peripheral Neuropathy 11,518 1.24 18 Arrhythmias 10,923 1.18 19 Uterine Fibroid 8,728 0.94 20 Urinary Incontinence 8,666 0.94 Notes: Chronic conditions identified through the rules-based dictionary phenotyping approach Table 4 Top 20 chronic conditions by CCSR classification Rank Condition Count Prevalence (%) 1 Other specified joint disorders 19,873 2.15 2 Essential hypertension 19,090 2.06 3 Diseases of veins and lymphatics 13,794 1.49 4 Cataracts and lens disorders 10,460 1.13 5 Thyroid disorders 9,787 1.06 6 Osteoarthritis 8,194 0.89 7 Female genital disorders 8,156 0.88 8 Migraine and headache 7,163 0.77 9 Spondylopathies 6,960 0.75 10 Nutritional/metabolic disorders 6,596 0.71 11 Cardiac dysrhythmias 6,559 0.71 12 Endometriosis 6,202 0.67 13 Asthma 4,810 0.52 14 Lipid metabolism disorders 4,639 0.50 15 Coronary heart disease 4,595 0.50 16 Diabetes with complications 3,932 0.43 17 Breast cancer 3,931 0.42 18 Neurocognitive disorders 3,756 0.41 19 Sleep-wake disorders 3,487 0.38 20 Acquired foot deformities 3,327 0.36 Notes: Chronic conditions identified with condition codes mapped using Clinical Classifications Software Refined (CCSR) Table 5 Top 20 chronic conditions by drug-based RxRisk mapping Rank Condition (Medication Category) Count Prevalence (%) 1 Inflammation and Pain 39,576 4.28 2 Allergies 30,291 3.27 3 Gastroesophageal Reflux Disease 22,560 2.44 4 Chronic Airways Disease 17,804 1.92 5 Depression 16,437 1.78 6 Steroid-Responsive Disease 15,591 1.69 7 Anxiety 15,392 1.66 8 Hyperlipidemia 15,229 1.65 9 Ischemic Heart Disease 12,465 1.35 10 Antiplatelet Agents 10,447 1.13 11 Anticoagulants 9,705 1.05 12 Hypertension 9,633 1.04 13 Hypothyroidism 9,548 1.03 14 Congestive Heart Failure 8,636 0.93 15 Benign Prostatic Hyperplasia 7,973 0.86 16 Incontinence 6,363 0.69 17 Pancreatic Insufficiency 5,719 0.62 18 Pain 3,848 0.42 19 Irritable Bowel Syndrome 3,328 0.36 20 Gout 3,056 0.33 Notes: Chronic conditions identified with drug codes mapped using RxRisk drug-to-condition mapping
Prevalence of any chronic condition by phenotyping approaches, across age groups. The figure displays the prevalence across different age groups, according to the three phenotyping methods employed: Rule-based Clinical Phenotyping Dictionary (blue), condition codes with Clinical Classification Software Refined (CCSR) mapping (orange), and drug codes through RxRisk mapping (green). RxRisk phenotyping leads to higher chronic condition identification until approximately age 65, while rule-based dictionary identifies more conditions in patients aged 65 and older
Top 20 chronic conditions by rules-based dictionary phenotyping
Notes: Chronic conditions identified through the rules-based dictionary phenotyping approach
Top 20 chronic conditions by CCSR classification
Notes: Chronic conditions identified with condition codes mapped using Clinical Classifications Software Refined (CCSR)
Top 20 chronic conditions by drug-based RxRisk mapping
Notes: Chronic conditions identified with drug codes mapped using RxRisk drug-to-condition mapping
To understand the relevance of different phenotyping approaches on multimorbidity measurement, we compared the three phenotyping strategies for computing different comorbidity indices (ChCI, EI, MWI, RxRisk and disease counts). We trained logistic regression LR models to predict four outcomes-ED visits, hospital admissions, unplanned hospital admissions, and readmissions–across different time windows. Each model used only basic demographic variables (age and gender) plus one of 15 possible combinations of phenotyping methods and comorbidity indices as predictors. Results of the best-performing phenotyping strategy and comorbidity index combinations are presented in Table 6 . Dictionary-based phenotyping consistently outperformed the other phenotyping approaches across all outcomes and time windows. Among the comorbidity indices evaluated MWI yielded the highest AUROC for all ED visit models. For unplanned hospital admissions MWI again ranked first at every horizon, reaching statistical superiority at 180 and 365 days (AUROC gain 0.03), while its advantage at 30 and 90 days was not significant. ChCI achieved the highest AUROC for hospital admission, with clear advantage in the 30-day model (0.613 [0.612–0.615] vs. 0.604 [0.602–0.605] for MWI), while for larger time windows difference was non-significant. The ChCI showed superior discriminative performance for 30-day hospital readmissions, while the MWI exhibited marginally higher performance at extended follow-up periods. However, confidence intervals for both indices overlapped across all time horizons. Unweighted disease-count models demonstrated AUROC performance within approximately 0.015–0.025 of the optimal weighted index for both all and unplanned hospital admissions, and within approximately 0.01 for ED visits. Detailed performance metrics for each phenotyping method and comorbidity index combination across all outcomes are provided in Appendix E . Table 6 Best phenotyping and comorbidity index combinations by outcome and Time window Outcome Time Window Phenotyping Comorbidity Index AUROC (95% CI) ED Visit 30 days Dictionary MWI 0.6122 (0.6103–0.6142) 90 days Dictionary MWI 0.6131 (0.6073–0.6203) 180 days Dictionary MWI 0.6263 (0.6214–0.6320) 365 days Dictionary MWI 0.6274 (0.6229–0.6324) Hospital Admission 30 days Dictionary ChCI 0.6134 (0.6116–0.6151) 90 days Dictionary ChCI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.6170 (0.6110–0.6230) 180 days Dictionary ChCI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.6160 (0.6106–0.6214) 365 days Dictionary ChCI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.6192 (0.6144–0.6245) Unplanned Hospital Admission 30 days Dictionary MWI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.6489 (0.6424–0.6557) 90 days Dictionary MWI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.6943 (0.6716–0.7175) 180 days Dictionary MWI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.7283 (0.7119–0.7465) 365 days Dictionary MWI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.7387 (0.7249–0.7524) Hospital Readmission 30 days Dictionary ChCI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.7342 (0.7122–0.7577) 90 days Dictionary MWI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.7611 (0.7415–0.7812) 180 days Dictionary MWI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.7695 (0.7484–0.7888) 365 days Dictionary MWI \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$^{\dagger}$$\end{document} 0.7700 (0.7483–0.7893) Note: Results represent models trained using age, gender, and the specific phenotyping–comorbidity index strategyfor each outcome. Dictionary refers to Dictionary-based phenotyping method. MWI - Multimorbidity Weighted Index. ChCI - Charlson Comorbidity Index. Performance measured by Area Under the Receiver Operating Characteristic Curve (AUROC) with 95% confidence intervals. Full results are available in Appendix E. Superscript † indicates the 95% confidence interval of the reported combination overlaps at least one competing combination (i.e., statistical tie).
Best phenotyping and comorbidity index combinations by outcome and Time window
Note: Results represent models trained using age, gender, and the specific phenotyping–comorbidity index strategyfor each outcome. Dictionary refers to Dictionary-based phenotyping method. MWI - Multimorbidity Weighted Index. ChCI - Charlson Comorbidity Index. Performance measured by Area Under the Receiver Operating Characteristic Curve (AUROC) with 95% confidence intervals. Full results are available in Appendix E. Superscript † indicates the 95% confidence interval of the reported combination overlaps at least one competing combination (i.e., statistical tie).
To understand the practical impact of measuring multimorbidity for outcome prediction, we trained different models using combinations of demographics, prior healthcare and drug use, and multimorbidity. Table 7 summarizes the best-performing LR models for each outcome, and Tables ??, ??, ??, and ?? present the comparative performance of models across the four evaluated feature sets in all outcomes. Figure 5 shows the incremental AUROC inprovements achieved through systematic feature enhancement across all clinical prediction tasks. Table 7 Best-performing logistic regression models for predicting hospital visits across various time horizons. All models were trained using the full feature set, including demographics, healthcare utilization, and the optimal phenotyping and comorbidity index approach: ChCI was used for hospital admissions at all time windows and for 30-day readmissions, while MWI was used for all other outcomes Outcome AUROC (95% CI) AUPRC (95% CI) F1 Recall Precision NPV Specificity Prevalence (%) ED Visit 30-Day 0.632 (0.630–0.634) 0.092 (0.091–0.093) 0.155 0.313 0.103 0.953 0.835 5.83 90-Day 0.636 (0.635–0.637) 0.177 (0.176–0.178) 0.258 0.544 0.169 0.920 0.663 11.36 180-Day 0.637 (0.635–0.638) 0.259 (0.258–0.260) 0.342 0.541 0.250 0.876 0.666 17.22 365-Day 0.639 (0.638–0.640) 0.364 (0.363–0.365) 0.434 0.738 0.308 0.837 0.449 25.13 Hospital Admission 30-Day 0.623 (0.621–0.625) 0.141 (0.140–0.142) 0.217 0.289 0.173 0.932 0.876 8.32 90-Day 0.610 (0.609–0.612) 0.201 (0.200–0.202) 0.256 0.390 0.190 0.894 0.755 12.79 180-Day 0.603 (0.602–0.604) 0.241 (0.240–0.243) 0.298 0.765 0.185 0.886 0.356 16.01 365-Day 0.603 (0.602–0.604) 0.288 (0.286–0.289) 0.347 0.765 0.224 0.861 0.354 19.52 Unplanned ED Visit 30-Day 0.683 (0.676–0.689) 0.012 (0.011–0.012) 0.036 0.097 0.022 0.996 0.980 0.47 90-Day 0.694 (0.689–0.698) 0.022 (0.021–0.023) 0.063 0.087 0.049 0.992 0.986 0.82 180-Day 0.696 (0.692–0.699) 0.034 (0.033–0.036) 0.082 0.127 0.061 0.989 0.976 1.20 365-Day 0.699 (0.696–0.703) 0.053 (0.052–0.055) 0.116 0.154 0.093 0.985 0.974 1.69 Readmission 30-Day 0.770 (0.765–0.775) 0.484 (0.475–0.493) 0.534 0.628 0.465 0.868 0.772 24.18 90-Day 0.777 (0.773–0.782) 0.589 (0.581–0.597) 0.599 0.732 0.507 0.853 0.685 30.52 180-Day 0.776 (0.772–0.780) 0.621 (0.614–0.629) 0.621 0.734 0.539 0.837 0.685 33.20 365-Day 0.771 (0.766–0.778) 0.655 (0.648–0.662) 0.639 0.802 0.531 0.835 0.587 36.57 All metrics are reported on the test set. NPV = Negative Predictive Value; AUROC = Area Under Receiver Operating Characteristic curve; AUPRC = Area Under Precision-Recall Curve. Readmission outcomes are calculated from 286,722 readmission-eligible patients, while other outcomes include all 8,766,908 patients in the cohort Fig. 5 Incremental AUROC Performance Gains Across Feature Sets and Predicted Outcomes. Stacked bar chart showing progressive AUROC improvements from stepwise feature augmentation across four clinical prediction tasks (30–365 day horizons). Segments represent incremental contributions: demographics baseline (blue), multimorbidity addition using either Multimorbidity Weighted Index (MWI, dark purple stripes) or Charlson Comorbidity index (ChCI, dark purple dots), healthcare utilization enhancement (light purple), and their combined effect (green). Values indicate final AUROC performance using the full feature set. Readmission prediction achieved the highest absolute AUROC (0.770–0.777), while unplanned admissions showed the largest relative improvement (from 0.494–0.586 to 0.683–0.699). Multimorbidity features–derived from the best-performing index per task (MWI or ChCI)–consistently improved performance over demographics alone, with healthcare utilization providing complementary predictive value. The consistent combined effect (green segments) underscores that integrating both feature types yields optimal predictive performance beyond individual contributions
Best-performing logistic regression models for predicting hospital visits across various time horizons. All models were trained using the full feature set, including demographics, healthcare utilization, and the optimal phenotyping and comorbidity index approach: ChCI was used for hospital admissions at all time windows and for 30-day readmissions, while MWI was used for all other outcomes
All metrics are reported on the test set. NPV = Negative Predictive Value; AUROC = Area Under Receiver Operating Characteristic curve; AUPRC = Area Under Precision-Recall Curve. Readmission outcomes are calculated from 286,722 readmission-eligible patients, while other outcomes include all 8,766,908 patients in the cohort
Incremental AUROC Performance Gains Across Feature Sets and Predicted Outcomes. Stacked bar chart showing progressive AUROC improvements from stepwise feature augmentation across four clinical prediction tasks (30–365 day horizons). Segments represent incremental contributions: demographics baseline (blue), multimorbidity addition using either Multimorbidity Weighted Index (MWI, dark purple stripes) or Charlson Comorbidity index (ChCI, dark purple dots), healthcare utilization enhancement (light purple), and their combined effect (green). Values indicate final AUROC performance using the full feature set. Readmission prediction achieved the highest absolute AUROC (0.770–0.777), while unplanned admissions showed the largest relative improvement (from 0.494–0.586 to 0.683–0.699). Multimorbidity features–derived from the best-performing index per task (MWI or ChCI)–consistently improved performance over demographics alone, with healthcare utilization providing complementary predictive value. The consistent combined effect (green segments) underscores that integrating both feature types yields optimal predictive performance beyond individual contributions
Multimorbidity provided consistent improvements over demographics alone across all clinical outcomes (AUROC gains ranging from 0.024–0.150). The most pronounced benefits appeared in unplanned admission predictions (AUROC improvements of 0.082–0.150) and hospital readmissions (AUROC gains of 0.064–0.072), while ED visit and hospital admission predictions showed more moderate but still consistent improvements (AUROC gains of 0.024–0.063).
Adding healthcare utilization features to demographics also led to increased discriminative performance, often exceeding the gains from multimorbidity alone. Healthcare utilization demonstrated particular strength in readmission prediction (AUROC 0.750–0.769 vs. 0.744–0.757 for multimorbidity) and ED visit prediction, especially at longer time horizons. However, for unplanned admissions, multimorbidity features showed superior performance, particularly at 180–365 day prediction windows.
The combination of all features consistently achieved optimal performance across all outcomes, with AUROC improvements of 0.010–0.035 beyond the best individual feature enhancement. This additive benefit indicates that multimorbidity and healthcare utilization capture complementary aspects of patient risk–with multimorbidity reflecting underlying disease complexity and healthcare utilization representing care-seeking behavior and system engagement patterns.
Models demonstrated variable calibration across outcomes. Readmission prediction showed reasonable calibration (ECE: 0.103–0.207, Brier: 0.192–0.195), while unplanned admission models exhibited poor calibration (ECE: 0.424–0.456, Brier: 0.209–0.225), and ED visit/hospital admission predictions showed intermediate performance (ECE: 0.237–0.424, Brier: 0.235–0.239). The poor calibration for unplanned admissions likely reflects the challenge of probability estimation for rare events, as evidenced by the very low precision values (0.049–0.116). This highlights the inherent difficulty of producing well-calibrated probability estimates for rare clinical outcomes, even when models achieve reasonable discrimination performance.
To validate our findings and explore potential nonlinear relationships, we trained gradient boosting models (XGBoost) as a complementary approach to logistic regression (LR), using each outcome’s best LR-derived feature set. As shown in Table 8 and Fig. 6 , XGBoost outperformed LR across every outcome-horizon combination, though the size of that gain varied systematically. Table 8 Comparison of logistic regression (LR) and XGBoost (XGB) performance metrics with 95% confidence intervals and improvement deltas across healthcare outcomes and prediction time windows Outcome Time (Prev.) Model AUROC [95% CI] \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\Delta$$\end{document} AUROC [95% CI] AUPRC [95% CI] \documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\Delta$$\end{document} AUPRC [95% CI] ED Visit 30d (5.8%) LR 0.632 [0.613, 0.651] 0.092 [0.087, 0.098] XGB 0.681 [0.662, 0.700] +0.049 [0.022, 0.076]* 0.119 [0.113, 0.126] +0.027 [0.018, 0.036]* 90d (11.4%) LR 0.636 [0.617, 0.655] 0.177 [0.169, 0.184] XGB 0.677 [0.658, 0.696] +0.041 [0.014, 0.068]* 0.215 [0.207, 0.223] +0.039 [0.028, 0.050]* 180d (17.2%) LR 0.637 [0.617, 0.656] 0.259 [0.251, 0.268] XGB 0.674 [0.655, 0.693] +0.038 [0.010, 0.065]* 0.304 [0.295, 0.313] +0.045 [0.033, 0.057]* 365d (25.1%) LR 0.639 [0.619, 0.658] 0.364 [0.354, 0.373] XGB 0.671 [0.652, 0.690] +0.033 [0.006, 0.060]* 0.406 [0.397, 0.416] +0.043 [0.029, 0.056]* Hospital Admission 30d (8.3%) LR 0.623 [0.604, 0.642] 0.141 [0.134, 0.148] XGB 0.668 [0.649, 0.687] +0.045 [0.018, 0.073]* 0.166 [0.158, 0.173] +0.024 [0.014, 0.034]* 90d (12.8%) LR 0.610 [0.591, 0.630] 0.201 [0.193, 0.209] XGB 0.663 [0.644, 0.682] +0.053 [0.026, 0.080]* 0.234 [0.226, 0.243] +0.033 [0.022, 0.045]* 180d (16.0%) LR 0.603 [0.583, 0.622] 0.241 [0.233, 0.250] XGB 0.665 [0.646, 0.684] +0.062 [0.035, 0.089]* 0.286 [0.278, 0.295] +0.045 [0.033, 0.057]* 365d (19.5%) LR 0.603 [0.584, 0.623] 0.288 [0.279, 0.297] XGB 0.667 [0.648, 0.686] +0.064 [0.036, 0.091]* 0.337 [0.328, 0.347] +0.050 [0.037, 0.063]* Unplanned admission 30d (0.5%) LR 0.683 [0.681, 0.684] 0.012 [0.012, 0.012] XGB 0.773 [0.772, 0.775] +0.091 [0.088, 0.093]* 0.019 [0.019, 0.019] +0.007 [0.007, 0.007]* 90d (0.8%) LR 0.694 [0.692, 0.695] 0.022 [0.022, 0.023] XGB 0.778 [0.776, 0.779] +0.084 [0.082, 0.086]* 0.038 [0.037, 0.038] +0.015 [0.015, 0.016]* 180d (1.2%) LR 0.696 [0.678, 0.715] 0.034 [0.031, 0.038] XGB 0.780 [0.762, 0.797] +0.084 [0.058, 0.110]* 0.052 [0.048, 0.056] +0.018 [0.012, 0.023]* 365d (1.7%) LR 0.699 [0.681, 0.718] 0.053 [0.049, 0.058] XGB 0.781 [0.763, 0.798] +0.081 [0.056, 0.107]* 0.075 [0.070, 0.080] +0.022 [0.015, 0.029]* Readmission 30d (24.2%) LR 0.770 [0.761, 0.778] 0.484 [0.479, 0.488] XGB 0.798 [0.790, 0.806] +0.029 [0.017, 0.040]* 0.545 [0.540, 0.550] +0.061 [0.055, 0.068]* 90d (30.5%) LR 0.777 [0.769, 0.785] 0.589 [0.584, 0.593] XGB 0.848 [0.840, 0.855] +0.071 [0.060, 0.082]* 0.725 [0.721, 0.729] +0.136 [0.130, 0.143]* 180d (33.2%) LR 0.776 [0.768, 0.784] 0.621 [0.617, 0.626] XGB 0.841 [0.833, 0.848] +0.065 [0.054, 0.076]* 0.742 [0.738, 0.746] +0.121 [0.115, 0.127]* 365d (36.6%) LR 0.771 [0.762, 0.779] 0.655 [0.651, 0.660] XGB 0.828 [0.820, 0.836] +0.058 [0.046, 0.069]* 0.757 [0.753, 0.761] +0.101 [0.095, 0.107]* * Indicates statistically significant difference at p < 0.05 based on 95% confidence intervals that do not include zero Prev. = Prevalence of outcome in the population ΔAUROC = Difference in AUROC between XGBoost and Logistic Regression ΔAUPRC = Difference in AUPRC between XGBoost and Logistic Regression Fig. 6 Stacked bar charts showing AUROC performance for four healthcare outcomes across multiple prediction time windows (30, 90, 180, and 365 days). Red bars represent logistic regression (LR) baseline performance, while blue sections show additional performance gained from XGBoost. Values on top of bars indicate final XGBoost AUROC. XGBoost demonstrates consistent improvements over logistic regression across all outcomes, with the largest gains observed for rare events (Unplanned Admission: +0.082–0.090 AUROC) and moderate improvements for more prevalent outcomes (ed Visit and hospital admission: +0.032–0.064 AUROC; readmission: +0.028–0.071 AUROC). The magnitude of improvement appears inversely related to outcome prevalence, suggesting greater value of non-linear modeling for rare but clinically important events
Comparison of logistic regression (LR) and XGBoost (XGB) performance metrics with 95% confidence intervals and improvement deltas across healthcare outcomes and prediction time windows
* Indicates statistically significant difference at p < 0.05 based on 95% confidence intervals that do not include zero
Prev. = Prevalence of outcome in the population
ΔAUROC = Difference in AUROC between XGBoost and Logistic Regression
ΔAUPRC = Difference in AUPRC between XGBoost and Logistic Regression
Stacked bar charts showing AUROC performance for four healthcare outcomes across multiple prediction time windows (30, 90, 180, and 365 days). Red bars represent logistic regression (LR) baseline performance, while blue sections show additional performance gained from XGBoost. Values on top of bars indicate final XGBoost AUROC. XGBoost demonstrates consistent improvements over logistic regression across all outcomes, with the largest gains observed for rare events (Unplanned Admission: +0.082–0.090 AUROC) and moderate improvements for more prevalent outcomes (ed Visit and hospital admission: +0.032–0.064 AUROC; readmission: +0.028–0.071 AUROC). The magnitude of improvement appears inversely related to outcome prevalence, suggesting greater value of non-linear modeling for rare but clinically important events
The largest absolute AUROC gains were observed for the less prevalence outcomes. For instance, unplanned admissions saw the most significant improvements (+0.082–0.090 AUROC), followed by general hospital admissions. ED visits showed more moderate improvements, with short-term predictions benefiting the most +0.049 for 30 days vs +0.032 for 365 days), suggesting that nonlinear interactions are especially informative for more imminent events. Overall, the rank order of outcome predictability remained unchanged, with readmissions being the best-predicted outcome, followed by unplanned admissions, ED visits, and hospital admissions (Table 8 ). This stability across modeling approaches reinforces that nonlinear models extract additional signal as expected, particularly for low-prevalence events and short prediction horizons, and that predictive performance is fundamentally driven by the information captured in the features used.
Analysis of LR feature importance reveals distinct patterns across outcomes (Table 9 ). Multimorbidity emerges as the strongest predictor across nearly all outcomes and time windows. For ED visits it shows the highest odds ratio (1.31–1.35) and for unplanned admissions it also shows the highest impact (OR 1.48–1.54). For readmissions it remains a dominant predictor (OR 1–30-1.48), although next to age and previous number of outpatient visits. Medication patterns reveal complex relationships: unique drug count is associated with increased risk across outcomes (OR 1.07–1.30), while total drug count shows slight negative association with early ED visit and unplanned visits (OR 0.92–0.96) but positive association with longer-term outcomes. Age shows opposing associations: younger patients have higher likelihood of ED visits (OR 0.81–0.84), while older age is associated with increased risk of hospital admissions (OR 1.08–1.15) and readmissions (OR 1.51–1.65). Male gender is associated with higher risk for ED visits (OR 1.30–1.36), admissions (OR 1.12–1.28), and unplanned admissions (OR 1.26–1.37), but not readmissions. The number of outpatient visits consistently shows an inverse relationship with ED visits, hospital admissions and especially unplanned admissions (OR 0.71–90), which may suggest that regular ambulatory care is associated with lower acute healthcare utilization. The number of previous ED visits is associated with increased risk of unplanned admissions (OR 1.23–1.30) but inversely associated to other visits which suggest more complex relationships. Table 9 Feature importance across healthcare outcomes: logistic regression Odds ratios and XGBoost absolute shap values Outcome Feature 30-day 90-day 180-day 365-day OR (95% CI) SHAP OR (95% CI) SHAP OR (95% CI) SHAP OR (95% CI) SHAP ED Visit Male sex 1.31* (1.30, 1.32) 0.095 1.35* (1.34, 1.35) 0.112 1.35* (1.34, 1.36) 0.116 1.32* (1.31, 1.32) 0.108 Multimorbidity 1.33* (1.33, 1.34) 0.203 1.31* (1.31, 1.32) 0.181 1.30* (1.30, 1.30) 0.164 1.28* (1.28, 1.29) 0.159 Unique drugs 1.29* (1.29, 1.30) 0.053 1.29* (1.29, 1.29) 0.038 1.28* (1.27, 1.28) 0.029 1.26* (1.26, 1.27) 0.070 N Outpatient visits 0.92* (0.92, 0.93) 0.082 1.00* (0.99, 1.00) 0.070 1.04* (1.03, 1.04) 0.090 1.07* (1.07, 1.08) 0.113 Total drugs 0.97* (0.96, 0.97) 0.262 1.00 (0.99, 1.00) 0.289 1.03* (1.03, 1.03) 0.304 1.07* (1.06, 1.07) 0.237 Age 0.83* (0.83, 0.84) 0.261 0.82* (0.82, 0.82) 0.253 0.81* (0.81, 0.81) 0.253 0.81* (0.81, 0.81) 0.241 Admission Multimorbidity 1.35* (1.35, 1.35) 0.269 1.32* (1.32, 1.33) 0.238 1.32* (1.31, 1.32) 0.214 1.30* (1.30, 1.30) 0.199 Male sex 1.13* (1.12, 1.13) 0.063 1.17* (1.16, 1.17) 0.069 1.24* (1.23, 1.25) 0.082 1.28* (1.27, 1.28) 0.091 Age 1.15* (1.15, 1.15) 0.213 1.13* (1.12, 1.13) 0.218 1.08* (1.08, 1.09) 0.232 1.08* (1.07, 1.08) 0.247 Unique drugs 1.11* (1.11, 1.12) 0.066 1.10* (1.10, 1.10) 0.038 1.09* (1.08, 1.09) 0.021 1.07* (1.06, 1.07) 0.022 Total drugs 1.01* (1.00, 1.01) 0.038 1.02* (1.02, 1.02) 0.052 1.04* (1.04, 1.05) 0.084 1.07* (1.07, 1.08) 0.097 N Outpatient visits 1.00 (1.00, 1.01) 0.092 1.01* (1.01, 1.01) 0.080 1.02* (1.02, 1.03) 0.076 1.05* (1.05, 1.05) 0.077 N ED visits 0.87* (0.86, 0.87) 0.109 0.90* (0.90, 0.90) 0.088 0.92* (0.92, 0.92) 0.073 0.94* (0.94, 0.95) 0.055 Unplanned Adm. Multimorbidity 1.48* (1.45, 1.49) 0.413 1.50* (1.49, 1.51) 0.498 1.52* (1.51, 1.54) 0.497 1.54* (1.53, 1.55) 0.493 Male sex 1.29* (1.26, 1.31) 0.105 1.30* (1.28, 1.33) 0.111 1.35* (1.33, 1.37) 0.119 1.32* (1.30, 1.34) 0.132 Unique drugs 1.30* (1.28, 1.32) 0.099 1.28* (1.26, 1.29) 0.078 1.24* (1.23, 1.25) 0.043 1.18* (1.17, 1.19) 0.040 N ED visits 1.28* (1.27, 1.30) 0.339 1.24* (1.23, 1.25) 0.316 1.23* (1.23, 1.24) 0.321 1.24* (1.23, 1.25) 0.350 Age 0.99 (0.98, 1.00) 0.407 1.01* (1.00, 1.02) 0.432 1.01* (1.00, 1.02) 0.440 1.05* (1.04, 1.05) 0.436 Total drugs 0.93* (0.92, 0.94) 0.138 0.96* (0.95, 0.97) 0.148 0.99* (0.98, 1.00) 0.175 1.04* (1.03, 1.05) 0.144 N Outpatient visits 0.72* (0.71, 0.74) 0.312 0.82* (0.81, 0.83) 0.248 0.86* (0.85, 0.87) 0.210 0.89* (0.89, 0.90) 0.171 Readmission N Outpatient visits 1.78* (1.74, 1.81) 0.493 2.04* (2.01, 2.08) 0.322 2.01* (1.97, 2.05) 0.312 1.99* (1.95, 2.03) 0.297 Age 1.52* (1.51, 1.54) 0.516 1.63* (1.61, 1.65) 0.521 1.63* (1.61, 1.65) 0.496 1.60* (1.58, 1.62) 0.450 Multimorbidity 1.48* (1.46, 1.50) 0.447 1.30* (1.28, 1.33) 0.808 1.34* (1.32, 1.36) 0.793 1.36* (1.34, 1.39) 0.792 Total drugs 1.08* (1.05, 1.11) 0.171 1.20* (1.16, 1.24) 0.219 1.25* (1.20, 1.30) 0.217 1.34* (1.28, 1.40) 0.220 Unique drugs 1.26* (1.23, 1.29) 0.035 1.20* (1.17, 1.23) 0.028 1.16* (1.13, 1.19) 0.039 1.10* (1.06, 1.13) 0.054 Male sex 1.00 (0.98, 1.03) 0.038 0.94* (0.92, 0.96) 0.050 0.93* (0.91, 0.95) 0.054 0.93* (0.91, 0.95) 0.051 N ED visits 0.70* (0.68, 0.71) 0.160 0.69* (0.68, 0.71) 0.129 0.72* (0.70, 0.73) 0.117 0.74* (0.73, 0.75) 0.106 Note: * indicates statistical significance (p < 0.05). OR = Odds Ratio from logistic regression with 95% confidence intervals; SHAP = XGBoost Absolute SHAP importance values. Features are ordered by maximum odds ratio across all time windows for each outcome. Multimorbidity is measured trough Multimorbidity Weighted Index for ED visits, unplanned admissions, and readmissions (90-365 day), and Charlson Comorbidity Index for all admissions and 30-day readmissions
Feature importance across healthcare outcomes: logistic regression Odds ratios and XGBoost absolute shap values
Note: * indicates statistical significance (p < 0.05). OR = Odds Ratio from logistic regression with 95% confidence intervals; SHAP = XGBoost Absolute SHAP importance values. Features are ordered by maximum odds ratio across all time windows for each outcome. Multimorbidity is measured trough Multimorbidity Weighted Index for ED visits, unplanned admissions, and readmissions (90-365 day), and Charlson Comorbidity Index for all admissions and 30-day readmissions
XGBoost models with SHAP analysis provide complementary insights that align with and extend the LR findings, both in feature importance ranking and magnitude of correlation (Table 9 ). While age associations in SHAP mirror the findings from LR, multimorbidity shows a more pronounced statistical importance than suggested by odds ratios alone. The inverse association of high number of outpatient care use and unplanned outcomes is illustrated in Fig. 7 . Regarding the associations of total and unique drug counts, SHAP plots show that relationships are more complex, with bimodal distribution, possibly indicating patient subgroups where risk factors have different statistical relationships, capturing non-linear associations and interaction effects not accessible through the linear logistic regression framework. The full SHAP values with directions and SHAP summary plots are provided in Appendix F . Fig. 7 Shap summary plot for 30-day unplanned hospital admission (XGBoost). Each dot represents a patient visit; colors encode feature values (blue = low, red = high); x-axis shows shap values (contribution to log-odds)
Shap summary plot for 30-day unplanned hospital admission (XGBoost). Each dot represents a patient visit; colors encode feature values (blue = low, red = high); x-axis shows shap values (contribution to log-odds)