-
Notifications
You must be signed in to change notification settings - Fork 3
Working with Geographic Data
Manu Murugesan edited this page Mar 14, 2026
·
2 revisions
medicaid-utils includes geographic classification features for assigning rural/urban status and primary care service areas to beneficiaries based on their ZIP code.
The person summary preprocessing automatically assigns rural/urban codes when preprocess=True:
from medicaid_utils.preprocessing import max_ps ps = max_ps.MAXPS(year=2012, state="WY", data_root="/data/cms") # df now has ruca_code, rucc_code, and rural/urban flags
Based on the USDA RUCA 3.1 classification:
- Codes 1–3: Urban
- Codes 4–10: Rural
Based on the USDA Rural-Urban Continuum Codes:
- Codes 1–3: Metro counties
- Codes 4–9: Non-metro counties (4–7 urban, 8–9 rural)
PCSA codes are assigned based on ZIP code crosswalks from the Dartmouth Atlas.
The other_datasets.zip module provides utilities for building geographic crosswalks:
from medicaid_utils.other_datasets import zip as zip_utils # Generate a ZIP-to-PCSA-to-RUCA crosswalk zip_utils.generate_zip_pcsa_ruca_crosswalk()
The geographic data bundled with medicaid-utils was compiled from:
| Dataset | Source |
|---|---|
| RUCA 3.1 codes | USDA Economic Research Service |
| RUCC codes | USDA Economic Research Service |
| PCSA crosswalk | Dartmouth Atlas |
| ZIP-ZCTA crosswalk | UDS Mapper |
| ZIP centroids | SimpleMaps, GeoNames |
Getting Started
User Guide
Recipes & How-Tos
Reference
Links