Nason/cms-medicare-database
CMS Medicare Physician & Other Supplier Database A clean, queryable DuckDB database built from the CMS Medicare Physician & Other Practitioners Public Use Files -- provider-level Medicare Part B claims data from CY2012 through CY2023. 132,947,347 rows across 3 tables covering what every physician billed, what Medicare paid, and how many services and beneficiaries per NPI per HCPCS code. Built with cms-medicare-database. Quick Start DuckDB CLI… See the full description on the dataset page: https://huggingface.co/datasets/Nason/cms-medicare-database.
CMS Medicare Physician & Other Supplier Database
A clean, queryable DuckDB database built from the CMS Medicare Physician & Other Practitioners Public Use Files -- provider-level Medicare Part B claims data from CY2012 through CY2023.
132,947,347 rows across 3 tables covering what every physician billed, what Medicare paid, and how many services and beneficiaries per NPI per HCPCS code.
Built with cms-medicare-database.
Quick Start
DuckDB CLI
INSTALL httpfs;
LOAD httpfs;
ATTACH 'https://huggingface.co/datasets/Nason/cms-medicare-database/resolve/main/cms_medicare.duckdb' AS cms (READ_ONLY);
-- Total Medicare spending by year
SELECT year, ROUND(SUM(line_srvc_cnt * avg_medicare_payment_amt) / 1e9, 2) AS total_spending_billions
FROM cms.physician_services
GROUP BY year ORDER BY year;Python
import duckdb
con = duckdb.connect()
con.sql("INSTALL httpfs; LOAD httpfs;")
con.sql("""
ATTACH 'https://huggingface.co/datasets/Nason/cms-medicare-database/resolve/main/cms_medicare.duckdb'
AS cms (READ_ONLY)
""")
con.sql("SELECT * FROM cms.physician_services LIMIT 5").show()DuckDB uses HTTP range requests, so only the pages needed for your query are downloaded.
Tables
Data Source
CMS Medicare Physician & Other Practitioners PUF -- maintained by CMS. Updated annually. Public domain U.S. government data. HCPCS descriptions include AMA CPT content used under CMS license.
License
Database build code: MIT. Underlying data: public domain (U.S. government work). Note: HCPCS descriptions contain AMA CPT content included as provided by CMS in the PUF.
GitHub
Full source code, build instructions, and data dictionary: github.com/ian-nason/cms-medicare-database
Changelog
2026-07-06 — Full refresh + data-quality audit
Rebuilt from the current CMS PUF releases, adding CY2024, and repaired after an independent SQL-verified audit.
Data changes
- CY2024 added to all three tables: 132,947,347 rows total (physicianservices 116.2M, physiciansummary 13.5M, geography_service 3.2M), CY2013-CY2024.
Fixes
geography_service.HCPCS_Cdre-ingested as VARCHAR: numeric auto-casting had NULLed all 282,776 alphanumeric codes (G/J/lab codes) and stripped leading zeros from 137,781 anesthesia codes. Geography-level procedure analysis works again, including joins tophysician_services.hcpcs_code.physician_summaryidentifiers re-typed as VARCHAR:Rndrng_NPI(joins to services now work),Rndrng_Prvdr_Zip5(1.35M leading-zero ZIPs restored),State_FIPS,RUCA.
Known caveats (see README for the full list)
- CMS suppression makes
physician_servicesa systematic ~17-21% payment undercount vsphysician_summary— use the summary table for provider totals. provider_genderis 100% NULL in every year (removed retroactively by CMS); chronic-condition columns are NULL before 2017 and top-coded at 75.geography_servicemixes National and State rows — filterRndrng_Prvdr_Geo_Lvl.
