-- The price-transparency enforcement funnel: 11,440 actions, 28 fines
-- Fonteum reproducible query — https://fonteum.com/research/hospital-price-transparency-enforcement-2026
-- Data as of: 2026-06-16  ·  methodology: price-transparency/v1
-- Source datasets: CMS Hospital Price Transparency Enforcement
-- Run against the frozen federal snapshot to reproduce the published figures.
-- License: U.S. Government Works (federal sources; 17 U.S.C. §105).

-- How CMS enforces the Hospital Price Transparency rule — and how rarely that
-- enforcement reaches an actual fine. Fully reproducible query.
--
-- Question: since the Hospital Price Transparency rule's enforcement began
-- (45 CFR Part 180, under PHSA Sec. 2718(e)), CMS has logged tens of thousands
-- of enforcement actions against hospitals with missing or incomplete public
-- price files. What does that activity look like — what kinds of actions, how
-- far up the escalation ladder they go, when, and where — and how often does it
-- end in a Civil Monetary Penalty (CMP), the only action that carries a fine?
-- The lead figure: of 4,975 hospitals CMS placed under enforcement, only 28
-- (0.56%) ever received a CMP. An enforcement action is a compliance step, NOT
-- a verdict on a hospital's quality, conduct, or care.
--
-- Source:
--   public.cms_price_transparency_enforcement — CMS "Hospital Price Transparency
--     Enforcement Activities and Outcomes" public file, published via the CMS
--     data catalog (data.cms.gov, hospitals-and-other-facilities). 11,440
--     enforcement-action rows; activity logged 2021-01-07 through 2026-03-31;
--     catalog snapshot June 2026. Public, read-only. License:
--     US-Government-Works (17 U.S.C. Sec. 105). methodology_version =
--     'price-transparency/v1'.
--
-- Universe: this study reads the published activity log AS A WHOLE — every row
--   is one enforcement action CMS took on one case. The log is cumulative (it
--   retains historical actions), so year figures are an honest flow over time,
--   not a point-in-time roster.
--
-- Grouping note: a "hospital" below is the distinct (hosp_name, state) pair as
--   published — this keeps two same-named hospitals in different states apart.
--   The escalation funnel asks, per hospital, whether it EVER reached a given
--   rung. No individual hospital is named in the study.

-- ============================================================================
-- (1) Universe reconciliation — the published activity log at a glance.
-- ============================================================================
SELECT
  count(*)                                                          AS actions,
  count(DISTINCT case_id)                                           AS cases,
  count(DISTINCT (hosp_name, state))                               AS hospitals,
  count(DISTINCT state)                                             AS states,
  count(*) FILTER (WHERE action_date IS NULL)                       AS null_date,
  min(action_date)                                                  AS earliest_action,
  max(action_date)                                                  AS latest_action
FROM public.cms_price_transparency_enforcement;
--  actions 11,440 · cases 7,037 · hospitals 4,975 · states 53 · null_date 0
--  earliest_action 2021-01-07 · latest_action 2026-03-31

-- ============================================================================
-- (2) HEADLINE: the outcome mix. Of every enforcement action on file, the two
--     largest are hospitals brought into compliance ("Met Requirements") and
--     closed cases — not penalties. The CMP (the only action carrying a fine)
--     is the rarest enforcement outcome but one: 28 of 11,440 actions.
-- ============================================================================
SELECT
  action,
  count(*)                                                          AS actions,
  round(100.0 * count(*) / sum(count(*)) OVER (), 1)                AS pct_of_all
FROM public.cms_price_transparency_enforcement
GROUP BY action
ORDER BY actions DESC;
--  Met Requirements        3,340  29.2%
--  Closure Notice          3,225  28.2%
--  Warning Notice          2,993  26.2%
--  CAP Request             1,751  15.3%
--  Administrative Closure     81   0.7%
--  CMP Notice                 28   0.2%
--  Appealed                   22   0.2%

