Technical Reference

Data Model

A normalized, RxNorm-centered schema with 13 modular layers — from drug hierarchy, clinical intelligence and indications through economics, formulary access, PBM attribution, and pharmacy network. Every prod table is MotherDuck-hosted and API-accessible.

13 layers45 tables50K+ drugs68K pharmacies96.9% PBM coverage
Entity Relationships

Schema Overview

Core entity relationships across the drug hierarchy, enrichment layers, pricing, and network data. Click any table in the detailed view below to inspect columns.

ingredientdrug_profilendc_crosswalkdrug_atcref.icd10drug_icd10_estimatenadac_pricingmart_ndc_economicsdrug_formulary_signalpbm_market_snapshotpharmacy_directorydrug_hcc_suspecthcc_categoryhcc_hierarchyndc_crosswalk_historydrug_profile_obsoletedrug_cvx / ndc_cvxdrug_indicationindicationindication_conditionconditioncondition_icd10prescriber_atcprescriber_profileprescriber_ingredient
Foundation / Intelligence
Indications
Risk Adjustment / Suspecting
NDC Crosswalk
Pricing / Economics
Formulary & Access
PBM & Plan
Pharmacy Network
Detailed Schema

Tables by Layer

RxNorm Foundation

Foundation
drug_profile
33 cols

RxNorm drug hierarchy enriched with engineered therapy behavior classification. Therapy attributes are derived at the clinical drug form level and propagated to all strength and branded variants. Primary drug table for most analytics — it combines drug hierarchy with therapy context in a single row.

ingredient
2 cols

RxNorm ingredient concepts (TTY = IN or MIN). Anchor for ATC classification and ingredient-level economics.

icd10
24 cols

ICD-10-CM diagnosis code reference with full classification hierarchy from chapter down to the most specific subcategory. Covers all codes including non-billable parent categories. Filter is_billable = true to restrict to codes that can appear on medical or pharmacy claims.

atc
10 cols

WHO Anatomical Therapeutic Chemical (ATC) classification system. All five levels of the hierarchy are denormalized onto each row. Level 5 is the individual drug substance level; levels 1–4 represent progressively broader therapeutic groupings.

atc_rxnorm
2 cols

Crosswalk between ATC level-5 drug classification codes and RxNorm ingredient identifiers. One ingredient may map to multiple ATC codes (e.g., a drug with multiple approved therapeutic uses) and one ATC code may map to multiple ingredient RxCUIs (e.g., salt variants of the same molecule).

atc_rxnorm_supplement
6 cols

Additional ingredient-to-ATC mappings sourced from Health Canada's Drug Product Database, which classifies every marketed product with a WHO ATC code natively. Covers ingredients the primary crosswalk leaves unclassified, most often where the primary source binds the ATC code to a salt or ester concept while RxNorm builds its drug products on the base ingredient.

drug_atc
8 cols

Drug-level ATC classification: the resolved therapeutic class for each drug product, combining the ingredient-based crosswalk with product-level classifications from Health Canada. This is the recommended starting point for ATC lookups because it is the only table that classifies combination products, which the WHO assigns a single dedicated combination code rather than one code per ingredient.

ndc_crosswalk
5 cols

Multi-source NDC-to-drug_id resolution. Combines RxNav ndc2rxcui, FDA NDC directory, and supplemental manual overrides. source_rank encodes provenance confidence.

ndc_crosswalk_history
9 cols

Every NDC TwinFyRx has ever mapped, including NDCs whose drug concept RxNorm has since retired. ndc_crosswalk is the active subset. Rows are never removed, so historical pharmacy claims still join to a drug.

drug_profile_obsolete
23 cols

Drug concepts that historical NDCs point at but that are no longer in drug_profile. Same hierarchy columns as drug_profile, plus why the concept left and its RxNorm replacement.

cvx
7 cols

CDC vaccine codes (CVX) — the code set every US immunization information system (IIS) uses to record what was administered. Refreshed from the CDC IIS standards files.

ndc_cvx
13 cols

Vaccine NDCs from the CDC IIS lookup files, each with its CVX code and, where it resolves, the TwinFyRx drug_id. Covers both the carton sold (unit of sale) and the vial or syringe administered (unit of use), including new-season products before RxNorm lists them.

drug_cvx
3 cols

CVX codes for current drug_profile products — the bridge between prescription/medical claims (drug_id, NDC) and immunization records (CVX).

Drug Intelligence

Intelligence
drug_icd10_estimate
10 cols

