Skip to content
healthcare.dev

Build a medication list normalizer with NDC to RxNorm

Every packager and package size gets its own NDC. Analytics, formularies and medication reconciliation tools need them grouped by what the drug is, which is what RxNorm gives you.
Data
NDC, RxNorm
Endpoints
/v1/drugs/ndc/{ndc}
/v1/drugs/rxnorm/{rxcui}
MCP tools
map_ndc_to_rxnorm, lookup_drug
Plan
Runs on the Free plan

How it works

  1. Look up each NDC (product, package or 11-digit) in the FDA NDC Directory.
  2. Read the linked RxNorm concept ids.
  3. Group your rows by RxCUI and label each group with the concept's name.

The code

TypeScript with @healthcare.dev/sdk. Set HDEV_API_KEY to a free key and run it. Every response carries its source, release and license in meta.

TypeScript
import { HealthcareDev } from "@healthcare.dev/sdk";

const hdev = new HealthcareDev();

export async function groupByRxNorm(ndcs: string[]) {
  const groups = new Map<string, { name: string; ndcs: string[] }>();
  for (const ndc of ndcs) {
    const { data: product } = await hdev.drugs.ndc(ndc);
    for (const rxcui of product.rxcuis) {
      if (!groups.has(rxcui)) {
        const { data: concept } = await hdev.drugs.rxnorm(rxcui);
        groups.set(rxcui, { name: concept.name, ndcs: [] });
      }
      groups.get(rxcui)!.ndcs.push(ndc);
    }
  }
  return [...groups].map(([rxcui, g]) => ({ rxcui, ...g }));
}

await groupByRxNorm(["0002-0152-01", "0002-1433-80"]);

Or ask your agent

Connect the MCP server and ask in plain language. It calls map_ndc_to_rxnorm, lookup_drug and cites what it found.

Prompt
Map NDC 0002-0152-01 to RxNorm and tell me the ingredient and strength.

Take it further

  • Cache RxCUI lookups: concepts change far less often than NDC listings.
  • Flag NDCs whose status is retired or that have a replaced_by record.
  • Add NADAC prices per group to compare packages of the same drug.

Reference data only, not medical advice or a coverage determination. Send codes, NDCs and NPIs, never patient information.

More examples