Spending by county and National Drug Code
This map visualizes the Medicaid Provider Spending (NDC) dataset published by the U.S. Department of Health & Human Services (HHS), Centers for Medicare & Medicaid Services (CMS). The dataset contains 21.5 million rows covering 2.2 billion claim lines from January 2018 through December 2024. Each row aggregates drug claims by billing provider, prescribing provider, National Drug Code (NDC), and month.
An NDC identifies a specific drug product down to the labeler, product, and package size. After excluding placeholder codes (see below), 49,642 distinct 11-digit NDCs appear in the county-mapped data. To keep the interactive map performant, only the most popular NDCs by claim-line volume are included: the top 11,942 codes, which together account for 98% of all county-mapped claim lines.
A substantial share of the raw data does not carry a usable NDC: placeholder codes consisting of a single repeated digit (e.g., 88888888888, 99999999999, 00000000000) together account for roughly 55% of all claim lines. These appear to be bulk-reported claims where the specific drug product was not identified, and they are excluded from the map, along with a small tail of malformed non-11-digit code values.
Because a single medicine typically appears under many NDCs (one per manufacturer, strength, and package size), the search is organized by drug rather than by individual NDC. Each of the 11,913 included NDCs is assigned to a drug group by its active ingredient, resolved through the National Library of Medicine's RxNorm terminology: the NDC is mapped to its RxNorm drug concept, and that concept to its ingredient (for combination products, the multi-ingredient concept, so e.g. hydrocodone/acetaminophen products form a single group). NDCs that cannot be resolved through RxNorm are grouped by their FDA or Medicaid Drug Rebate Program name, and codes with no identification at all stand alone, labeled “unidentified”.
This yields 2,855 drug groups. Selecting a drug shows the sum of spending across all of its member NDCs (81% of included NDCs were grouped via RxNorm ingredient; the rest are name-grouped or standalone). Brand names of member products are searchable, so typing “Lantus” finds the insulin glargine group. Individual NDCs can still be mapped by typing the code digits into the search box. Note that drug-group totals aggregate only the member NDCs included in this map (the top 98% by claim volume), not the excluded long tail.
Drug groups are additionally organized into therapeutic classes using the World Health Organization's Anatomical Therapeutic Chemical (ATC) classification, obtained through the National Library of Medicine's RxClass API. Classes at ATC levels 2 (therapeutic subgroup, e.g. A10 — Drugs used in diabetes), 3 (pharmacological subgroup, e.g. A10B), and 4 (chemical subgroup, e.g. A10BA — Biguanides) are selectable as map layers; selecting a class maps the summed spending of all its member drugs. 685 classes have data on this map: 85 at level 2, 181 at level 3, and 419 at level 4.
Following standard ATC practice, a drug can belong to multiple classes (aspirin, for example, appears under both antithrombotics and analgesics), so simultaneously selecting overlapping classes — or a class together with one of its member drugs — double-counts the shared spending in the summed view. Combination products without their own ATC code inherit the classes of their component ingredients. 76.5% of included claim lines belong to at least one classified drug; the remainder (mostly unidentified NDCs and products without ATC assignments) appear only in the drug and NDC listings.
Drug names are resolved from three sources, in order of preference: the FDA National Drug Code Directory (brand and generic names, matched on the 9-digit labeler + product segments), the Drug Products in the Medicaid Drug Rebate Program file (which includes terminated products), and the National Library of Medicine's RxNav API (which retains historical NDCs such as discontinued COVID-19 vaccine packagings). A small share of codes cannot be resolved by any source and are shown without a name.
The spending dataset identifies providers by National Provider Identifier (NPI) numbers but does not include geographic information. To map spending to counties, a three-step lookup is performed:
Each row in the spending dataset may contain two NPI numbers: the billing provider (typically the pharmacy or facility that billed for the drug) and the prescribing provider. The prescribing NPI is empty in roughly two-thirds of rows, so this map uses the billing provider's location when available, with the prescribing provider's location as a fallback. This generally reflects where the drug was dispensed rather than where it was prescribed.
Using this strategy, 96.7% of rows with a valid NDC (93.0% of their claim lines) were successfully mapped to a county; 97% of the mapped rows resolve through the billing provider. The remainder could not be geolocated — mostly rows where neither NPI is populated or the NPI does not appear in NPPES — and are excluded from the map.
Dollar values on the map are per-enrollee amounts, computed as:
The TOTAL_PAID field from the spending dataset is summed by county, NDC, and calendar quarter. County-level Medicaid enrollment counts are derived from the American Community Survey (ACS) 2023 5-year estimates, Table C27007 (Medicaid/Means-Tested Public Coverage Status by Sex by Age). The six “With Medicaid/means-tested public coverage” age-sex subgroups are summed to produce a single enrollment figure per county. A single enrollment figure is used across all quarters (2018–2024).
Note: The ACS measure includes CHIP and other state means-tested programs alongside Medicaid. Survey-based estimates are known to undercount Medicaid enrollment by roughly 10–20% compared to administrative records. Total county population from the Census Bureau’s 2024 population estimates is also shown for reference.
The source data is monthly. Claims are grouped into calendar quarters (Q1 = Jan–Mar, Q2 = Apr–Jun, Q3 = Jul–Sep, Q4 = Oct–Dec) based on the CLAIM_FROM_MONTH field. The dataset spans Q1 2018 through Q4 2024 (28 quarters).
The choropleth uses a sequential blue color scale with linear interpolation. To prevent extreme outliers from compressing the visible color range, the scale maximum is set at the 98th percentile of per-enrollee values across all counties for the selected drug and quarter. Counties above this threshold are shown in the darkest blue. Counties with no data for the selected drug/quarter are shown in gray.
TOTAL_PAID field contains some implausibly large outlier values, as in the companion HCPCS dataset. The 98th-percentile color scale cap limits their visual impact, but reported totals should be treated with caution.