Estimated share of each drug's prescriptions written for each ICD-10-CM diagnosis code. Each row reads as P(diagnosis code | a fill of this drug) — e.g. finasteride 1 mg: L64.9 androgenic alopecia 96%; finasteride 5 mg: N40.1 BPH 87%. Derived from the indication layer: each indication's share goes to the ICD-10 code(s) of its primary condition — or, when the primary condition has no code of its own (a procedure or a broad class), to the code of what the drug treats (chemotherapy-induced nausea and vomiting → R11.2). Covers chronic-use and specialty drugs plus the top 300 clinical drug forms by US prescription volume.

Indications

Indications
drug_indication
5 cols

Estimated share of each drug's prescriptions written for each TwinFyRx Indication. Each row reads as P(indication | a fill of this drug) — e.g. finasteride 1 mg: male pattern hair loss 91%; finasteride 5 mg: benign prostatic hyperplasia 77%. The entry point of the indication layer: drug_id (or an NDC via ndc_crosswalk) → drug_indication → indication → indication_condition.

indication
8 cols

The TwinFyRx Indication vocabulary — indications as analysts group a market (e.g. 'Stroke prevention in nonvalvular atrial fibrillation'), independent of any drug. Each indication records what the patient has (primary_condition), how the drug relates to it (relationship), what the drug acts on (target), any qualifier, and a parent for roll-ups.

indication_condition
8 cols

The conditions each indication implies the patient has, with their ICD-10-CM codes and condition-layer mapping. The primary condition is the diagnosis on the claim for the fill; associated conditions are other conditions the use implies (e.g. dyslipidemia in chronic kidney disease: primary hyperlipidemia E78.5, associated chronic kidney disease N18.9). When the primary condition has no code of its own (a procedure or a broad class), a target row carries the code the claim uses for what the drug treats (chemotherapy-induced nausea and vomiting: primary cancer receiving emetogenic chemotherapy, class; target R11.2).

condition
6 cols

TwinFyRx condition layer: clinically coherent patient conditions built on AHRQ's Clinical Classifications Software Refined (CCSR), with categories merged or split where CCSR groups conditions a prescriber would treat differently, plus five broad classes (cancer of any site, atherosclerotic cardiovascular disease, bacterial infection, chronic pain, psychotic or bipolar disorder on antipsychotic therapy).

condition_icd10
4 cols

ICD-10-CM → condition crosswalk. Every ICD-10-CM code, billable and category (header) codes, assigned to exactly one condition — the join from a diagnosis on a medical claim to the condition layer.

NADAC Pricing

NADAC
nadac_pricing
12 cols

Weekly CMS NADAC rates per NDC. National average drug acquisition cost for retail pharmacy — what pharmacies actually pay. Sample contains the most recent price per NDC.

ASP Pricing

ASP
asp_payment_limits
14 cols

Quarterly Medicare Part B ASP+6% payment limits per HCPCS code. Used for medical-channel drug cost benchmarking (physician-administered biologics, injectables).

asp_ndc_hcpcs_crosswalk
13 cols

CMS crosswalk mapping NDC-level package data to HCPCS codes used in Medicare Part B ASP pricing. Supports unit conversion between pharmacy packages and billing units.

asp_hcpcs_rxcui_map
6 cols

HCPCS J-code to RxNorm product crosswalk for Medicare Part B drug billing codes. Resolves each HCPCS code to its corresponding RxNorm SCD/SBD concept, enabling joins between ASP payment limits and the drug intelligence pipeline.

Package Normalization

Packaging
normalized_package_size
10 cols

Deterministic package size and billing unit normalization for every NDC11 with FDA package data. Parses free-text package descriptions into structured total_quantity and billing_unit fields.

Drug Economics

Economics
mart_ndc_economics
13 cols

NDC-level cost economics. Combines NADAC acquisition cost and ASP Part B payment limits with package normalization to yield price per billing unit and price per package.

mart_ndc_therapy_economics
19 cols

NDC-level therapy cost mart adding WHO DDD-derived daily, 30-day, and 90-day cost estimates to mart_ndc_economics (WHO ATC/DDD Index 2026). Only applicable where a meaningful daily dose can be derived.

mart_clinical_drug_economics
24 cols

Drug-level cost aggregates. Min/median/max cost statistics across all NDCs; daily, 30-day, and 90-day therapy cost where dose is derivable.

mart_ingredient_economics
14 cols

Ingredient-level cost rollup across all clinical drug forms for the ingredient. Useful for class benchmarking where brand/generic distinctions are unimportant.

mart_atc_class_economics
10 cols

ATC 4th-level therapeutic class benchmarks. 30-day cost min/median/max across drugs in the class with applicable therapy economics.

Part D Formulary Access

Formulary
drug_formulary_signal
13 cols

Drug-level Medicare Part D formulary restriction prevalence. Captures prior auth, step therapy, quantity limit, and tier placement across all covering plans for a given year.

drug_access_friction
5 cols

