-
Notifications
You must be signed in to change notification settings - Fork 3
Risk Adjustment Algorithms
medicaid-utils includes Python implementations of 8 published clinical algorithms for risk adjustment, procedure classification, and quality measurement.
Flags 31 comorbidity groups from diagnosis codes (Elixhauser et al., 1998). The implementation extends the original 30 categories by splitting hypertension into uncomplicated/complicated.
from medicaid_utils.adapted_algorithms.py_elixhauser.elixhauser_comorbidity import score
# MAX — first construct LST_DIAG_CD from individual diagnosis columns
diag_cols = [c for c in ip.df.columns if c.startswith("DIAG_CD_")]
ip.df = ip.df.map_partitions(
lambda pdf: pdf.assign(
LST_DIAG_CD=pdf[diag_cols].apply(
lambda row: ",".join(v for v in row if v and str(v).strip()), axis=1
)
)
)
df_scored = score(ip.df, lst_diag_col_name="LST_DIAG_CD", cms_format="MAX")
# TAF — gather diagnosis codes (creates LST_DIAG_CD on dct_files["base_diag_codes"])
# ip.gather_bene_level_diag_ndc_codes()
# df_scored = score(ip.dct_files["base_diag_codes"], lst_diag_col_name="LST_DIAG_CD", cms_format="TAF")Adds 31 binary columns (ELX_GRP_1 through ELX_GRP_31) to the DataFrame.
Reference: Elixhauser A, Steiner C, Harris DR, Coffey RM. Comorbidity measures for use with administrative data. Medical Care. 1998;36(1):8-27.
Pharmacy-based risk adjustment using the Chronic Illness and Disability Payment System (Kronick et al., 2000, UC San Diego). Combines diagnosis-based CDPS categories with pharmacy (NDC) information.
from medicaid_utils.adapted_algorithms.py_cdpsmrx import cdps_rx_risk_adjustment
df_risk = cdps_rx_risk_adjustment.cdps_rx_risk_adjust(
df, lst_diag_col_name="LST_DIAG_CD", lst_ndc_col_name="LST_NDC"
)Reference: Kronick R, Gilmer T, Dreyfus T, Lee L. Improving health-based payment for Medicaid beneficiaries: CDPS. Health Care Financing Review. 2000;21(3):29-64.
Assigns Berenson-Eggers Type of Service categories to procedure codes using CMS crosswalk files.
from medicaid_utils.adapted_algorithms.py_betos import betos_proc_codes
df_classified = betos_proc_codes.assign_betos_cat(ot.df, year=2012)Categories include evaluation & management, procedures, imaging, tests, DME, other, and exceptions.
Flags potentially preventable emergency department visits (Davies et al., 2017).
from medicaid_utils.adapted_algorithms.py_ed_pqi.ed_pqi import get_ed_pqis
# Requires IP, OT, PS, and ED claim DataFrames
df_ed = ot.df[ot.df["ed_use"] == 1]
df_pqi = get_ed_pqis(df_ip=ip.df, df_ot=ot.df, df_ps=ps.df, df_ed=df_ed)Reference: Davies S, Schultz E, et al. Identification of potentially preventable emergency department visits using a claims-based standardized methodology. Health Services Research. 2017;52(5):1667-1691.
AHRQ Prevention Quality Indicators for inpatient admissions. Identifies potentially avoidable hospitalizations that may indicate inadequate access to outpatient care.
from medicaid_utils.adapted_algorithms.py_ip_pqi.prevention_quality_indicators import pqirecode
df_adult, df_children = pqirecode(ip.df)Returns separate DataFrames for adult (TAPQ01–TAPQ16) and pediatric (TAPD14–TAPD18) PQI indicators.
Classifies ED visits by severity and preventability (Billings, Parikh, Mijanovich, 2000). Assigns probabilities to each visit across categories: non-emergent, emergent but primary-care treatable, emergent but preventable/avoidable, and emergent not preventable.
from medicaid_utils.adapted_algorithms.py_nyu_billings.billings_ed import get_nyu_ed_proba
pdf_nyu = get_nyu_ed_proba(
df_ed, date_col="srvc_bgn_date", index_col="MSIS_ID", cms_format="MAX"
)Reference: Billings J, Parikh N, Mijanovich T. Emergency department use: the New York story. Issue Brief (Commonwealth Fund). 2000;434:1-12.
Classifies pediatric patients by medical complexity into three tiers: non-chronic, non-complex chronic, and complex chronic (Simon et al., 2014, Seattle Children's Research Institute).
from medicaid_utils.adapted_algorithms.py_pmca.pmca import pmca_chronic_conditions
df_pmca = pmca_chronic_conditions(df, diag_cd_lst_col="LST_DIAG_CD_RAW")Reference: Simon TD, Cawthon ML, Popalisky J, et al. Pediatric medical complexity algorithm: a new method to stratify children by medical complexity. Pediatrics. 2014;133(6):e1647-e1654.
Identifies low-value care services — clinical interventions with little or no benefit relative to their cost or potential harm (Charlesworth et al., 2016).
from medicaid_utils.adapted_algorithms.py_low_value_care.low_value_care import construct_low_value_care_measures
pdf_lvc = construct_low_value_care_measures(
state="AL", year=2012,
lst_bene_msis_filter=[], index_col="BENE_MSIS",
max_data_root="/data/max", out_folder="/output"
)Reference: Charlesworth CJ, Meath THA, Schwartz AL, McConnell KJ. Comparison of low-value care in Medicaid vs commercially insured populations. JAMA Internal Medicine. 2016;176(7):998-1004.
| Algorithm | Reference | Module |
|---|---|---|
| Elixhauser Comorbidity Index | Elixhauser et al., 1998 | py_elixhauser |
| CDPS-Rx Risk Adjustment | Kronick et al., 2000 | py_cdpsmrx |
| BETOS Classification | CMS | py_betos |
| ED PQI | Davies et al., 2017 | py_ed_pqi |
| IP PQI | AHRQ | py_ip_pqi |
| NYU/Billings ED Algorithm | Billings et al., 2000 | py_nyu_billings |
| PMCA | Simon et al., 2014 | py_pmca |
| Low-Value Care | Charlesworth et al., 2016 | py_low_value_care |
medicaid-utils | Documentation | PyPI | GitHub | MIT License | Research Computing Group, Biostatistics Laboratory, The University of Chicago
Getting Started
User Guide
Recipes & How-Tos
Reference
Links