One Size Does Not Fit All: A Data-Driven Framework for Personalized Comorbidity Scoring
1Department of Medicine, School of Medicine, Stanford University, Stanford, CA, USA
2Department of Biomedical Data Science, School of Medicine, Stanford University, Stanford, CA, USA
3Department of Emergency Medicine, School of Medicine, Stanford University, Stanford, CA, USA
*Correspondence to. Dr. Yeon-Mi Hwang, PhD, Department of Medicine (Computational Medicine), School of Medicine, Stanford University, 3180 Porter Drive, Palo Alto, CA, 94304 Email: ymh@stanford.eduAbstract
Comorbidity indices are widely used in clinical research to summarize disease burden. However, traditional indices were developed decades ago in limited populations using fixed weights that do not reflect the diversity of patients in modern healthcare. We present the Personalized Comorbidity Score (PCS), a data-driven framework for context-dependent comorbidity scoring designed to capture patient complexity while remaining accessible for broad research adoption. PCS was developed using Epic Cosmos, a large national EHR network encompassing over 8 million adult inpatient encounters from 2015 to 2020, with comorbidities defined using AHRQ Clinical Classifications Software Refined categories. Models were developed separately across eight age-sex subgroups using LASSO-penalized Cox regression for feature selection and restricted mean survival time for score derivation. PCS is available in two versions: PCS Core, incorporating age, sex, and comorbidities, and PCS Extended, which additionally incorporates socioeconomic and geographic variables. PCS Core and PCS Extended achieved AUROCs of 0.812 and 0.813 for one-year mortality, outperforming traditional indices (AUROC, 0.714-0.730). PCS demonstrated consistently lower subgroup calibration error across demographic and socioeconomic groups without including race or ethnicity as model features. PCS was further evaluated in two complementary external EHR datasets (Stanford Health Care and MIMIC-IV) with distinct patient populations and data structures, where it consistently outperformed traditional indices. Open-source R and Python packages are provided to support broad adoption. PCS provides an updatable framework for comorbidity measurement that is accurate, context-dependent, and designed to evolve alongside clinical practice.
Article notes
Competing Interest Statement
The authors have declared no competing interest.
1.Introduction
Comorbidity indices underpin medical research by efficiently summarizing a patient’s burden of multiple chronic conditions into a single numeric score.1–3 They quantify disease burden for a range of research and administrative applications, including risk adjustment, clinical prediction, resource planning, and reimbursement.1,3,4 Of these, the Charlson Comorbidity Index (CCI) dominates the field. The CCI was developed in 1987 from approximately 600 patient records to predict one-year mortality, and numerous adaptations have since been developed.5–7 The Elixhauser Comorbidity Index (ECI) is the most widely used alternative. Originally developed in 1998 as a set of 30 binary condition flags using administrative inpatient data, it was later converted into several weighted scoring systems, of which the van Walraven ECI is the most widely used.8,9 Although these indices were developed to predict specific outcomes in inpatient populations, they have been extensively validated across diverse cohorts and outcomes.5,8,9 Their simplicity, versatility, and consistent performance have made them the standard tools in medical research. However, as the diversity of patients and complexity of modern healthcare have grown, important limitations have emerged.
Four limitations have become apparent over time: uniform weights that fail to reflect population- and outcome-specific differences, incomplete condition coverage, lack of socioeconomic context, and fragmented updating. First, traditional indices apply uniform weights regardless of a patient’s age, sex, or the outcome being measured. Yet the prognostic significance of comorbid conditions varies considerably across these dimensions. Age and sex are well-established modifiers of disease burden, and comorbidity profiles differ across specific populations, which general-purpose indices are not designed to capture. Cohort-specific comorbidity indices illustrate this point.10–12 Beyond population differences, the same condition can carry fundamentally different prognostic significance depending on the outcome being measured. For example, diabetes with chronic complications carries a weight of -3 for mortality but 9 for readmission in the Moore ECI.13 As a result, traditional indices may systematically misrepresent disease burden for patients who differ by age, sex, population context, or outcomes of interest, with direct consequences for the fairness of comorbidity measurement in research.
Second, the conditions these indices capture are incomplete. Our understanding of disease burden has expanded considerably since the CCI and ECI were developed. Mental health and behavioral conditions are now well-established predictors of mortality and healthcare utilization, yet they are largely absent from the CCI, which remains the dominant index in practice.14 Beyond established conditions, emerging ones such as long COVID highlight the need for frameworks that can systematically incorporate new disease entities as medical knowledge evolves.15 Incomplete condition coverage can disproportionately affect populations whose disease burden falls outside what traditional indices capture.
Third, traditional indices do not account for the socioeconomic context in which patients live and receive care. Socioeconomic factors are well-established determinants of health outcomes.16 A patient with poorly controlled diabetes in a rural area with no insurance may face a vastly different disease burden than one with the same diagnosis in an urban center with full coverage, yet both receive the same comorbidity score. These contextual differences are invisible to traditional indices. This limitation is particularly consequential given well-documented health inequalities across age, sex, race, ethnicity, and socioeconomic groups. Comorbidity tools that fail to account for population heterogeneity may systematically misrepresent disease burden in already underserved populations.
Fourth, updates to traditional indices have been fragmented, leaving researchers without clear guidance on which version to use. The prognostic significance of conditions can shift substantially as treatments evolve. HIV/AIDS was assigned a weight of 6 in the original Charlson index, reflecting its severe mortality burden before effective antiretroviral therapy existed.1,5,17 Successive updates have consistently reduced that weight as treatment outcomes improved. Nevertheless, the original Charlson index remains one of the most cited comorbidity tools in the literature.5 Without a systematic updating process, version proliferation undermines reproducibility and comparability across studies.
Together, these gaps reflect a fundamental limitation. Traditional indices treat comorbidity burden as fixed and universal, when in reality it is context-dependent and population-specific. Advances in electronic health records (EHRs) and large-scale data infrastructure now make it possible to address these limitations directly. We present the Personalized Comorbidity Score (PCS) as a demonstration of a generalizable and data-driven framework for context-dependent comorbidity scoring, designed to address each of these gaps. A core design motivation was to capture individual patient complexity through context-dependent scoring, while remaining simple enough for broad research adoption. PCS was built on a nationally diverse training population with comprehensive condition coverage, age-sex stratified comorbidity selection and weighting, and explicit incorporation of socioeconomic context. Performance across demographic and socioeconomic subgroups was evaluated alongside discrimination, with subgroup calibration serving as the primary fairness evaluation metric. PCS is intended for use by researchers as a summary covariate for risk adjustment and downstream prediction models. Researchers may apply the pre-trained weights directly or use the framework to derive context-specific weights.
We hypothesized that a personalized, context-aware approach to comorbidity scoring would achieve better discrimination and greater fairness across demographic subgroups compared to existing indices. As a demonstration of this framework, we developed and evaluated PCS using Epic Cosmos, a national EHR network encompassing over 300 million patients, with comorbidities defined using AHRQ Clinical Classifications Software Refined (CCSR) categories. PCS was developed on inpatient populations for one-year mortality prediction, mirroring the original CCI design.5 PCS is available in two versions: PCS Core, stratified by age and sex, and PCS Extended, which additionally incorporates socioeconomic measures. To support broad adoption, open-source R and Python packages have been developed and will be made publicly available, enabling researchers to apply PCS directly from CCSR-coded diagnoses. This work represents a step toward comorbidity measurement that is more accurate, more context-aware, and designed to evolve alongside both clinical practice and medical knowledge.
2.Methods
An overview of the PCS framework is provided in Figure 1.
2.1Study population
This retrospective cohort study used de-identified EHR data from Epic Cosmos, a national research database encompassing 307 million patients across 2197 hospitals and 49,300 clinics in the United States (as of June 29, 2026).18 Data for this study were accessed on October 13, 2025. Participating organizations collectively serve a patient population whose demographic composition is similar to U.S. Census distributions, though Epic Cosmos predominantly captures patients receiving care within the Epic network and may underrepresent uninsured individuals and those treated at non-Epic facilities.18,19 We identified adult patients (aged ≥18 years) with hospital admissions between March 31, 2015, and March 31, 2020. This observation period was selected to ensure sufficient EHR adoption and data quality and to allow a minimum of five years of follow-up for the assessment of long-term mortality outcomes. To ensure adequate capture of pre-existing comorbidities, we required patients to have at least two healthcare encounters prior to the index admission with a minimum care span of 365 days. We excluded admissions with zero-day length of stay, non-index admissions, and pregnancy-related admissions. For patients with multiple qualifying admissions during the study period, only the first qualifying admission was included. The full cohort selection process is described in Figure 2.
2.2Variables
2.2.1Patient characteristics
We extracted patient demographic characteristics including age at admission, sex, race, ethnicity, multiracial status, and insurance type. Neighborhood-level socioeconomic status and geographic classification were assessed using the Social Vulnerability Index (SVI) and Rural-Urban Commuting Area (RUCA) code. All variables were obtained directly from Epic Cosmos without modification (Table S1).
Records with missing values in predictors required for each model specification were excluded from model development (complete-case analysis). Missingness for demographic and socioeconomic variables is reported in Table 1.
2.2.2Comorbidities
Comorbidities were identified using ICD-10 diagnosis codes from all diagnosis positions mapped to the AHRQ Clinical Classifications Software Refined (CCSR) for ICD-10-CM (2025 version).20 Two clinicians (RL, BTR) independently reviewed all 553 CCSR diagnostic categories and selected clinically relevant comorbid conditions. Only conditions meeting AHRQ chronic condition criteria (2025 version) were retained, defined as conditions lasting at least 12 months and either placing limitations on self-care or independent living, or requiring ongoing medical intervention.21
2.2.3Outcomes
The primary outcome was all-cause mortality at 1 year (365 days) following the index admission, ascertained using death dates recorded in Epic Cosmos. Epic Cosmos aggregates mortality information from multiple sources, capturing deaths beyond the hospital setting. Secondary outcomes were all-cause mortality at 3 and 5 years (1095 and 1825 days).
2.3Personalized Comorbidity Score Development
PCS is intended for use as a summary covariate in downstream analyses, not as a standalone risk prediction tool. A Cox proportional hazards model serves as the underlying estimation framework to derive the score, and evaluation metrics are reported to characterize its performance properties relative to existing indices.
Epic Cosmos provides a pre-designated 1% random sample of records, referred to as SneakPeek, which was held out prior to model development. The remaining 99% of records were used for score development. The SneakPeek subset was not used for model fitting or tuning and was reserved solely for final evaluation in a held-out test set.
To account for differences in comorbidity patterns and risk across demographic groups, models were developed separately by age (18-44, 45-64, 65-79, and ≥80 years) and sex (male or female). Age groups were defined based on MeSH age categories.22 Two model specifications were considered: PCS Core, which included age and comorbidity conditions as predictors, and PCS Extended, which additionally incorporated socioeconomic and geographic context, including the SVI, RUCA classification, and insurance status.
Scores were estimated separately within each age subgroup. We prespecified evaluation of both age-stratified and age-unified specifications for each age group. The specification demonstrating superior discrimination in the held-out data was retained. This was done because younger age groups have relatively few outcome events, which could lead to unstable coefficient estimates.
2.3.1Two-Stage Cox Model Development
The comorbidity score was constructed using a two-stage framework consisting of variable selection followed by final model estimation. The dataset was randomly divided into two equal subsets: one used for selecting relevant predictors and the other used for fitting the final model. This was done to reduce selection bias because using the same data for both variable selection and coefficient estimation can yield inflated and unstable estimates.
2.3.1.1Feature Selection
Feature selection was performed using LASSO-penalized Cox proportional hazards regression applied to the first subset. Predictors with nonzero coefficients were retained to form the final set of selected covariates. The penalty parameter was selected via 5-fold cross-validation within the first subset.
2.3.1.2Final Model Estimation
The final model was estimated using a Cox proportional hazards model with the features selected in Stage 1, fitted on the second subset. Age was modeled using cubic B-spline basis functions to capture potential nonlinear relationships with risk. For an individual with covariate vector Xi, the hazard function was modeled as where λ0(t) is the baseline hazard and the risk score η(Xi) is a linear combination of all binary predictors and B-spline basis transformations of age. Estimated coefficients with negative values for comorbidities were set to zero. Negative weights in comorbidity scoring systems have been noted as statistical artifacts that do not reflect genuinely protective effects on mortality.23 However, we acknowledge that some negative coefficients may reflect genuinely protective conditions or collinear features. A sensitivity analysis retaining negative coefficients was therefore conducted, and both the constrained and unconstrained model specifications are made available to allow researchers to select the version most appropriate for their use case.
2.3.2Translating the Linear Predictor into a Comorbidity Score
To provide a clinically interpretable measure of health risk, the linear predictor η(Xi) derived from the fitted Cox model was translated into a comorbidity score using restricted mean survival time (RMST). For a prespecified time horizon τ, the RMST is defined as where S(t|X) is the predicted survival function for a patient with covariate vector X. Under the fitted Cox model, the predicted survival function is where S0(t) denotes the estimated baseline survival function. The comorbidity score was defined as the predicted RMST for each individual, rescaled and inverted so that higher values indicate greater comorbidity burden: which can be interpreted as 100 times the average cumulative mortality rate over the interval[0, τ]. For example, a patient with a PCS score of 5 has an estimated average cumulative mortality rate of 5% over one year, while a patient with a score of 40 has an estimated rate of 40%.
While linear predictor η(Xi) forms the basis of the score, its log-hazard scale is relative and requires a reference group to interpret directly. The RMST transformation converts this into an absolute, percentage-scale measure that is more intuitive for summarizing comorbidity burden across patients.
The Cox proportional hazards approach was selected in part because it effectively handles right censoring present in survival data, which is common in EHR-based cohorts. The two-stage approach was adopted with two objectives. The first stage screens informative predictors, as model sparsity was preferred to support reproducibility and generalizability. The second stage generates unbiased coefficient estimates for the effect of each comorbidity.
2.4Descriptive statistics
Patient demographic characteristics and comorbidity prevalence were summarized for the full analytic cohort and the held-out SneakPeek 1% subset. Continuous variables were reported as means and standard deviations and categorical variables as counts and proportions. Standardized mean differences (SMD) were calculated to assess representativeness of the SneakPeek subset relative to the full cohort. The ten most prevalent CCSR-defined comorbidities were identified and reported. Score distributions were examined across indices. A LOWESS trend line was fitted to visualize the relationship between age at admission and each comorbidity score.
2.5Model Evaluation
As a summary covariate designed for risk adjustment, PCS was evaluated on its ability to discriminate and characterize disease burden relative to existing indices, rather than as a standalone risk prediction tool. PCS was compared against three traditional indices: the original Charlson Comorbidity Index (Original CCI), the Quan-updated Charlson Comorbidity Index (Quan CCI), and the van Walraven Elixhauser Comorbidity Index (van Walraven ECI).5,8,17 These were selected as comparators given their widespread adoption in research practice and inclusion in commonly used comorbidity software package.24,25 Comorbidity conditions for each traditional index were identified using established ICD-10 coding algorithms.7 A consistent two-year lookback window was applied across all indices. No correction for multiple comparisons was applied, as automatic adjustment may increase type II error and is not warranted for empirical observations.26 Instead, 95% confidence intervals are reported to support interpretation of findings.
2.5.1Model performance
Score discrimination was evaluated as the primary performance metric. Area under the receiver operating characteristic curve (AUROC) was the primary discrimination metric, assessed in the held-out SneakPeek 1% dataset using AUROC for classifying death and survivor at given time points. The C-statistic, estimated using survival time to account for censoring, was reported as a complementary measure. Both metrics were evaluated with 95% confidence intervals derived from 2,000 bootstrap iterations in the held-out set. P-values below 0.001 cannot be precisely estimated given the number of bootstrap iterations.
Comorbidity scores are not inherently calibrated to predicted probabilities, and raw scores from different indices are on incomparable scales. To enable consistent comparison across all indices, each score was mapped to outcome probability using Platt scaling with 5-fold cross-validation in the training set.
Calibration curves are presented to characterize how each score tracks observed mortality rates across the risk spectrum. Specifically, each score was mapped to outcome probability using Platt scaling: where S is the comorbidity score and Y is the binary event indicator, with the mapping estimated via 5-fold cross-validation in the training set. These derived mappings were then applied to the held-out dataset, where calibration was evaluated using decile-based curves comparing mean predicted probabilities against observed event rates. Calibration curves are presented to characterize how each score tracks observed mortality rates across the risk spectrum.
2.5.2Fairness analysis
Calibration and discrimination were compared across seven demographic subgroups as a measure of score fairness: age, sex, race, ethnicity, insurance class, SVI quartile, and RUCA classification. Race and ethnicity were not used in calculating PCS or the traditional indices but were evaluated as dimensions of fairness. While overall calibration is not a primary performance metric, subgroup-level calibration is prioritized as the primary fairness metric because systematic differences in calibration across demographic groups may differentially affect score performance for specific populations.27
Maximum calibration error (MCE) was the primary fairness metric, defined as the maximum absolute difference between the expected-to-observed (E/O) ratio and 1.0 across demographic subgroups, capturing the worst-case disparity in calibration. Here, Eg and Og represent the expected mortality rate in subgroup g according to the calibrated index and observed mortality rate. The weighted calibration error (WCE), the subgroup-size-weighted average of absolute calibration errors, was examined as a secondary fairness metric, where wg is the subgroup size.
Subgroup-level calibration curves are not presented for each demographic group, as some subgroups have insufficient sample sizes to support reliable decile-based calibration estimates. MCE and WCE are used instead to quantitatively summarize calibration differences across subgroups in a comparable format. Subgroup-level AUROC values were reported for each demographic group to confirm that PCS maintains higher discrimination than traditional indices within individual subgroups. AUROC range across subgroups was also computed as a complementary measure of discrimination consistency. Group fairness metrics based on classification thresholds were not applied, as they require a fixed decision threshold and preclude meaningful comparisons across indices with fundamentally different scoring systems.27 Subgroup-level confidence intervals were derived from 500 bootstrap iterations. P-values below 0.004 cannot be precisely estimated given the number of bootstrap iterations.
2.5.3Subgroup-Specific Condition Weights
To illustrate how comorbidity weights vary across demographic subgroups, log hazard ratios for each CCSR condition were visualized across all age-sex subgroups. This descriptive analysis highlights the degree to which individual conditions contribute differently to the score depending on a patient’s age and sex, supporting the rationale for subgroup-specific weighting.
2.6Open-source Software Package Development
These packages enable researchers to compute PCS Core and PCS Extended scores directly from CCSR-coded diagnoses using pre-estimated condition weights. Users can specify the score variant (PCS Core or PCS Extended), outcome (1, 3, and 5 year mortality) and the package version. Each parameter selects the corresponding set of pre-estimated weights, allowing researchers to apply the appropriate model for their setting. Package versions will be updated periodically to reflect the evolving clinical landscape and refinements to the framework. Guidance on minimum data requirements and handling of missing or incomplete input data is provided in the package documentation.
2.7Validation
We validated model performance in two complementary EHR datasets: Stanford EHR and MIMIC-IV hospital admission data28. Stanford EHR comprised comprehensive inpatient and outpatient data from Stanford Health Care, an academic medical center in Northern California. MIMIC-IV is a publicly available EHR dataset from Beth Israel Deaconess Medical Center, a tertiary academic medical center in Boston, Massachusetts. Neither dataset constitutes a fully external validation, as both source institutions participate in the Epic Cosmos network,29 introducing the possibility of patient overlap with the development cohort. Nevertheless, the two datasets differ meaningfully in patient populations, data structure, and institutional context, providing complementary evaluations of model performance.
The Epic Cosmos cohort design was largely replicated in Stanford EHR, given access to comprehensive inpatient and outpatient data. In contrast, MIMIC-IV contains inpatient data only and does not support full replication, including the fixed observation period, longitudinal outpatient encounters, and prior healthcare utilization requirements. For MIMIC-IV, the analytic cohort included non-pregnant adults (≥18 years) with a first inpatient admission. Comorbid conditions were ascertained from diagnosis codes recorded prior to or during the index admission, and one-year mortality was defined as death within 365 days of discharge.
Pre-trained PCS models were applied without retraining or refitting. Discrimination was assessed using AUROC for one-year mortality and compared with the Original CCI, Quan-adapted CCI, and Van Walraven ECI. Because MIMIC-IV lacked variables required for PCS Extended, only PCS Core was evaluated in that dataset.
2.8Ethics Statement
This study was conducted in accordance with institutional guidelines. Stanford EHR data were used under an Institutional Review Board (IRB) approval, with a waiver of informed consent (Protocol 47644). Epic Cosmos data were determined to not constitute human subjects research by the Stanford Human Research Protection Program. MIMIC-IV is a publicly available, de-identified dataset exempt from IRB review.
3.Results
3.1Study population
We identified a base inpatient cohort of 8,896,169 admissions from a static extract of Epic Cosmos (extract date: October 13, 2025), including patients with at least one hospital admission between March 31, 2015 and March 31, 2020. We sequentially excluded pregnancy-related admissions, same-day discharges, and encounters with insufficient continuity of care; patients aged under 18 or over 100 years; those not eligible for Cosmos Data Analytics; patients residing outside the United States; and records with invalid or incomplete data. The final analytic cohort comprised 8,052,133 admissions (Figure 2).
3.2Cohort characteristics
The mean age was 63.5 years (SD 17.5), and females comprised 53.4% of the cohort. The majority of patients identified as non-Hispanic or Latino (91.0%) and White (78.8%). Medicare was the most common financial class (40.7%), and most patients resided in metropolitan areas (82.3%). The SVI Overall mean was 0.57 (SD 0.28). One-year, three-year, and five-year mortality rates were 6.7%, 13.0%, and 18.2%, respectively. The SneakPeek 1% dataset (n=80,816) used as the held-out test set showed similar demographic and outcome distributions across all characteristics, with SMD less than 0.05 (Table 1)
The ten most prevalent comorbidities in the full dataset were essential hypertension (54.7%), disorder of lipid metabolism (43.7%), and esophageal disorders (25.0%), followed by type 2 diabetes, osteoarthritis, spondylopathies, diabetes without complication, coronary atherosclerosis, obesity, and nervous system pain syndrome (18.7-25.0%; Figure S1).
3.3PCS Evaluation
All indices showed right-skewed score distributions. PCS Core and PCS Extended scores increase more steeply across the age range (Figure S2 and S3).
3.3.1Model performance
PCS Core and PCS Extended outperformed all three traditional indices across all time horizons. For both the Core and Extended versions, the age-unified model was applied to the younger age group (18-44 years), consistent with the prespecified model selection strategy described in the Methods. Using our primary outcome of 1-year mortality, PCS Core and PCS Extended achieved AUROC of 0.812 (95% CI 0.805-0.817) and 0.813 (95% CI 0.807-0.818), respectively, compared to 0.730 (95% CI 0.723-0.737) for the van Walraven ECI, 0.719 (95% CI 0.712-0.726) for the Quan CCI, and 0.714 (95% CI 0.707–0.721) for the Original CCI (P<0.001; Figure 3). Similar patterns were observed at 3-year (PCS Core: 0.799, 95% CI 0.795-0.803; PCS Extended: 0.800, 95% CI 0.795–0.804) and 5-year horizons (PCS Core: 0.795, 95% CI 0.790-0.799; PCS Extended: 0.796, 95% CI 0.792-0.800), consistently exceeding traditional indices across all time points (Table S2-S4). A sensitivity analysis retaining negative coefficients yielded slightly higher discrimination, suggesting that the constraint had minimal impact on performance (Table S2-S4).
PCS Core and PCS Extended demonstrated wider predicted probability ranges than traditional indices, reflecting stronger risk differentiation consistent with higher discrimination. Both PCS variants showed systematic underestimation of risk at lower predicted probabilities, with observed event rates consistently exceeding predicted values in that range (Figure S4, S5, and S6).
3.3.2Fairness analysis
Calibration and discrimination were compared across all demographic subgroups, with both PCS variants showing reduced calibration error compared to traditional indices. MCE and WCE were consistently lower for PCS Core and PCS Extended across all subgroups (Table 2 and Figure 3). The direction and relative magnitude of calibration differences across subgroups are illustrated in Figure S7, which is presented to show directionality rather than inferential comparisons.
Age exhibited the largest calibration differences across all models. Traditional indices showed MCE ranging from 2.547 to 2.925, whereas PCS Core and PCS Extended reduced MCE to 1.784 (95% CI 1.395-2.239; P<0.004) and 1.737 (95% CI 1.358-2.184; P<0.004), respectively. In contrast, sex demonstrated the smallest calibration differences across all models.
Calibration improvements were also observed across race and ethnicity. For race, MCE was reduced to 0.488 (95% CI 0.208-0.963; P=0.012) for PCS Core and 0.446 (95% CI 0.177-0.914; P=0.012) for PCS Extended, compared with 0.640-0.772 for traditional indices. For ethnicity, MCE was reduced to 0.535 (95% CI 0.316-0.791; P<0.004) for PCS Core and 0.459 (95% CI 0.249-0.700; P<0.004) for PCS Extended, compared with 0.636-0.761 for traditional indices.
Insurance class also showed lower calibration error for both PCS variants. MCE was reduced to 2.006 (95% CI 0.247-3.515; P<0.004) for PCS Core and 1.931 (95% CI 0.225-3.422; P<0.004) for PCS Extended, compared with 2.535-2.807 for traditional indices.
For SVI and RUCA, PCS Extended demonstrated the largest reductions in calibration error. For SVI, MCE was reduced to 0.045 (95% CI 0.016-0.081; P=0.008) for PCS Extended, compared with 0.081-0.097 for traditional indices, whereas PCS Core showed an MCE of 0.060 (95% CI 0.029-0.099; P=0.084). For RUCA, MCE was reduced to 0.097 (95% CI 0.039-0.160; P<0.004) for PCS Extended, compared with 0.185-0.188 for traditional indices, whereas PCS Core showed minimal improvement (0.182, 95% CI 0.118-0.243; P=0.684).
Subgroup-level AUROC was consistently higher for PCS Core and PCS Extended than for traditional indices across all subgroup definitions, while the range of AUROC across subgroups remained comparable between PCS variants and traditional indices (Table 2, Figure S8, and Figure S9).
3.3.3Subgroup-Specific Condition Weights
From an initial pool of 248 clinician-selected CCSR comorbidities, PCS Core selected 120 unique CCSR comorbidity features across all age-sex subgroups, with the number of features per subgroup ranging from 58 to 97. PCS Extended selected 152 unique features, ranging from 89 to 130 per subgroup. Figure S10 illustrates subgroup-specific weighting across all CCSR disease categories, with neoplasm and malignancy categories showing the most pronounced variation. Secondary malignancies (NEO070, metastatic or secondary malignancy) had the highest mean absolute coefficient in both PCS variants. In PCS Core, its coefficient ranged from 1.549 in females aged 45-64 to 0.743 in males aged 80 and older. In PCS Extended, it ranged from 1.563 in females aged 45-64 to 0.743 in males aged 80 and older.
3.5Open-source software package
Open-source R and Python packages have been developed and will be made publicly available upon journal acceptance (https://github.com/su-boussard-lab/personalized-comorbidity-score). Package versions will be updated periodically to reflect the evolving clinical landscape and refinements to the framework.
3.6Validation
We evaluated PCS in two complementary EHR datasets with distinct patient populations and data structures: Stanford Health Care and MIMIC-IV. Descriptive characteristics of both validation cohorts are summarized in Tables S5 and S6. In the Stanford Health Care cohort, PCS Core and PCS Extended achieved AUROCs of 0.778 and 0.777 for one-year mortality, respectively, outperforming the Original CCI (0.648), Quan CCI (0.654), and van Walraven ECI (0.653).
In the MIMIC-IV cohort, PCS Core achieved the highest discrimination for one-year mortality, with an AUROC of 0.847. In comparison, the van Walraven ECI achieved an AUROC of 0.807, followed by the Quan CCI (0.787) and the Original CCI (0.785).
4.Discussion
Traditional comorbidity indices treat disease burden as fixed and universal, yet the prognostic significance of comorbid conditions varies by age, sex, socioeconomic context, and the outcome being measured. Comorbidity scores are often used as generic control variables in research models. Because these indices apply uniform weights regardless of population, the resulting score may not accurately reflect the disease burden of the specific population being studied. PCS was designed to treat comorbidity burden as context-dependent and population-specific. It was built from over 8 million adult inpatient encounters across the Epic Cosmos network. PCS was designed to address four longstanding limitations of traditional indices: fixed comorbidity weights that fail to reflect heterogeneous disease burden, incomplete condition coverage, lack of socioeconomic context where available, and the absence of a systematic updating process. Both PCS variants showed numerically lower calibration error than traditional indices across all demographic subgroups examined, though this difference reached statistical significance in most but not all subgroups. These gains were achieved without including race or ethnicity as model features, which avoids the risk of reinforcing race-based disparities in research scoring.
PCS achieved significantly higher discrimination than traditional indices for 1-year all-cause mortality prediction (P<0.001). Prior efforts to improve comorbidity measurement through updates, adaptations, and machine learning approaches have achieved comparable or higher discrimination in some settings. 1,2,6–8,13,30–34 However, to our knowledge, no widely adopted comorbidity framework has simultaneously addressed comprehensive condition coverage, socioeconomic context, and demographic-stratified weighting.
PCS showed reduced subgroup calibration error across all demographic subgroups without including race or ethnicity as model features. Encoding race and ethnicity directly in comorbidity measurement has raised concerns about reinforcing race-based disparities in how disease burden is quantified and applied.35,36 PCS achieved improved subgroup calibration through age-sex stratified comorbidity selection and weighting. This contrasts with Tangel et al., who derived race/ethnicity-specific weights from binary Elixhauser conditions.37 Subgroup-level AUROC was consistently higher for both PCS variants compared to traditional indices across all demographic groups, indicating that the discrimination advantage of PCS is maintained within individual subgroups. Unlike traditional indices that apply uniform weights regardless of population, PCS provides comorbidity weights tailored to the age and sex profile of the study population, offering researchers a more meaningful measure of disease burden for their specific cohort. Age showed the largest absolute MCE improvement, reflecting the heterogeneity in disease burden across the lifespan that uniform-weight indices fail to capture.
PCS showed greater miscalibration than traditional indices at lower predicted probabilities, with observed event rates exceeding predicted values in that range. A known trade-off exists between discrimination and calibration in prediction modeling, where stronger discrimination can come at the cost of calibration.38,39 While calibration is critical for standalone clinical prediction tools where absolute risk estimates inform patient decisions,27,38 PCS is designed for use as a summary covariate for risk adjustment and as an input feature in downstream models. In both contexts, the primary criterion is discrimination, as the utility of PCS lies in correctly ranking patients by disease burden. Researchers should nonetheless consider this miscalibration pattern when interpreting absolute probability estimates derived from PCS at the lower end of the risk spectrum.
Discrimination was nearly identical between PCS Core and PCS Extended despite the latter incorporating additional socioeconomic and geographic features. This suggests that age-sex stratified comorbidity weighting alone captures much of the predictive signal for 1-year mortality. Alternatively, socioeconomic features may contribute more meaningfully to outcomes closely tied to social determinants of health, such as readmission.40 PCS Extended demonstrated superior calibration fairness for insurance class, SVI, and RUCA, consistent with its incorporation of socioeconomic features. For settings where socioeconomic data are available, PCS Extended may be preferable given its improved fairness profile. Where such data are unavailable, PCS Core remains a strong alternative with improved performance and fairness over traditional indices.
PCS assigns comorbidity weights that vary by age-sex subgroup, reflecting the clinical reality that the same condition carries different prognostic weight depending on a patient’s age and sex.41–43 Secondary malignancies showed the highest mean absolute coefficient among all features in both PCS variants, yet its weight was markedly lower in patients aged 80 and older compared to middle-aged patients. This reflects the diminishing relative contribution of malignancy to mortality risk in older patients, who carry a higher burden of competing causes of death.44 These patterns illustrate why a single set of comorbidity weights applied uniformly across all patients may systematically misrepresent disease burden in specific subgroups.
Discrimination in the 18-44 age group was lower when using fully age-stratified coefficients, likely reflecting the relatively low mortality rate in younger patients and the limited number of outcome events available for stable estimation. To address this, we evaluated both age-stratified and age-unified model specifications for each age group, adopting the specification with better predictive performance. This highlights an important practical consideration in personalized comorbidity frameworks. Subgroup-specific modeling requires sufficient outcome events, and excessive stratification in low-event subgroups may reduce rather than improve model performance.
PCS maintained performance across two distinct EHR datasets. However, neither constitutes a fully external validation given both institutions’ participation in the Epic Cosmos network. Although PCS consistently outperformed traditional comorbidity indices in both datasets, the magnitude of improvement was smaller in MIMIC-IV than in Stanford Health Care and the Epic Cosmos test cohort. Several factors may explain this finding. First, MIMIC-IV is an inpatient-only database that does not support reconstruction of the longitudinal outpatient history used during PCS development. This limits the availability of chronic disease information. Second, to ensure adequate comorbidity ascertainment in MIMIC-IV, diagnoses recorded during the hospitalization were included in score calculation, and outcome was measured from discharge rather than admission. In contrast, the Epic Cosmos and Stanford cohorts measured mortality from admission and used diagnoses recorded prior to admission only. These differences in diagnosis timing and outcome ascertainment likely improve discrimination for all comorbidity indices in MIMIC-IV, reducing the relative advantage of PCS. Despite these differences, PCS remained the best-performing comorbidity index across both validation datasets, supporting the robustness and generalizability of the framework.
This study has several notable strengths. PCS was developed on Epic Cosmos, the largest EHR database in the United States, including more than 8 million qualifying inpatient encounters across a geographically diverse network of participating health systems and payer types. Unlike traditional indices that rely on expert-curated condition lists with fixed weights, PCS uses data-driven condition selection and subgroup-specific weight estimation, allowing both the relevant conditions and their prognostic contributions to vary across age-sex subgroups. The use of AHRQ-defined CCSR categories and chronic condition indicators ensures comprehensive and standardized condition coverage through actively maintained and publicly available mappings, reducing the risk of variable selection bias inherent in expert-curated condition lists, while enabling a reproducible and updatable workflow. The framework is designed to support systematic weight updates as the clinical landscape evolves, addressing a key limitation of existing indices where updates become fragmented over time. The RMST-based scoring expresses comorbidity burden as an estimated cumulative mortality rate over the specified time horizon, offering a more interpretable scale than the log-hazard based linear predictor. The availability of versioned open-source R and Python packages supports reproducibility and broad adoption. Finally, the availability of both a core and extended version provides flexibility across research contexts, with PCS Core applicable where only clinical data are available and PCS Extended offering improved fairness where socioeconomic data can be linked.
This study has several limitations. First, although Epic Cosmos is broadly representative of the US population, it predominantly captures patients who receive care within the Epic network, potentially underrepresenting uninsured patients and those treated at non-Epic facilities such as the Veterans Health Administration. Second, PCS was developed and evaluated within the US healthcare context, and generalizability to other countries with distinct coding practices and care-seeking behaviors remains to be established. Third, while Epic Cosmos benefits from multi-source mortality ascertainment, EHR-based mortality capture remains inherently incomplete compared to national death registries, and death ascertainment practices vary across care sites, which may introduce differential outcome misclassification. Fourth, although PCS was validated in two independent datasets, Stanford Health Care and MIMIC-IV, neither constitutes a fully external validation, as both institutions participate in the Epic Cosmos network. True external validation in healthcare systems outside the Epic ecosystem remains an important next step before broad adoption. Fifth, incorporating socioeconomic variables such as SVI and insurance status may improve calibration across demographic subgroups but does not resolve underlying structural inequities and may encode existing disparities into the score.Finally, PCS was optimized for 1-year all-cause mortality, and extension to other outcomes would require outcome-specific retraining of the framework. In addition, the pre-trained weights provided reflect the Epic Cosmos population, and direct application to substantially different populations without validation may not be appropriate. Unlike traditional indices where fixed weights are applied universally, PCS is designed to be retrained on population-specific data, offering a path to address this limitation in future applications.
PCS represents a step toward comorbidity measurement that is data-driven, context-dependent, and extensible. Future work should establish best practices for adapting the PCS framework to new populations and outcomes, including guidance on minimum sample size requirements, cohort construction, retraining procedures, and version management. Beyond mortality, we hope to extend PCS to broader dimensions of health burden, including functional decline, quality of life, and healthcare utilization, each requiring outcome-specific retraining of the framework. PCS is designed to evolve alongside both clinical practice and advances in computational methods, with versioned weight updates and support for more complex modeling approaches as they become validated for this use case. Open-source R and Python packages are publicly available to support broad adoption. We envision an extensible design that could allow researchers and clinicians to contribute cohort-specific and outcome-specific variants as the framework grows, ultimately providing a foundation for precision public health research.45
5.Conclusion
Comorbidity measurement has long relied on indices developed decades ago, on limited populations, with fixed weights that do not reflect the diversity of patients seen in modern clinical practice. PCS illustrates a framework for modern comorbidity measurement that is data-driven, context-dependent, and designed to evolve. Across a nationally diverse cohort of over 8 million inpatient encounters, PCS showed higher discrimination than traditional indices and reduced calibration error across most demographic subgroups, without encoding race or ethnicity into the scoring model. As clinical research increasingly demands tools that are both accurate and population-specific, PCS provides a foundation for comorbidity measurement that is fit for the diversity of populations it serves. Unlike traditional indices with fixed weights applied universally, PCS is designed to be retrained and refined as populations, outcomes, and clinical contexts evolve, offering a systematic and extensible alternative to the fragmented updating that has long characterized comorbidity measurement.
Supporting information
Funding
This work was supported by a Stanford Human-Centered AI and Medicine Responsible AI for Safe and Equitable Health Seed Grant. Travel support for presentation of this work was partially provided by the Stanford Center for Digital Health. The funders had no role in the study design; data collection, analysis, or interpretation; manuscript preparation; or the decision to submit the manuscript for publication.
Conflict of Interest
The authors declare no competing interests.
Data Availability
Epic Cosmos and Stanford Health Care EHR data contain protected health information and cannot be made publicly available due to patient privacy restrictions. Researchers may request access to Epic Cosmos through Epic’s Cosmos research program, subject to data use agreements. Stanford EHR data access requires institutional approval. MIMIC-IV is publicly available to credentialed users through PhysioNet (https://physionet.org/content/mimiciv/).