Composite payer access barrier score (0–1) per drug and year. Weighted combination of PA prevalence (35%), step therapy (25%), quantity limits (15%), tier position (10%), and non-coverage rate (15%).

Medicare Plan Intelligence

Medicare
partd_plan_dim
8 cols

Medicare Part D and MA-PD plan dimension. One row per plan year × CMS contract × plan benefit package, with sponsor, marketing name, plan type, and market segment.

pbm_inference
8 cols

PBM attribution derived from observed Medicare plan artifacts (BIN/PCN routing, plan documents). Captures the primary PBM managing pharmacy benefits for a plan/year with supporting evidence.

pbm_market_snapshot
9 cols

Historical PBM attribution per Medicare contract/PBP across all CMS plan years. Built from Medicare plan artifact inference (primary) and BIN/PCN backfill (secondary). 96.9% attribution coverage.

plan_routing
9 cols

Pharmacy claim routing identifiers (RxBIN, RxPCN, RxGroup, M3P overrides) per Medicare plan/year. Use to route claims data to the correct plan and PBM.

Pharmacy Directory

Pharmacy
pharmacy_directory
24 cols

US pharmacy roster filtered from NPPES organizations with pharmacy taxonomy and CMS Part D network presence. Includes chain attribution, PSAO affiliation, type classification, and geocoded location.

Canadian Drug Products

Canada
canada_drug_product
23 cols

Marketed human drug products from the Health Canada Drug Product Database (DPD), each crosswalked to the canonical RxNorm drug_id where an equivalent exists. Products with no RxNorm equivalent at their marketed strength resolve instead to a stable Canada-only identifier. See match_method for how each row was resolved.

canada_synthetic_drug
4 cols

Canada-only drug strengths: an ingredient + dose form that exists in RxNorm, at a strength RxNorm carries no product for. Gives those products a stable identifier so they can be grouped and joined even though no RxCUI exists.

Risk Adjustment

Layer
drug_hcc_suspect
12 cols

Drug to risk-adjustment condition category. Answers: given a dispensed drug, which CMS-HCC or RxHCC categories does it point at, how much of the drug's prescription volume supports each one, and how much confidence that carries. The starting point for pharmacy-based diagnosis suspecting: a member fills the drug, no diagnosis in the category is on file this year, and confidence_tier says how strong a suspect that is.

hcc_category
3 cols

CMS's name for each risk-adjustment condition category in CMS-HCC V24, CMS-HCC V28 and RxHCC V08. Names any category number carried on icd10 (hcc_v24, hcc_v28, rxhcc_v08) or drug_hcc_suspect (cc).

hcc_hierarchy
3 cols

CMS's hierarchies among condition categories in CMS-HCC V24, CMS-HCC V28 and RxHCC V08. Answers: when a member already has a more severe category on record, which less severe categories no longer count? Diagnosis suspecting uses it so a category covered by a higher one is not listed as a gap.

Prescribers

Prescribers
prescriber_profile
32 cols

One row per Medicare Part D prescriber: who they are (name, location, best-available specialty), how much they prescribe, how broad their prescribing is, and where they rank by volume.

prescriber_atc
17 cols

Prescribing volume per prescriber in each WHO ATC class at levels 2, 3 and 4, with the prescriber's rank among everyone who prescribes the class. Answers: who are the top prescribers of a class, and what does a given prescriber's class mix look like.

prescriber_ingredient
15 cols

Prescribing volume per prescriber per ingredient (RxNorm IN / MIN), with the prescriber's rank among everyone who prescribes the ingredient.

atc_prescriber_mix
8 cols

Who prescribes each ATC class: prescribers, claims and share of the class's claims by CMS prescriber type.

Integration Patterns

Common Join Paths

Pre-validated join paths for common analytical workflows. Each pattern is a tested integration available through the API or directly via MotherDuck.

Drug Hierarchy

Navigate the RxNorm concept tree from ingredient through drug form to specific product and NDC

ingredientdrug_profilendc_crosswalk
Historical Claims

Resolve NDCs on older claims, including those whose drug concept RxNorm has since retired — is_obsolete marks them and remapped_drug_id points to the current replacement

ndc_crosswalk_historydrug_profile / drug_profile_obsolete
Immunization Records

Bridge prescription and medical claims to immunization registry (IIS) records — CDC CVX codes per drug, and per vaccine NDC including new-season products RxNorm has not listed yet

drug_profile / ndc_crosswalkdrug_cvx / ndc_cvxcvx
Therapeutic Class

Resolve a drug's WHO ATC class directly at the drug level — the only path that classifies combination products, which carry a single combination code rather than one per ingredient. For one code per product, filter is_primary (or read drug_profile.primary_atc_code)

