Analytics Engineering · Case Study

Medicare
Cost & Quality

What the same procedure costs across hospitals, the charge-to-payment markup, and whether spending buys better outcomes — a two-fact star schema on public CMS data.

SNOWFLAKE  ·  DBT  ·  TWO-FACT STAR  ·  CMS DATA
Nathanael Johnson Analytics Engineer
The question

Healthcare prices are incoherent — the same procedure carries wildly different charges, and almost nobody pays the charge anyway.

Does paying a hospital more buy better outcomes?

The data

Two public CMS extracts, one shared key

145,879
rows · DY2024
Inpatient Hospitals by Provider & Service. Per hospital × MS-DRG: discharges, average covered charge, average Medicare payment.
18,330
rows · HRRP
Readmissions Reduction Program. Per hospital: 30-day excess-readmission ratio across six conditions.

The join: HRRP's Facility ID is the inpatient file's Rndrng_Prvdr_CCN — the CMS Certification Number. That shared key is the whole project.

The model

A two-fact, conformed-dimension star

dim_provider 2,906 hospitals · keyed on CCN fact_inpatient_charges grain: hospital × DRG 145,879 rows · COST fact_readmissions grain: hospital × condition 11,720 rows · QUALITY dim_drg 540 · + service_line dim_geography 51 states → census region

Two facts at different grains, joined on demand through the conformed dim_provider.

A dbt relationships test enforces the CCN join as a contract — if a future CMS release breaks it, the build fails loudly.

Finding 01

Same procedure, 20× the price

DRG 470 — major joint replacement · average covered charge across n = 1,212 hospitals
MIN $19,194 P10 $42,710 MEDIAN $79,947 P90 $167,283 MAX $383,606
20× spread in the charge
1.7× spread in the actual Medicare payment

The charge is a list price decoupled from the cost of care, or from what anyone pays. The payment — what's actually exchanged — is far more uniform.

Finding 02

The markup is ~6×, and weirdly uniform

charge ÷ Medicare payment by service line · discharge-weighted
Nervous system Digestive Musculoskeletal Kidney / urinary Circulatory Respiratory Transplants 6.40× 6.40× 6.30× 6.25× 6.06× 5.99× 5.64×

From nervous-system procedures to transplants, the markup sits in a tight 5.6–6.4× band. The list price isn't tracking complexity — it's a roughly fixed multiple applied across the board.

Finding 03 · the two-fact join

Spending barely buys quality

5 Medicare-payment quintiles vs average 30-day excess-readmission ratio · 1.0 = exactly as expected after risk adjustment
1.010 1.000 0.990 = EXPECTED 1.0069 1.0061 1.0006 0.9912 0.9942 Q1 Q2 Q3 Q4 Q5 $8,410 $10,216 $11,805 $14,140 $21,939
r = −0.081
across 2,789 hospitals

A faint downward tilt — the best-paid quintile dips just below expectation — but payment explains under 1% of the variance in readmissions.

Paying a hospital 2.6× more buys, at most, a rounding error of better outcomes.

So what

Anchor on the payment, not the charge — and stop assuming a pricier hospital is a better one.

The 20× charge spread is negotiating theater; what's actually exchanged varies only 1.7×. Any analysis built on charges is measuring a fiction.

And the comfortable assumption that higher spend signals higher quality didn't survive the join — r = −0.081. The honest read is barely-there, not zero, and that's the answer payers keep arriving at.

How it was built

A contract-tested two-fact pipeline

CMS data API
DCAT catalog lookup
Snowflake RAW
dbt staging
two-fact marts
7
dbt models
19 / 19
tests passing

Including the cross-fact relationships test on the CCN join. The cost-vs-quality finding is NTILE(5) payment quintiles joined across both facts through the conformed provider dimension, with CORR() computed in SQL.

The list price is a story. The payment is the data.

Repo github.com/nathanaelhub/medicare-cost-quality
Work nathanaeljohnson.net/work/medicare-cost-quality
Nathanael Johnson Analytics Engineer
01 / 01