-- The 1% penalty: which hospitals lose Medicare pay for hospital-acquired conditions, FY2026
-- Fonteum reproducible query — https://fonteum.com/research/hospital-acquired-condition-penalties-2026
-- Data as of: 2026-06-03  ·  methodology: cms-hac-reduction-program/v1
-- Source datasets: CMS Hospital Compare
-- Run against the frozen federal snapshot to reproduce the published figures.
-- License: U.S. Government Works (federal sources; 17 U.S.C. §105).

-- Which hospitals lose Medicare pay for hospital-acquired conditions, and how
-- the single composite penalty hides very different infection problems.
-- Fully reproducible query.
--
-- Question: Medicare's Hospital-Acquired Condition (HAC) Reduction Program
-- (ACA Sec. 3008) cuts 1% of every Medicare fee-for-service payment from the
-- worst-performing quartile of acute-care hospitals, ranked by a single total
-- HAC score. For FY2026: how many hospitals are cut, which hospital-acquired
-- infections are least controlled, and where do penalties land? The lead
-- figure: 719 of 3,055 hospitals (23.5%) take the 1% reduction. A HAC penalty
-- is a RELATIVE ranking against the field, NOT an absolute safety verdict or a
-- statement about any hospital's care.
--
-- Source:
--   public.hac_reduction_program — CMS "Hospital-Acquired Condition Reduction
--     Program" public-use file, published via the CMS provider data catalog as
--     part of Hospital Care Compare. 3,055 hospitals, fiscal year 2026;
--     source_release_date 2026-06-03. Public, read-only.
--     License: US-Government-Works (17 U.S.C. Sec. 105).
--     methodology_version = 'cms-hac-reduction-program/v1'.
--
-- Universe: this study reads the FY2026 program file AS A WHOLE — every row is
--   one acute-care hospital scored for the fiscal year. The file is the current
--   program year, not a longitudinal history, so figures are counts/percentiles
--   within one cycle and are not modeled as a trend.
--
-- Measure note: the total HAC score folds in the PSI-90 patient-safety
--   composite plus five standardized infection ratios (SIRs) from CDC NHSN —
--   CLABSI, CAUTI, SSI, CDI, MRSA. An SIR > 1.0 means more infections than the
--   national baseline predicts; < 1.0 means fewer. Each infection is reported
--   by a different subset of hospitals (small hospitals are exempt below a case
--   threshold), so each measure carries its own denominator below. The CMS
--   facility id is a CCN; the CCN-to-entity-graph link is deferred and no
--   individual hospital is named in the study.

-- ============================================================================
-- (1) Universe reconciliation — the FY2026 program file at a glance.
-- ============================================================================
SELECT
  count(*)                                                          AS hospitals,
  count(DISTINCT facility_id)                                       AS distinct_facilities,
  count(DISTINCT state)                                             AS states,
  count(*) FILTER (WHERE total_hac_score IS NULL)                   AS no_total_score,
  min(fiscal_year)                                                  AS fy,
  max(source_release_date)                                          AS snapshot
FROM public.hac_reduction_program;
--  hospitals 3,055 · distinct_facilities 3,055 · states 51 · no_total_score 126
--  fy 2026 · snapshot 2026-06-03

-- ============================================================================
-- (2) HEADLINE: how many hospitals are penalized. The 1% cut falls on the
--     worst-performing quartile by total HAC score, so payment_reduction = 'Yes'
--     is exactly the in_worst_quartile set (the two fields agree). ~1 in 4
--     hospitals is cut every year by the program's own design.
-- ============================================================================
SELECT
  payment_reduction,
  count(*)                                                          AS hospitals,
  round(100.0 * count(*) / sum(count(*)) OVER (), 1)                AS pct_of_all,
  count(*) FILTER (WHERE in_worst_quartile)                         AS also_worst_quartile
FROM public.hac_reduction_program
GROUP BY payment_reduction
ORDER BY hospitals DESC;
--  No   2,293  75.1%   (worst_quartile 0)
--  Yes    719  23.5%   (worst_quartile 719)  <- the 1% penalty cohort
--  NULL    43   1.4%   (worst_quartile 0)

-- ============================================================================
-- (3) The composite hides the infections. For each of the five tracked
--     hospital-acquired infections: how many reporting hospitals sit ABOVE the
--     national baseline (SIR > 1.0), and the median SIR. Surgical-site
--     infections are the laggard (35.6% above baseline); C. difficile the best
--     controlled (4.0%). Every median is below 1.0 — the typical hospital beats
--     the baseline on every measure, yet a fixed quartile is still penalized.
-- ============================================================================
SELECT 'SSI'    AS measure, count(ssi_sir)    AS reporting,
       round(percentile_cont(0.5) WITHIN GROUP (ORDER BY ssi_sir)::numeric, 3)    AS median_sir,
       count(*) FILTER (WHERE ssi_sir    > 1) AS above_baseline,
       round(100.0 * count(*) FILTER (WHERE ssi_sir    > 1) / count(ssi_sir),    1) AS pct_above
  FROM public.hac_reduction_program