drug_profiledrug_atcatc
Diagnosis Mapping

Resolve a drug to the diagnosis codes it is prescribed for — each code's share of the drug's prescriptions, derived from the indication layer's primary conditions

ndc_crosswalkdrug_iddrug_icd10_estimateref.icd10
NDC → Indication

Resolve a dispensed NDC to why it was prescribed — the drug's indication shares, each indication's primary diagnosis (the one expected on the claim) and associated conditions, coded to ICD-10-CM and the CCSR-based condition layer

ndc_crosswalkdrug_iddrug_indicationindicationindication_condition
Diagnosis Suspecting

From a dispensed NDC to the CMS-HCC and RxHCC categories the drug points at — each category's share of the drug's use and a confidence tier (high at 90%+, moderate at 70–90%). Join a member's diagnoses through ref.icd10 to find the ones not yet coded

ndc_crosswalkdrug_iddrug_hcc_suspectref.icd10 (hcc_v28)hcc_categoryhcc_hierarchy
Prescriber Targeting

From a therapeutic class or ingredient to the prescribers who write it — 2024 Medicare Part D claims, cost and share per NPI, with volume deciles nationally, within prescriber type and within state, and each prescriber's specialty

atc / ingredientprescriber_atc / prescriber_ingredientprescriber_profile
Pharmacy Pricing

Weekly acquisition cost per NDC (NADAC) or quarterly Medicare Part B limits (ASP) via crosswalk

ndc_crosswalknadac_pricing / asp_payment_limits
Drug Economics

Therapy cost benchmarks from NDC level through drug, ingredient, and ATC class rollups

ndc_crosswalkmart_ndc_economicsmart_clinical_drug_economics
Formulary Access

Part D formulary restriction prevalence and composite access friction score by drug and year

drug_profiledrug_formulary_signaldrug_access_friction
PBM Attribution

Identify the PBM managing a pharmacy benefit from BIN/PCN routing or Medicare plan inference

bin_pcn_pbm_mappbm_market_snapshot
Controlled Vocabularies

Enumerated Values

Standardized enum values used across enrichment layers. All values are validated at ingestion time.

Machine-readable version: enums.json — keyed by enum name, includes the tables that use each enum. Also bundled in the sample download.

therapy_pattern
maintenance_continuousmaintenance_intermittentacute_short_courseprn_chronicprn_acutemixed_contextualimmunization
dea_schedule
CIICIIICIVCV
dea_schedule_source
splfda_ndcclinical_drugclinical_drug_formingredient
vaccine_status
ActiveInactiveNon-USNever ActivePending
benefit_channel
pharmacy_onlymedical_onlydual_channel
relationship
treatspreventstreats_symptom_of
primary_condition_kind / condition_kind
diseasesymptomstateprocedureclassnone
condition_role
primaryassociatedtarget
condition_type
conditionsymptomcontextexternalclass
use_type
on_labeloff_label
confidence_tier
highmoderateunrated
primary_basis
single_coderoutesingle_agentpack_structureroute_preferenceprimary_reviewcurated
obsolete_reason
retiredobsoletenot_prescribable
price_source
nadacasp
billing_unit
EAMLGM
package_econ_confidence
highmediumlow
friction_category
very_lowlowmoderatehighvery_high
attribution_method
inferencebin_pcn_backfillbin_backfill
pharmacy_type
independent_unaffiliatednational_chainmass_merchltcgroceryspecialtyregionalmail_order
match_method
deterministicinferredcanada_only_strengthunmatched
Reference Tables

ICD-10 & ATC Access

The ref.icd10 and ref.atc tables are both queryable via the API and included in the sample bundle. They serve as join targets for enrichment queries and are independently browsable:

TableAPI endpointsSample bundle table
ref.icd10GET /v1/diagnoses/searchGET /v1/diagnoses/{icd10_code}icd10
ref.atcGET /v1/atc/searchGET /v1/atc/{atc_code_5}atc_rxnorm
Conventions

Column Naming

ConceptColumn NameRxNorm TTYExample
Drug (ingredient + form + strength)drug_idSCD / SBD / GPCK / BPCK617314
Ingredientingredient_rxcuiIN / MIN321988
Precise ingredient (salt)precise_ingredient_rxcuiPIN / IN221124
Clinical Drug Form (no strength)clinical_drug_form_rxcuiSCDF / SBDF370621
NDC 11-digitndc11—00071101301
NDC 9-digit (product)ndc9—000711013
NDC labelerlabeler_code—00071
HCPCS Codehcpcs_code—J7502
ATC Level 5 (substance)atc_code_5—C10AA05
ATC Level 4 (pharmacology class)atc4_code—C10AA
National Provider Identifiernpi—1234567890