-- ============================================================================
-- (3) THE ESCALATION LADDER, per hospital. CMS escalates a non-compliant
--     hospital: a Warning Notice, then a Corrective Action Plan (CAP) Request,
--     then — only if it still does not comply — a CMP Notice. Counting whether
--     each hospital EVER reached a rung shows the ladder narrowing to almost
--     nothing: 2,605 warned -> 1,451 CAP -> 28 fined.
-- ============================================================================
WITH per AS (
  SELECT
    hosp_name, state,
    bool_or(action = 'Warning Notice')  AS warned,
    bool_or(action = 'CAP Request')     AS capped,
    bool_or(action = 'CMP Notice')      AS fined
  FROM public.cms_price_transparency_enforcement
  GROUP BY hosp_name, state
)
SELECT
  count(*)                                                          AS hospitals,
  count(*) FILTER (WHERE warned)                                    AS ever_warned,
  count(*) FILTER (WHERE capped)                                    AS ever_cap,
  count(*) FILTER (WHERE fined)                                     AS ever_cmp,
  round(100.0 * count(*) FILTER (WHERE fined) / count(*), 2)        AS pct_fined,
  round(100.0 * count(*) FILTER (WHERE capped)
        / nullif(count(*) FILTER (WHERE warned), 0), 1)             AS warn_to_cap_pct,
  round(100.0 * count(*) FILTER (WHERE fined)
        / nullif(count(*) FILTER (WHERE capped), 0), 1)             AS cap_to_cmp_pct
FROM per;
--  hospitals 4,975 · ever_warned 2,605 · ever_cap 1,451 · ever_cmp 28
--  pct_fined 0.56% · warn_to_cap 55.7% · cap_to_cmp 1.9%

-- ============================================================================
-- (4) WHEN — enforcement actions by year, split by rung. 2025 is a surge year:
--     5,432 actions, more than the 5,291 logged across all of 2021-2024
--     combined, with 2,343 hospitals brought into compliance as CMS's
--     machine-readable-file template requirements took full effect.
-- ============================================================================
SELECT
  extract(year FROM action_date)::int                               AS yr,
  count(*) FILTER (WHERE action = 'Warning Notice')                 AS warnings,
  count(*) FILTER (WHERE action = 'CAP Request')                    AS cap_requests,
  count(*) FILTER (WHERE action = 'CMP Notice')                     AS cmp_notices,
  count(*) FILTER (WHERE action = 'Met Requirements')               AS met,
  count(*)                                                          AS total
FROM public.cms_price_transparency_enforcement
GROUP BY yr
ORDER BY yr;
--  2021    338   97   0     5    467
--  2022     95  136   2    66    539
--  2023    615  468  12   380  2,198
--  2024    615  373   3   320  2,087
--  2025  1,030  606  10 2,343  5,432   <- the surge
--  2026    300   71   1   226    717   (partial year, through 2026-03-31)
--  CMP notices total across all years = 28; peak year 2023 (12).

-- ============================================================================
-- (5) WHERE — top 10 states by enforcement-action count, with each state's
--     hospital count and CMP count. Texas leads on both volume and fines; the
--     28 CMPs are spread thin across 17 states (TX 5, LA 3, FL 2, GA 2).
-- ============================================================================
SELECT
  state,
  count(*)                                                          AS actions,
  count(DISTINCT (hosp_name, state))                               AS hospitals,
  count(*) FILTER (WHERE action = 'Warning Notice')                 AS warnings,
  count(*) FILTER (WHERE action = 'CMP Notice')                     AS cmp_notices
FROM public.cms_price_transparency_enforcement
GROUP BY state
ORDER BY actions DESC
LIMIT 10;
--  TX 1,175 / 557 hosp / 294 warn / 5 cmp · CA 970 / 410 / 272 / 1
--  FL 686 / 277 / 172 / 2 · OH 414 / 188 / 103 / 0 · PA 409 / 190 / 104 / 1
--  LA 388 / 165 / 102 / 3 · NY 377 / 152 / 108 / 1 · IL 345 / 152 / 109 / 1
--  MI 333 / 141 / 59 / 0 · NC 289 / 125 / 87 / 1

-- ============================================================================
-- (6) The CMP cohort, in aggregate. All 28 fined hospitals first went through
--     the corrective-action rung (27 of 28 have a CAP Request on file; the
--     remaining one entered enforcement straight at the CMP after a deficient
--     review), and 6 of the 28 later returned to compliance ("Met
--     Requirements") after the penalty. No hospital is named.
-- ============================================================================
WITH per AS (
  SELECT
    hosp_name, state,
    bool_or(action = 'Warning Notice')  AS warned,
    bool_or(action = 'CAP Request')     AS capped,
    bool_or(action = 'CMP Notice')      AS fined,
    bool_or(action = 'Met Requirements') AS met
  FROM public.cms_price_transparency_enforcement
  GROUP BY hosp_name, state
)
SELECT
  count(*) FILTER (WHERE fined)                                     AS cmp_hospitals,
  count(*) FILTER (WHERE fined AND capped)                          AS cmp_with_prior_cap,
  count(*) FILTER (WHERE fined AND met)                             AS cmp_then_met
FROM per;
--  cmp_hospitals 28 · cmp_with_prior_cap 27 · cmp_then_met 6