UNION ALL
SELECT 'MRSA',  count(mrsa_sir),
       round(percentile_cont(0.5) WITHIN GROUP (ORDER BY mrsa_sir)::numeric, 3),
       count(*) FILTER (WHERE mrsa_sir   > 1),
       round(100.0 * count(*) FILTER (WHERE mrsa_sir   > 1) / count(mrsa_sir),   1)
  FROM public.hac_reduction_program
UNION ALL
SELECT 'CLABSI',count(clabsi_sir),
       round(percentile_cont(0.5) WITHIN GROUP (ORDER BY clabsi_sir)::numeric, 3),
       count(*) FILTER (WHERE clabsi_sir > 1),
       round(100.0 * count(*) FILTER (WHERE clabsi_sir > 1) / count(clabsi_sir), 1)
  FROM public.hac_reduction_program
UNION ALL
SELECT 'CAUTI', count(cauti_sir),
       round(percentile_cont(0.5) WITHIN GROUP (ORDER BY cauti_sir)::numeric, 3),
       count(*) FILTER (WHERE cauti_sir  > 1),
       round(100.0 * count(*) FILTER (WHERE cauti_sir  > 1) / count(cauti_sir),  1)
  FROM public.hac_reduction_program
UNION ALL
SELECT 'CDI',   count(cdi_sir),
       round(percentile_cont(0.5) WITHIN GROUP (ORDER BY cdi_sir)::numeric, 3),
       count(*) FILTER (WHERE cdi_sir    > 1),
       round(100.0 * count(*) FILTER (WHERE cdi_sir    > 1) / count(cdi_sir),    1)
  FROM public.hac_reduction_program
ORDER BY pct_above DESC;
--  SSI    reporting 2,270 · median 0.795 · above 809 · 35.6%   <- worst measure
--  MRSA   reporting 2,068 · median 0.641 · above 476 · 23.0%
--  CLABSI reporting 2,182 · median 0.559 · above 389 · 17.8%
--  CAUTI  reporting 2,355 · median 0.489 · above 332 · 14.1%
--  CDI    reporting 2,767 · median 0.346 · above 111 ·  4.0%   <- best controlled

-- ============================================================================
-- (4) The penalty is RELATIVE, not absolute. The median PSI-90 patient-safety
--     composite is at/just under the value the measure treats as expected, yet
--     23.5% of hospitals are penalized — because the cut targets a fixed
--     worst-performing quartile, not a quality threshold. A hospital can beat
--     the baseline and still be cut if peers improve faster.
-- ============================================================================
SELECT
  round(percentile_cont(0.5) WITHIN GROUP (ORDER BY psi_90_composite_value)::numeric, 3) AS median_psi90,
  count(psi_90_composite_value)                                     AS psi90_reporting,
  round(percentile_cont(0.5) WITHIN GROUP (ORDER BY clabsi_sir)::numeric, 3) AS median_clabsi_sir
FROM public.hac_reduction_program;
--  median_psi90 0.962 · psi90_reporting 2,809 · median_clabsi_sir 0.559

-- ============================================================================
-- (5) WHERE penalties land — penalty rate by state, restricted to states with
--     >= 25 hospitals so a single facility cannot swing the rate. Maryland sits
--     at 0% (its all-payer global-budget waiver exempts its hospitals from the
--     program); Iowa and West Virginia penalize close to half their hospitals.
-- ============================================================================
SELECT
  state,
  count(*)                                                          AS hospitals,
  count(*) FILTER (WHERE payment_reduction ILIKE 'Y%')              AS penalized,
  round(100.0 * count(*) FILTER (WHERE payment_reduction ILIKE 'Y%')
        / count(*), 1)                                              AS penalty_rate
FROM public.hac_reduction_program
GROUP BY state
HAVING count(*) >= 25
ORDER BY penalty_rate DESC;
--  high: IA 53.3% (16/30) · WV 48.0% (12/25) · NM 42.3% (11/26) · OR 40.6% (13/32)
--        AL 37.7% (29/77) · MA 36.4% (20/55) · NY 34.9% (45/129)
--  large states: CA 27.4% (76/277) · PA 27.1% (36/133) · TX 11.3% (32/284) · FL 10.7% (18/169)
--  low:  CT 11.1% (3/27) · NJ 8.2% (5/61) · VA 7.0% (5/71) · UT 3.1% (1/32) · MD 0.0% (0/43)

-- ============================================================================
-- (6) The Maryland exemption, made explicit. Its hospitals report measures but
--     carry no payment reduction — a structural policy artifact of the state's
--     all-payer waiver, NOT a quality result.
-- ============================================================================
SELECT
  count(*)                                                          AS md_hospitals,
  count(*) FILTER (WHERE payment_reduction ILIKE 'Y%')              AS md_penalized,
  count(*) FILTER (WHERE total_hac_score IS NOT NULL)               AS md_with_score
FROM public.hac_reduction_program
WHERE state = 'MD';
--  md_hospitals 43 · md_penalized 0 · md_with_score (hospitals still reporting)
