core.medical_claim has no diagnosis columns — normalized_code and principal_diagnosis_code live in core.condition. Added two staging steps that enrich claims before measure functions consume them: - _stg_medical_claim: LEFT JOIN rank-1 condition for principal_diagnosis_code - _stg_medical_claim_condition: INNER JOIN all conditions for MCC cohort matching Updated uamcc_int_mcc_cohort, uamcc_int_planned_admission, uamcc_int_outcome_exclusion, and uamcc_int_numerator to consume the staging tables instead of raw core.medical_claim.
1541 lines
51 KiB
Python
1541 lines
51 KiB
Python
"""CMS quality measure table models for hospital admission and readmission measures.
|
||
|
||
Covers three CMS claims-based outcome measures used in ACO REACH, MSSP, and MIPS:
|
||
|
||
UAMCC — All-Cause Unplanned Admissions for Patients with Multiple
|
||
Chronic Conditions (NQF #2888)
|
||
|
||
ACR — Risk-Standardized, All-Condition Readmission (NQF #1789),
|
||
used in ACO REACH
|
||
|
||
HWR — Hospital-wide, 30-Day, All-cause Unplanned Readmission,
|
||
used in MIPS Groups
|
||
|
||
Each measure is structured in layers:
|
||
_performance_period → measurement window
|
||
_stg_* → staging inputs from core tables
|
||
_int_* → intermediate computations
|
||
_value_set_* → static code tables from CMS value sets
|
||
<measure>_summary → final risk-standardized rate
|
||
|
||
Generated from:
|
||
dev/scripts/generate_quality_measure_docs.py
|
||
|
||
Sources:
|
||
ACOREACH_PY2025_UAMCC_MIF_posted07072025.pdf
|
||
ACOREACH_PY2025_ACR_MIF_updated07072025.pdf
|
||
ACOREACH-PY2026-UAMCC-MIF_posted10312025.pdf
|
||
ACOREACH_PY2026_ARC_MIF_posted10312025.pdf
|
||
MIPS_Hospital-Wide Readmission_2025_MIF.pdf
|
||
PY2025-MIPS-Admin-Claims-MCC-MIF.pdf
|
||
PY2026-MIPS-Admin-Claims-MCC-MIF.pdf
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from datetime import date, datetime
|
||
from decimal import Decimal
|
||
|
||
from aco.table.base import SQLTable
|
||
|
||
# ── Staging ──────────────────────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmStgMedicalClaim(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _stg_medical_claim
|
||
|
||
Medical claims enriched with the principal (rank-1) diagnosis code from
|
||
``core.condition``. Preserves the claim-line grain of
|
||
``core.medical_claim``; every line of the same claim carries the same
|
||
``principal_diagnosis_code``.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_stg_medical_claim"
|
||
|
||
claim_id: str | None = None
|
||
person_id: str | None = None
|
||
claim_start_date: date | None = None
|
||
claim_end_date: date | None = None
|
||
hcpcs_code: str | None = None
|
||
place_of_service_code: str | None = None
|
||
principal_diagnosis_code: str | None = None
|
||
|
||
|
||
class CmsQmStgMedicalClaimCondition(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _stg_medical_claim_condition
|
||
|
||
One row per (claim, diagnosis code) pair — ``core.medical_claim`` joined
|
||
to all ``core.condition`` rows. Used for MCC chronic-condition cohort
|
||
matching where every diagnosis position must be checked.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_stg_medical_claim_condition"
|
||
|
||
claim_id: str | None = None
|
||
person_id: str | None = None
|
||
claim_start_date: date | None = None
|
||
normalized_code: str | None = None
|
||
|
||
|
||
# ── UAMCC Performance Period ─────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmUamccPerformancePeriod(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_performance_period
|
||
|
||
Single-row anchor for the UAMCC measurement window.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_performance_period"
|
||
|
||
measure_id: str | None = None
|
||
"""Short measure code: UAMCC"""
|
||
|
||
measure_name: str | None = None
|
||
"""Full CMS measure name"""
|
||
|
||
nqf_id: str | None = None
|
||
"""NQF #2888"""
|
||
|
||
performance_year: int | None = None
|
||
"""Calendar performance year (e.g. 2025)"""
|
||
|
||
performance_period_begin: date | None = None
|
||
"""Start of 12-month measurement window (typically Jan 1)"""
|
||
|
||
performance_period_end: date | None = None
|
||
"""End of 12-month measurement window (typically Dec 31)"""
|
||
|
||
lookback_period_begin: date | None = None
|
||
"""Start of prior-year lookback for chronic condition identification"""
|
||
|
||
lookback_period_end: date | None = None
|
||
"""End of prior-year lookback (= performance_period_begin - 1 day)"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
# ── UAMCC Intermediate ───────────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmUamccIntMccCohort(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_int_mcc_cohort
|
||
|
||
Beneficiaries identified with each of the nine MCC chronic disease
|
||
groups during the prior-year lookback period. A beneficiary qualifies
|
||
for the UAMCC denominator when two or more distinct chronic condition
|
||
groups are present.
|
||
|
||
Nine chronic disease groups (MIF §3.9):
|
||
1. Acute myocardial infarction (AMI)
|
||
2. Alzheimer's disease and related disorders / senile dementia
|
||
3. Atrial fibrillation
|
||
4. Chronic kidney disease (CKD)
|
||
5. Chronic obstructive pulmonary disease (COPD) and asthma
|
||
6. Depression
|
||
7. Diabetes
|
||
8. Heart failure
|
||
9. Stroke and transient ischemic attack (TIA)
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_int_mcc_cohort"
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
chronic_condition_group: str | None = None
|
||
"""One of the nine disease groups: AMI, ALZHEIMER, AFib, CKD,
|
||
COPD_ASTHMA, DEPRESSION, DIABETES, HEART_FAILURE, STROKE_TIA"""
|
||
|
||
qualifying_code: str | None = None
|
||
"""ICD-10-CM diagnosis code that triggered group membership"""
|
||
|
||
qualifying_code_date: date | None = None
|
||
"""Date of the claim containing the qualifying code"""
|
||
|
||
claim_count: int | None = None
|
||
"""Number of claims with qualifying codes in lookback window"""
|
||
|
||
lookback_years: int | None = None
|
||
"""Lookback window in years required for this condition group"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmUamccIntDenominator(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_int_denominator
|
||
|
||
Medicare FFS beneficiaries who are eligible for inclusion in the
|
||
UAMCC denominator: age ≥66 at start of measurement period, two or
|
||
more distinct MCC groups identified in the lookback year, and
|
||
continuous enrollment in Medicare Parts A and B.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_int_denominator"
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
age_at_period_start: int | None = None
|
||
"""Age in years at the first day of the measurement period"""
|
||
|
||
chronic_condition_count: int | None = None
|
||
"""Count of distinct MCC groups identified in the lookback year"""
|
||
|
||
chronic_condition_groups: str | None = None
|
||
"""Pipe-delimited list of qualifying chronic condition group codes"""
|
||
|
||
has_part_a_prior_year: int | None = None
|
||
"""1 if continuous Part A enrollment during prior year"""
|
||
|
||
has_part_b_prior_year: int | None = None
|
||
"""1 if continuous Part B enrollment during prior year"""
|
||
|
||
has_part_a_measurement_year: int | None = None
|
||
"""1 if continuous Part A enrollment during measurement year"""
|
||
|
||
has_part_b_measurement_year: int | None = None
|
||
"""1 if continuous Part B enrollment during measurement year"""
|
||
|
||
first_aco_visit_date: date | None = None
|
||
"""Date of first E&M or qualifying visit with the aligned ACO"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmUamccIntDenominatorExclusion(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_int_denominator_exclusion
|
||
|
||
Beneficiaries excluded from the UAMCC denominator per MIF §3.10.
|
||
|
||
Exclusion reasons (MIF §3.10):
|
||
1. Voluntarily aligned after Jan 1 of performance year
|
||
2. Lacks 12-month continuous Part A/B enrollment in prior year
|
||
3. Lacks continuous Part A/B enrollment in measurement year
|
||
(relaxed for beneficiaries who die or enter hospice)
|
||
4. Enrolled in hospice during prior year or at period start
|
||
5. No E&M or qualifying ACO visit in measurement year or prior year
|
||
6. Not at risk for hospitalization at any point during the year
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_int_denominator_exclusion"
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
exclusion_reason: str | None = None
|
||
"""Primary reason for exclusion (matches MIF §3.10 numbered criteria)"""
|
||
|
||
voluntary_alignment_after_period_start: int | None = None
|
||
"""Flag: voluntarily aligned after Jan 1 of performance year"""
|
||
|
||
missing_prior_year_enrollment: int | None = None
|
||
"""Flag: lacks 12-month Part A/B enrollment in prior year"""
|
||
|
||
missing_measurement_year_enrollment: int | None = None
|
||
"""Flag: lacks continuous Part A/B enrollment in measurement year"""
|
||
|
||
in_hospice: int | None = None
|
||
"""Flag: enrolled in hospice during prior year or at period start"""
|
||
|
||
no_aco_visit: int | None = None
|
||
"""Flag: no qualifying visit with aligned ACO in prior or measurement year"""
|
||
|
||
no_time_at_risk: int | None = None
|
||
"""Flag: no at-risk person-time during the measurement year"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmUamccIntOutcomeExclusion(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_int_outcome_exclusion
|
||
|
||
Inpatient admissions excluded from the UAMCC outcome (numerator)
|
||
per MIF §3.7. These represent events that do not reflect the quality
|
||
of ambulatory care for patients with multiple chronic conditions.
|
||
|
||
Outcome exclusion categories (MIF §3.7):
|
||
1. Planned admissions (PAA algorithm, see _uamcc_int_planned_admission)
|
||
2. Admissions directly from SNF or acute rehabilitation facility
|
||
3. Admissions within 10-day buffer period after discharge from
|
||
hospital, SNF, or acute rehabilitation facility
|
||
4. Admissions after patient entered hospice
|
||
5. Procedure/surgery complications (CCS 145, 237, 238, 257)
|
||
6. Accidents/injuries (CCS 2601–2621)
|
||
7. Admissions before first visit with the aligned REACH ACO
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_int_outcome_exclusion"
|
||
|
||
claim_id: str | None = None
|
||
"""Inpatient claim identifier"""
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
admission_date: date | None = None
|
||
"""Admission date of the hospitalization"""
|
||
|
||
is_planned: int | None = None
|
||
"""1 if PAA algorithm classified this admission as planned"""
|
||
|
||
from_snf_or_rehab: int | None = None
|
||
"""1 if admitted directly from SNF or acute rehabilitation facility"""
|
||
|
||
in_buffer_period: int | None = None
|
||
"""1 if within 10-day buffer following a prior hospital/SNF/rehab discharge"""
|
||
|
||
in_hospice: int | None = None
|
||
"""1 if patient was enrolled in hospice at time of admission"""
|
||
|
||
is_procedure_complication: int | None = None
|
||
"""1 if principal diagnosis CCS is 145, 237, 238, or 257"""
|
||
|
||
is_injury_or_accident: int | None = None
|
||
"""1 if principal diagnosis CCS is an E-code injury category (2601–2621)"""
|
||
|
||
before_first_aco_visit: int | None = None
|
||
"""1 if admission occurred before first qualifying visit with the ACO"""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""AHRQ CCS diagnosis category of the principal discharge diagnosis"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmUamccIntPlannedAdmission(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_int_planned_admission
|
||
|
||
Output of the Planned Admission Algorithm (PAA) applied to inpatient
|
||
admissions. Implements PAA v4.0 2024 as specified in UAMCC MIF §3.7.
|
||
|
||
An admission is classified as planned if ANY of the following is true:
|
||
Rule 1 — A procedure is performed in an always-planned category
|
||
(PAA1: see _uamcc_value_set_paa1).
|
||
Rule 2 — The principal diagnosis is in an always-planned diagnosis
|
||
category (PAA2: see _uamcc_value_set_paa2).
|
||
Rule 3 — A procedure is in a potentially-planned category (PAA3)
|
||
AND the principal diagnosis is NOT an acute diagnosis
|
||
(PAA4: see _uamcc_value_set_paa3, _uamcc_value_set_paa4).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_int_planned_admission"
|
||
|
||
claim_id: str | None = None
|
||
"""Inpatient claim identifier"""
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
admission_date: date | None = None
|
||
"""Admission date"""
|
||
|
||
is_planned: int | None = None
|
||
"""1 if classified as planned by PAA algorithm; 0 otherwise"""
|
||
|
||
planned_rule: str | None = None
|
||
"""Which PAA rule triggered: RULE1, RULE2, RULE3, or None"""
|
||
|
||
triggering_ccs_procedure: str | None = None
|
||
"""CCS procedure category that triggered Rule 1 or Rule 3"""
|
||
|
||
triggering_ccs_diagnosis: str | None = None
|
||
"""CCS diagnosis category that triggered Rule 2"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmUamccIntPersonTime(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_int_person_time
|
||
|
||
At-risk person-time (in days and person-years) for each eligible
|
||
beneficiary during the measurement period.
|
||
|
||
Time excluded from at-risk calculation (MIF §3.11):
|
||
- Days spent in an inpatient hospital
|
||
- Days spent in a SNF or acute rehabilitation facility
|
||
- 10-day buffer period following each hospital/SNF/rehab discharge
|
||
- Time after entering hospice care
|
||
- Time before first qualifying visit with the aligned ACO
|
||
(unless the beneficiary had a prior-year visit)
|
||
|
||
Person-years = at_risk_days / 365.25
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_int_person_time"
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
at_risk_days: int | None = None
|
||
"""Total days at risk during the measurement period"""
|
||
|
||
person_years: Decimal | None = None
|
||
"""at_risk_days / 365.25"""
|
||
|
||
days_in_hospital: int | None = None
|
||
"""Days spent in an inpatient setting (excluded from at-risk)"""
|
||
|
||
days_in_snf_rehab: int | None = None
|
||
"""Days in SNF or acute rehabilitation (excluded from at-risk)"""
|
||
|
||
days_in_buffer: int | None = None
|
||
"""Days in 10-day post-discharge buffer (excluded from at-risk)"""
|
||
|
||
days_in_hospice: int | None = None
|
||
"""Days enrolled in hospice benefit (excluded from at-risk)"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmUamccIntNumerator(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_int_numerator
|
||
|
||
Unplanned acute inpatient admissions for each eligible beneficiary
|
||
during the measurement period, after applying all outcome exclusions.
|
||
|
||
The UAMCC outcome is a rate of admissions per 100 person-years,
|
||
not a simple proportion. Each eligible, non-excluded inpatient
|
||
admission counts as one event in the numerator.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_int_numerator"
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
claim_id: str | None = None
|
||
"""Inpatient claim for the unplanned admission"""
|
||
|
||
admission_date: date | None = None
|
||
"""Admission date of the qualifying unplanned admission"""
|
||
|
||
discharge_date: date | None = None
|
||
"""Discharge date"""
|
||
|
||
principal_diagnosis_code: str | None = None
|
||
"""ICD-10-CM principal discharge diagnosis code"""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""AHRQ CCS diagnosis category"""
|
||
|
||
unplanned_admission_flag: int | None = None
|
||
"""1 = counts in numerator (unplanned, non-excluded)"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmUamccSummary(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: uamcc_summary
|
||
|
||
ACO- or provider-level UAMCC performance summary: observed
|
||
admission count, at-risk person-years, observed rate, and
|
||
risk-standardized acute admission rate (RSAAR) per 100 person-years.
|
||
|
||
Lower RSAAR indicates better performance. The RSAAR is computed
|
||
using a hierarchical (two-level) negative-binomial model that
|
||
adjusts for 47 demographic, clinical, and social risk factors
|
||
(MIF §3.12).
|
||
|
||
NQF ID: #2888 (ACO RSAAR Quality Measure)
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "uamcc_summary"
|
||
|
||
aco_id: str | None = None
|
||
"""ACO or clinician group identifier"""
|
||
|
||
program: str | None = None
|
||
"""Payment program: REACH, MIPS, MSSP"""
|
||
|
||
performance_year: int | None = None
|
||
"""Calendar year"""
|
||
|
||
denominator_count: int | None = None
|
||
"""Eligible beneficiaries in denominator"""
|
||
|
||
total_person_years: Decimal | None = None
|
||
"""Total at-risk person-years for denominator beneficiaries"""
|
||
|
||
observed_admissions: int | None = None
|
||
"""Count of qualifying unplanned admissions"""
|
||
|
||
observed_rate_per_100: Decimal | None = None
|
||
"""Crude observed rate: (observed_admissions / total_person_years) * 100"""
|
||
|
||
expected_admissions: Decimal | None = None
|
||
"""Expected admissions based on risk-adjustment model"""
|
||
|
||
rsaar: Decimal | None = None
|
||
"""Risk-standardized acute admission rate per 100 person-years"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
# ── UAMCC Value Sets ─────────────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmUamccValueSetCohort(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_cohort
|
||
|
||
ICD-10-CM diagnosis codes defining the nine MCC chronic condition
|
||
groups used to identify eligible beneficiaries for the UAMCC
|
||
denominator. Sourced from the 'UAMCC Cohort' tab of the value set
|
||
workbook.
|
||
|
||
Eight of the nine groups use CMS Chronic Conditions Data Warehouse
|
||
(CCW) algorithms. The diabetes group uses the ACO-36 v2018a
|
||
definition. COPD and asthma are combined into a single group.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_cohort"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
chronic_condition_group: str | None = None
|
||
"""Chronic condition group name (e.g. AMI, ALZHEIMER, AFib)"""
|
||
|
||
icd_10_cm: str | None = None
|
||
"""ICD-10-CM diagnosis code"""
|
||
|
||
label: str | None = None
|
||
"""Code description"""
|
||
|
||
claims_to_qualify: str | None = None
|
||
"""Number/type of claims required to qualify (e.g. '1 inpatient OR 2 outpatient')"""
|
||
|
||
diagnoses_used: str | None = None
|
||
"""Claim field(s) used: principal/secondary diagnosis"""
|
||
|
||
lookback_years: int | None = None
|
||
"""Lookback window in years"""
|
||
|
||
additional_notes: str | None = None
|
||
"""Supplemental specification notes"""
|
||
|
||
|
||
class CmsQmUamccValueSetExclusions(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_exclusions
|
||
|
||
AHRQ CCS diagnosis categories used as outcome exclusions in the
|
||
UAMCC numerator. Sourced from the 'UAMCC Exclusions' tab.
|
||
|
||
Covers two exclusion groups:
|
||
• Complications of procedures/surgeries (CCS 145, 237, 238, 257)
|
||
• Accidents/injuries (CCS E-code categories 2601–2621)
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_exclusions"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
exclusion_category: str | None = None
|
||
"""High-level group: 'Complications' or 'Accidents/Injuries'"""
|
||
|
||
code_type: str | None = None
|
||
"""'CCS' or 'ICD-10'"""
|
||
|
||
category_or_code: str | None = None
|
||
"""CCS category number or ICD-10 code"""
|
||
|
||
description: str | None = None
|
||
"""Human-readable description"""
|
||
|
||
procedure_or_diagnosis: str | None = None
|
||
"""'Diagnosis' or 'Procedure'"""
|
||
|
||
|
||
class CmsQmUamccValueSetPaa1(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_paa1
|
||
|
||
PAA Table 1: CCS procedure categories that are ALWAYS considered
|
||
planned regardless of the principal diagnosis. An admission with
|
||
any procedure in these categories is classified as planned (Rule 1).
|
||
|
||
Source: 'UAMCC PAA1' tab — PAA v4.0 2024 (5 categories including
|
||
bone marrow transplant, kidney transplant, and major organ transplants).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_paa1"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_procedure_category: str | None = None
|
||
"""CCS procedure category code"""
|
||
|
||
description: str | None = None
|
||
"""Procedure category description"""
|
||
|
||
|
||
class CmsQmUamccValueSetPaa2(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_paa2
|
||
|
||
PAA Table 2: CCS diagnosis categories that make a principal discharge
|
||
diagnosis ALWAYS planned (Rule 2).
|
||
|
||
Source: 'UAMCC PAA2' tab — includes maintenance chemotherapy /
|
||
radiotherapy (CCS 45) and rehabilitation care (CCS 254).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_paa2"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""CCS diagnosis category code"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis category description"""
|
||
|
||
|
||
class CmsQmUamccValueSetPaa3(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_paa3
|
||
|
||
PAA Table 3: CCS procedure categories and individual ICD-10-PCS
|
||
codes that are POTENTIALLY planned (Rule 3). These trigger a
|
||
planned classification only when the principal diagnosis is NOT
|
||
an acute diagnosis (see PAA4).
|
||
|
||
Source: 'UAMCC PAA3' tab (~2,705 ICD-10-PCS codes).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_paa3"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
code_type: str | None = None
|
||
"""'CCS' for CCS category or 'ICD-10-PCS' for individual code"""
|
||
|
||
category_or_code: str | None = None
|
||
"""CCS procedure category number or ICD-10-PCS code"""
|
||
|
||
description: str | None = None
|
||
"""Procedure description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS category (for individual ICD-10-PCS codes only)"""
|
||
|
||
|
||
class CmsQmUamccValueSetPaa4(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_paa4
|
||
|
||
PAA Table 4: CCS diagnosis categories and individual ICD-10-CM
|
||
codes representing ACUTE diagnoses that override a potentially-
|
||
planned procedure (Rule 3 negation). If the principal discharge
|
||
diagnosis is in this list, the admission is NOT planned even if a
|
||
potentially-planned procedure was performed.
|
||
|
||
Source: 'UAMCC PAA4' tab (~11,369 ICD-10-CM codes).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_paa4"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
code_type: str | None = None
|
||
"""'CCS' or 'ICD-10-CM'"""
|
||
|
||
category_or_code: str | None = None
|
||
"""CCS diagnosis category or ICD-10-CM code"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS category (for individual ICD-10-CM codes only)"""
|
||
|
||
|
||
class CmsQmUamccValueSetCcsIcd10Cm(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_ccs_icd10_cm
|
||
|
||
Crosswalk from ICD-10-CM diagnosis codes to AHRQ CCS diagnosis
|
||
categories (Yale-modified version based on v2019.1 beta).
|
||
|
||
Source: 'UAMCC CCS-ICD10CM' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_ccs_icd10_cm"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
icd_10_cm: str | None = None
|
||
"""ICD-10-CM diagnosis code"""
|
||
|
||
description: str | None = None
|
||
"""ICD-10-CM code description"""
|
||
|
||
ccs_category: str | None = None
|
||
"""AHRQ CCS diagnosis category number"""
|
||
|
||
ccs_description: str | None = None
|
||
"""CCS category description"""
|
||
|
||
|
||
class CmsQmUamccValueSetCcsIcd10Pcs(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _uamcc_value_set_ccs_icd10_pcs
|
||
|
||
Crosswalk from ICD-10-PCS procedure codes to AHRQ CCS procedure
|
||
categories.
|
||
|
||
Source: 'UAMCC CCS-ICD10PCS' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_uamcc_value_set_ccs_icd10_pcs"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
icd_10_pcs: str | None = None
|
||
"""ICD-10-PCS procedure code"""
|
||
|
||
description: str | None = None
|
||
"""ICD-10-PCS code description"""
|
||
|
||
ccs_category: str | None = None
|
||
"""AHRQ CCS procedure category number"""
|
||
|
||
ccs_description: str | None = None
|
||
"""CCS category description"""
|
||
|
||
|
||
# ── ACR Performance Period ───────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmAcrPerformancePeriod(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_performance_period
|
||
|
||
Single-row anchor for the ACR measurement window.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_performance_period"
|
||
|
||
measure_id: str | None = None
|
||
"""Short measure code: ACR"""
|
||
|
||
measure_name: str | None = None
|
||
"""Full CMS measure name"""
|
||
|
||
nqf_id: str | None = None
|
||
"""NQF #1789"""
|
||
|
||
performance_year: int | None = None
|
||
"""Calendar performance year"""
|
||
|
||
performance_period_begin: date | None = None
|
||
"""Start of 12-month measurement window"""
|
||
|
||
performance_period_end: date | None = None
|
||
"""End of 12-month measurement window"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
# ── ACR Intermediate ─────────────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmAcrIntIndexAdmission(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_int_index_admission
|
||
|
||
Eligible index hospitalizations forming the ACR denominator.
|
||
|
||
Inclusion criteria (MIF §3.8–3.9):
|
||
1. Patient ≥65 years of age
|
||
2. Enrolled in Medicare FFS Part A (12 months prior + 30 days post)
|
||
3. Discharged from a non-federal, short-stay acute-care or
|
||
critical access hospital
|
||
4. Discharged alive (not died in hospital)
|
||
5. Not transferred to another acute care facility upon discharge
|
||
|
||
Admissions for all principal diagnoses are included unless a
|
||
cohort-level exclusion applies (see _acr_value_set_exclusions).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_int_index_admission"
|
||
|
||
encounter_id: str | None = None
|
||
"""Hospital encounter identifier"""
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
admission_date: date | None = None
|
||
"""Date of hospital admission"""
|
||
|
||
discharge_date: date | None = None
|
||
"""Date of hospital discharge"""
|
||
|
||
discharge_disposition_code: str | None = None
|
||
"""UB-04 discharge status code"""
|
||
|
||
facility_id: str | None = None
|
||
"""CMS Certification Number (CCN) of the hospital"""
|
||
|
||
principal_diagnosis_code: str | None = None
|
||
"""ICD-10-CM principal discharge diagnosis code"""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""AHRQ CCS diagnosis category of principal diagnosis"""
|
||
|
||
drg_code_type: str | None = None
|
||
"""DRG type: MS-DRG or APR-DRG"""
|
||
|
||
drg_code: str | None = None
|
||
"""DRG code"""
|
||
|
||
age_at_admission: int | None = None
|
||
"""Patient age in years at admission date"""
|
||
|
||
exclusion_flag: int | None = None
|
||
"""1 if encounter is excluded from the denominator"""
|
||
|
||
exclusion_reason: str | None = None
|
||
"""CCS category or reason code for denominator exclusion"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmAcrIntSpecialtyCohort(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_int_specialty_cohort
|
||
|
||
CCS-based specialty cohort assignment for each index admission.
|
||
|
||
Each admission is assigned to one of five mutually exclusive cohorts
|
||
(MIF §3.9):
|
||
1. Surgery/Gynecology — presence of an eligible surgical ICD-10-PCS
|
||
procedure code (from _acr_value_set_cohort_icd10), regardless
|
||
of principal diagnosis
|
||
2. Cardiorespiratory — principal diagnosis CCS maps to cardiorespiratory
|
||
cohort (from _acr_value_set_cohort_ccs)
|
||
3. Cardiovascular — principal diagnosis CCS maps to cardiovascular cohort
|
||
4. Neurology — principal diagnosis CCS maps to neurology cohort
|
||
5. Medicine — default cohort for all remaining admissions
|
||
|
||
Priority: Surgery/Gynecology always wins over diagnosis-based cohorts.
|
||
Among diagnosis-based cohorts, the first match in the CCS cohort table wins.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_int_specialty_cohort"
|
||
|
||
encounter_id: str | None = None
|
||
"""Hospital encounter identifier"""
|
||
|
||
specialty_cohort: str | None = None
|
||
"""One of: SURGERY_GYNECOLOGY, CARDIORESPIRATORY, CARDIOVASCULAR,
|
||
NEUROLOGY, MEDICINE"""
|
||
|
||
cohort_assignment_rule: str | None = None
|
||
"""ICD10_PCS (surgery from procedure code), CCS_PROCEDURE,
|
||
CCS_DIAGNOSIS, or DEFAULT_MEDICINE"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmAcrIntPlannedReadmission(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_int_planned_readmission
|
||
|
||
Output of the Planned Readmission Algorithm (PAA v4.0) applied to
|
||
candidate readmissions within 30 days of an index discharge.
|
||
|
||
A readmission is classified as planned if ANY of the following is
|
||
true (MIF §3.7):
|
||
Rule 1 — A procedure performed at the readmission is in an
|
||
always-planned category (PAA PA1).
|
||
Rule 2 — The principal diagnosis at the readmission is in an
|
||
always-planned diagnosis category (PAA PA2).
|
||
Rule 3 — A procedure at the readmission is potentially-planned
|
||
(PAA PA3) AND the principal diagnosis is NOT an acute
|
||
diagnosis (PAA PA4).
|
||
|
||
Psychiatric and rehabilitation facility readmissions are always
|
||
excluded from the outcome regardless of planned status.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_int_planned_readmission"
|
||
|
||
index_encounter_id: str | None = None
|
||
"""Index admission encounter identifier"""
|
||
|
||
readmission_encounter_id: str | None = None
|
||
"""Candidate readmission encounter identifier"""
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
index_discharge_date: date | None = None
|
||
"""Discharge date of the index admission"""
|
||
|
||
readmission_date: date | None = None
|
||
"""Admission date of the candidate readmission"""
|
||
|
||
days_to_readmission: int | None = None
|
||
"""Calendar days from index discharge to readmission admission"""
|
||
|
||
is_within_30_days: int | None = None
|
||
"""1 if readmission_date - index_discharge_date <= 30"""
|
||
|
||
is_planned: int | None = None
|
||
"""1 if classified as planned by PAA; 0 = unplanned"""
|
||
|
||
planned_rule: str | None = None
|
||
"""RULE1, RULE2, RULE3, or None"""
|
||
|
||
is_psychiatric_or_rehab: int | None = None
|
||
"""1 if readmission facility is psychiatric or rehabilitation"""
|
||
|
||
unplanned_readmission_flag: int | None = None
|
||
"""1 if within 30 days, not planned, and not psych/rehab"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmAcrSummary(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: acr_summary
|
||
|
||
ACO- or provider-level ACR performance summary: observed readmission
|
||
rate and risk-standardized readmission rate (RSRR) per 100 index
|
||
admissions.
|
||
|
||
Lower RSRR indicates better performance. The RSRR adjusts for
|
||
stay-level factors and clinical/demographic characteristics using a
|
||
hierarchical logistic model (MIF §3.12).
|
||
|
||
NQF ID: #1789 (ACO RSRR Quality Measure)
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "acr_summary"
|
||
|
||
aco_id: str | None = None
|
||
"""ACO or clinician group identifier"""
|
||
|
||
program: str | None = None
|
||
"""Payment program: REACH, MIPS, MSSP"""
|
||
|
||
performance_year: int | None = None
|
||
"""Calendar year"""
|
||
|
||
denominator_count: int | None = None
|
||
"""Eligible index admissions"""
|
||
|
||
observed_readmissions: int | None = None
|
||
"""Count of unplanned 30-day readmissions"""
|
||
|
||
observed_rate: Decimal | None = None
|
||
"""Crude observed rate: observed_readmissions / denominator_count"""
|
||
|
||
expected_readmissions: Decimal | None = None
|
||
"""Model-expected readmissions based on risk adjustment"""
|
||
|
||
rsrr: Decimal | None = None
|
||
"""Risk-standardized readmission rate (proportion, not per 100)"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
# ── ACR Value Sets ───────────────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmAcrValueSetCohortCcs(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_value_set_cohort_ccs
|
||
|
||
CCS-based cohort inclusion codes for ACR specialty cohort assignment.
|
||
Diagnosis CCS categories that map admissions to one of the five
|
||
specialty cohorts (Cardiorespiratory, Cardiovascular, Neurology,
|
||
Medicine, Surgery/Gynecology via diagnosis).
|
||
|
||
Source: 'ACR Cohort CCS' tab (~279 CCS entries).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_value_set_cohort_ccs"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_category: str | None = None
|
||
"""CCS category number (index claim)"""
|
||
|
||
description: str | None = None
|
||
"""CCS category description"""
|
||
|
||
specialty_cohort: str | None = None
|
||
"""Target cohort: CARDIORESPIRATORY, CARDIOVASCULAR, NEUROLOGY,
|
||
MEDICINE, or SURGERY_GYNECOLOGY"""
|
||
|
||
procedure_or_diagnosis: str | None = None
|
||
"""'Procedure' or 'Diagnosis'"""
|
||
|
||
principal_diagnosis_code: int | None = None
|
||
"""1 if applies to principal diagnosis position only"""
|
||
|
||
procedure_code: int | None = None
|
||
"""1 if applies to any procedure position"""
|
||
|
||
|
||
class CmsQmAcrValueSetCohortIcd10(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_value_set_cohort_icd10
|
||
|
||
ICD-10-PCS procedure codes that assign an admission to the
|
||
Surgery/Gynecology specialty cohort, regardless of principal
|
||
diagnosis.
|
||
|
||
Source: 'ACR Cohort ICD-10' tab (~1,683 ICD-10-PCS codes).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_value_set_cohort_icd10"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
icd_10_pcs: str | None = None
|
||
"""ICD-10-PCS procedure code (any procedure position on index claim)"""
|
||
|
||
description: str | None = None
|
||
"""Procedure description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS procedure category"""
|
||
|
||
specialty_cohort: str | None = None
|
||
"""Always SURGERY_GYNECOLOGY"""
|
||
|
||
|
||
class CmsQmAcrValueSetExclusions(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_value_set_exclusions
|
||
|
||
CCS diagnosis categories excluded from the ACR denominator
|
||
(index admissions). Principal diagnoses in these categories
|
||
are excluded because readmission rates for these conditions do
|
||
not reflect the care quality of ambulatory providers.
|
||
|
||
Source: 'ACR Exclusions' tab (~49 entries).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_value_set_exclusions"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""CCS diagnosis category of the index claim principal diagnosis"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis category description"""
|
||
|
||
exclusion_category: str | None = None
|
||
"""High-level grouping of the exclusion reason"""
|
||
|
||
|
||
class CmsQmAcrValueSetPaa1(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_value_set_paa1
|
||
|
||
PAA PA1: CCS procedure categories always considered planned for the
|
||
ACR readmission algorithm (Rule 1).
|
||
|
||
Source: 'ACR PAA PA1' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_value_set_paa1"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_procedure_category: str | None = None
|
||
"""CCS procedure category (readmission claim, any procedure position)"""
|
||
|
||
description: str | None = None
|
||
"""Procedure category description"""
|
||
|
||
|
||
class CmsQmAcrValueSetPaa2(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_value_set_paa2
|
||
|
||
PAA PA2: CCS diagnosis categories that make the principal discharge
|
||
diagnosis always planned for ACR (Rule 2).
|
||
|
||
Source: 'ACR PAA PA2' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_value_set_paa2"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""CCS diagnosis category (readmission claim, principal diagnosis)"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis category description"""
|
||
|
||
|
||
class CmsQmAcrValueSetPaa3(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_value_set_paa3
|
||
|
||
PAA PA3: Potentially-planned procedure categories for ACR (Rule 3
|
||
trigger). ~2,701 ICD-10-PCS codes and CCS procedure categories.
|
||
|
||
Source: 'ACR PAA PA3' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_value_set_paa3"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
code_type: str | None = None
|
||
"""'CCS' or 'ICD-10-PCS'"""
|
||
|
||
category_or_code: str | None = None
|
||
"""CCS procedure category or ICD-10-PCS code"""
|
||
|
||
description: str | None = None
|
||
"""Procedure description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS category (individual ICD-10-PCS codes only)"""
|
||
|
||
|
||
class CmsQmAcrValueSetPaa4(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _acr_value_set_paa4
|
||
|
||
PAA PA4: Acute diagnosis codes that override a potentially-planned
|
||
procedure, making the readmission unplanned (Rule 3 negation).
|
||
~11,369 ICD-10-CM codes.
|
||
|
||
Source: 'ACR PAA PA4' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_acr_value_set_paa4"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
code_type: str | None = None
|
||
"""'CCS' or 'ICD-10-CM'"""
|
||
|
||
category_or_code: str | None = None
|
||
"""CCS diagnosis category or ICD-10-CM code"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS category (individual ICD-10-CM codes only)"""
|
||
|
||
|
||
# ── HWR Performance Period ───────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmHwrPerformancePeriod(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_performance_period
|
||
|
||
Single-row anchor for the MIPS HWR measurement window.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_performance_period"
|
||
|
||
measure_id: str | None = None
|
||
"""Short measure code: HWR"""
|
||
|
||
measure_name: str | None = None
|
||
"""Full measure name"""
|
||
|
||
performance_year: int | None = None
|
||
"""MIPS performance year (calendar year)"""
|
||
|
||
performance_period_begin: date | None = None
|
||
"""Jan 1 of the performance year"""
|
||
|
||
performance_period_end: date | None = None
|
||
"""Dec 31 of the performance year"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
# ── HWR Intermediate ─────────────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmHwrIntDenominator(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_int_denominator
|
||
|
||
Eligible hospitalizations for the MIPS HWR denominator.
|
||
|
||
Inclusion criteria (MIPS HWR MIF Section E):
|
||
1. Medicare FFS beneficiary aged ≥65 years
|
||
2. Enrolled in Medicare FFS Part A for 12 months prior to
|
||
admission and 30 days after discharge
|
||
3. Discharged from a non-federal, short-stay acute-care or
|
||
critical access hospital during the performance period
|
||
4. Discharged alive
|
||
5. Not transferred to another acute care facility
|
||
|
||
A hospitalization that is a readmission for a prior stay may also
|
||
count as a new index admission if it independently meets inclusion
|
||
criteria.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_int_denominator"
|
||
|
||
encounter_id: str | None = None
|
||
"""Hospital encounter identifier"""
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
admission_date: date | None = None
|
||
"""Hospital admission date"""
|
||
|
||
discharge_date: date | None = None
|
||
"""Hospital discharge date"""
|
||
|
||
discharge_disposition_code: str | None = None
|
||
"""UB-04 discharge status code"""
|
||
|
||
facility_id: str | None = None
|
||
"""CMS Certification Number of the hospital"""
|
||
|
||
principal_diagnosis_code: str | None = None
|
||
"""ICD-10-CM principal discharge diagnosis"""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""AHRQ CCS diagnosis category"""
|
||
|
||
specialty_cohort: str | None = None
|
||
"""One of: SURGERY_GYNECOLOGY, CARDIORESPIRATORY, CARDIOVASCULAR,
|
||
NEUROLOGY, MEDICINE"""
|
||
|
||
exclusion_flag: int | None = None
|
||
"""1 if excluded from denominator"""
|
||
|
||
exclusion_reason: str | None = None
|
||
"""CCS category or reason code for exclusion"""
|
||
|
||
attributed_tin: str | None = None
|
||
"""TIN of the attributed MIPS clinician group"""
|
||
|
||
attribution_role: str | None = None
|
||
"""DISCHARGE_CLINICIAN, PRIMARY_INPATIENT, or OUTPATIENT_PCP"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmHwrIntPlannedReadmission(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_int_planned_readmission
|
||
|
||
Planned readmission classification for HWR using the same PAA v4.0
|
||
algorithm as ACR. MIPS HWR and ACO REACH ACR share identical PAA
|
||
logic and value sets.
|
||
|
||
An unplanned readmission within 30 days of an eligible index
|
||
discharge counts in the HWR numerator. Readmissions to psychiatric
|
||
or rehabilitation facilities are always excluded.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_int_planned_readmission"
|
||
|
||
index_encounter_id: str | None = None
|
||
"""Index admission encounter identifier"""
|
||
|
||
readmission_encounter_id: str | None = None
|
||
"""Candidate readmission encounter identifier"""
|
||
|
||
person_id: str | None = None
|
||
"""Beneficiary identifier"""
|
||
|
||
days_to_readmission: int | None = None
|
||
"""Days from index discharge to readmission admission"""
|
||
|
||
is_within_30_days: int | None = None
|
||
"""1 if within 30-day window"""
|
||
|
||
is_planned: int | None = None
|
||
"""1 if classified as planned by PAA"""
|
||
|
||
is_psychiatric_or_rehab: int | None = None
|
||
"""1 if readmission facility is psychiatric or rehabilitation"""
|
||
|
||
unplanned_readmission_flag: int | None = None
|
||
"""1 = counts in HWR numerator"""
|
||
|
||
attributed_tin: str | None = None
|
||
"""TIN attribution for the readmission"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
class CmsQmHwrSummary(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: hwr_summary
|
||
|
||
MIPS clinician group HWR performance summary.
|
||
|
||
The HWR measure attributes readmissions to three types of clinician
|
||
groups (HWR MIF Section H):
|
||
1. Discharge Clinician Group — billed discharge procedure within
|
||
last 3 days of the hospital stay
|
||
2. Primary Inpatient Care Provider Group — billed most charges
|
||
during the hospitalization
|
||
3. Outpatient Primary Care Physician Group — greatest number of
|
||
primary care E&M visits in the 12 months prior to admission
|
||
|
||
The risk-standardized readmission rate (RSRR) is calculated using a
|
||
hierarchical logistic model identical to the ACR methodology.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "hwr_summary"
|
||
|
||
tin: str | None = None
|
||
"""Taxpayer Identification Number of the MIPS clinician group"""
|
||
|
||
performance_year: int | None = None
|
||
"""MIPS performance year"""
|
||
|
||
attribution_role: str | None = None
|
||
"""DISCHARGE_CLINICIAN, PRIMARY_INPATIENT, or OUTPATIENT_PCP"""
|
||
|
||
denominator_count: int | None = None
|
||
"""Eligible index admissions attributed to this group"""
|
||
|
||
observed_readmissions: int | None = None
|
||
"""Unplanned 30-day readmissions"""
|
||
|
||
observed_rate: Decimal | None = None
|
||
"""Crude rate: observed_readmissions / denominator_count"""
|
||
|
||
expected_readmissions: Decimal | None = None
|
||
"""Model-expected readmissions"""
|
||
|
||
rsrr: Decimal | None = None
|
||
"""Risk-standardized readmission rate"""
|
||
|
||
pipeline_last_run: datetime | None = None
|
||
|
||
|
||
# ── HWR Value Sets ───────────────────────────────────────────────────────────
|
||
|
||
|
||
class CmsQmHwrValueSetSpecialtyCohort(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_value_set_specialty_cohort
|
||
|
||
CCS-based cohort inclusion codes for HWR specialty cohort assignment.
|
||
Parallel to _acr_value_set_cohort_ccs but maintained separately by
|
||
CMS for the MIPS HWR program.
|
||
|
||
Source: '1. HWR Specialty Cohort Incls' tab (~278 entries).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_value_set_specialty_cohort"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_category: str | None = None
|
||
"""CCS category number (index claim)"""
|
||
|
||
description: str | None = None
|
||
"""CCS category description"""
|
||
|
||
specialty_cohort: str | None = None
|
||
"""Target cohort"""
|
||
|
||
procedure_or_diagnosis: str | None = None
|
||
"""'Procedure' or 'Diagnosis'"""
|
||
|
||
principal_diagnosis_code: int | None = None
|
||
"""1 if applies to principal diagnosis only"""
|
||
|
||
procedure_code: int | None = None
|
||
"""1 if applies to any procedure position"""
|
||
|
||
|
||
class CmsQmHwrValueSetSurgGynCohort(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_value_set_surg_gyn_cohort
|
||
|
||
ICD-10-PCS procedure codes that trigger Surgery/Gynecology cohort
|
||
assignment for HWR, regardless of principal diagnosis.
|
||
|
||
Source: '2. HWR Surg_Gyn Cohort Incls' tab (~1,685 ICD-10-PCS codes).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_value_set_surg_gyn_cohort"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
icd_10_pcs: str | None = None
|
||
"""ICD-10-PCS code (index claim, any procedure position)"""
|
||
|
||
description: str | None = None
|
||
"""Procedure description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS procedure category"""
|
||
|
||
specialty_cohort: str | None = None
|
||
"""Always SURGERY_GYNECOLOGY"""
|
||
|
||
|
||
class CmsQmHwrValueSetCohortExclusions(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_value_set_cohort_exclusions
|
||
|
||
CCS diagnosis categories excluded from the HWR denominator.
|
||
Principal diagnoses in these categories are excluded because their
|
||
readmission rates are considered outside the scope of clinician
|
||
group accountability.
|
||
|
||
Source: '3. HWR Cohort Exclusions' tab (~231 entries).
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_value_set_cohort_exclusions"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""CCS diagnosis category of the index claim principal diagnosis"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis category description"""
|
||
|
||
exclusion_category: str | None = None
|
||
"""High-level exclusion grouping"""
|
||
|
||
|
||
class CmsQmHwrValueSetPaa1(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_value_set_paa1
|
||
|
||
PAA PR.1: Always-planned procedure categories for HWR (Rule 1).
|
||
|
||
Source: 'PR.1 Always Planned Px' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_value_set_paa1"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_procedure_category: str | None = None
|
||
"""CCS procedure category (readmission claim, any procedure position)"""
|
||
|
||
description: str | None = None
|
||
"""Procedure category description"""
|
||
|
||
|
||
class CmsQmHwrValueSetPaa2(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_value_set_paa2
|
||
|
||
PAA PR.2: Always-planned diagnosis categories for HWR (Rule 2).
|
||
|
||
Source: 'PR.2 Always Planned Dx' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_value_set_paa2"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
ccs_diagnosis_category: str | None = None
|
||
"""CCS diagnosis category (readmission claim, principal diagnosis)"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis category description"""
|
||
|
||
|
||
class CmsQmHwrValueSetPaa3(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_value_set_paa3
|
||
|
||
PAA PR.3: Potentially-planned procedure codes for HWR (Rule 3 trigger).
|
||
|
||
Source: 'PR.3 Pot Planned Px' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_value_set_paa3"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
code_type: str | None = None
|
||
"""'CCS' or 'ICD-10-PCS'"""
|
||
|
||
category_or_code: str | None = None
|
||
"""CCS procedure category or ICD-10-PCS code"""
|
||
|
||
description: str | None = None
|
||
"""Procedure description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS category (individual ICD-10-PCS codes only)"""
|
||
|
||
|
||
class CmsQmHwrValueSetPaa4(SQLTable):
|
||
"""Schema: cms_quality_measures / Table: _hwr_value_set_paa4
|
||
|
||
PAA PR.4: Acute diagnosis codes that negate a potentially-planned
|
||
procedure for HWR (Rule 3 negation).
|
||
|
||
Source: 'PR.4 Acute Dx' tab.
|
||
"""
|
||
|
||
__schema__ = "cms_quality_measures"
|
||
__tablename__ = "_hwr_value_set_paa4"
|
||
performance_year: int | None = None
|
||
"""Performance year this value set applies to (e.g. 2025, 2026).
|
||
Used to distinguish value sets across measurement years."""
|
||
|
||
code_type: str | None = None
|
||
"""'CCS' or 'ICD-10-CM'"""
|
||
|
||
category_or_code: str | None = None
|
||
"""CCS diagnosis category or ICD-10-CM code"""
|
||
|
||
description: str | None = None
|
||
"""Diagnosis description"""
|
||
|
||
associated_ccs_category: str | None = None
|
||
"""Parent CCS category (individual ICD-10-CM codes only)"""
|