```html <!doctype html> Metformin IQVIA–SDUD–NADAC Integration: Methods & Data Documentation

Metformin IQVIA–SDUD–NADAC Integration: Methods & Data Documentation

Last updated: 2025-09-14

Purpose

We built a monthly NDC11 × date panel by merging IQVIA volumes, Medicaid SDUD units/prescriptions/spend, and NADAC prices. Pre-Jul 2019 IQVIA rows lacked NDCs, so we backfilled them using a product signature from 2019+, optionally splitting across multiple NDCs by 2019+ shares.


Inputs (relative to project Data/ root)

Key normalization

NDC normalization

Product signature (for pre-2019)

Canonicalized concat of Combined Molecule + Manufacturer + Prod Form2 + Product Sum + Strength (separates GLUCOPHAGE vs GLUCOPHAGE XR).

IQVIA processing

  1. 2019+ with NDC: tidy long: ndc11, signature, date, metric∈{TRx, Extended Units}, volume + meta.
  2. Learn signature → NDC shares: weight = TRx + Extended Units; convert to within-signature shares; optionally drop tiny shares via --share-min; save signature_to_ndc_mapping.csv.
  3. 2015–Jun 2019 (no NDC): tidy by signature, date, metric, volume (drop “Grand Total”).
  4. Backfill: proportional (split by shares, add alloc_share) or modal (pick top NDC).
  5. Concat pre-2019 + 2019+; pivot to wide by (ndc11, date): iqvia_trx, iqvia_extended_units. Meta kept via per-NDC mode.

Audit: pre_allocation_audit.csv compares pre-2019 source vs allocated totals by (signature, date, metric); delta ≈ 0.

SDUD processing

Aggregate to ndc11 × month (national): units, prescriptions, and spend; derive:

NADAC processing

Normalize all weekly files and average to month-end: nadac_price (mean), n_obs, pricing_unit_mode. Optional filter --nadac-units (e.g., EA).

Merge logic

  1. Start with IQVIA wide.
  2. Left-join SDUD by (ndc11, date).
  3. Left-join NADAC by (ndc11, date).
  4. Attach per-NDC meta (mode), drop invalid NDCs, format date.

Outputs

Diagnostics

Reproducing

python -u src/iqvia_with_sdud_nadac.py \
  --data-dir "<path to Data root>" \
  --iqvia-xlsx "06 - Metformin Data/IQVIA/Metformin Jul 2019 - Jun 2025 NDC Level.xlsx" \
  --iqvia-pre2019-xlsx "06 - Metformin Data/IQVIA/Metformin Jan 2015 - Mar 2025 No NDC.xlsx" \
  --out-csv "06 - Metformin Data/IQVIA/iqvia_with_sdud_nadac.cleaned.csv" \
  --mapping-csv "06 - Metformin Data/IQVIA/signature_to_ndc_mapping.csv" \
  --nadac-units EA \
  --pre-mapping-strategy proportional \
  --share-min 0.01

Notes & limitations

Data dictionary (selected)