Nason's picture
Upload README.md with huggingface_hub
4cb96fd verified
---
license: other
license_name: public-domain-with-cpt
license_link: LICENSE
task_categories:
- tabular-classification
- tabular-regression
tags:
- medicare
- cms
- healthcare
- physician
- duckdb
- government-data
- medical-billing
pretty_name: CMS Medicare Physician & Other Supplier Database
size_categories:
- 100M<n<1B
---
# CMS Medicare Physician & Other Supplier Database
A clean, queryable DuckDB database built from the [CMS Medicare Physician & Other Practitioners Public Use Files](https://data.cms.gov/provider-summary-by-type-of-service/medicare-physician-other-practitioners) -- provider-level Medicare Part B claims data from CY2012 through CY2023.
**121,707,609 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](https://github.com/ian-nason/cms-medicare-database).
## Quick Start
### DuckDB CLI
```sql
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
```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
| Table | Description | Rows |
|-------|-------------|------|
| `physician_services` | Provider-level Medicare Part B claims: one row per NPI per HCPCS code per place | 106,515,734 |
| `physician_summary` | Provider-level aggregate summary: one row per NPI per year with total services, | 12,232,194 |
| `geography_service` | Geographic aggregate: Medicare utilization and payment by state/national level, | 2,959,681 |
## Data Source
[CMS Medicare Physician & Other Practitioners PUF](https://data.cms.gov/provider-summary-by-type-of-service/medicare-physician-other-practitioners) -- 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](https://github.com/ian-nason/cms-medicare-database)