Normalizing Rxnorm logo

Normalizing Rxnorm

CommunityPopular
maziyarpanahi
normalizing-rxnorm

Normalizes drug mentions extracted by OpenMed to RxNorm RxCUIs using the free public RxNav/RxNorm REST API. Use when the user wants to code, standardize, or de-duplicate medication names, resolve a brand/generic/ingredient to a stable RxCUI, link strength+dose-form to an SCD/SBD, attach NDCs, or build a US Core Medication resource. Trigger keywords: RxNorm, RxCUI, RxNav, drug normalization, medication coding, NDC, ingredient, SCD, SBD, brand vs generic, getApproximateMatch. Pairs after OpenMed NER: consume Pharmaceutical/Chemical entities from openmed.analyze_text and map each drug span to an RxCUI. RxNorm and RxNav are fully public and free — no API key, no license barrier, the lowest-friction terminology in this set.

Overview

Publishermaziyarpanahi
Repositoryopenmed
Skill namenormalizing-rxnorm
Stars
5.3K
Forks
677
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by maziyarpanahi on GitHub. Read the source before you install it.

Installation

Install the Normalizing Rxnorm AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maziyarpanahi/openmed.git /tmp/openmed
mkdir -p .claude/skills
cp -r /tmp/openmed/skills/normalizing-rxnorm .claude/skills/normalizing-rxnorm
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Normalizing Rxnorm in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Normalizing Rxnorm on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Normalizing Rxnorm is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Normalizing drug mentions to RxNorm

Map free-text medication mentions that OpenMed extracts to RxNorm — the U.S. National Library of Medicine's normalized drug nomenclature. The unit of meaning is the RxCUI (RxNorm Concept Unique Identifier): a stable integer that ties together brand, generic, ingredient, strength, and dose form.

RxNorm and the RxNav REST API are fully public and free: no API key, no license agreement, no rate-limit registration for normal use. Of every skill in this terminology batch, this one has the highest value-to-friction ratio — start here when grounding medications.

When to use

  • A clinical note names drugs ("metformin 500 mg", "Lipitor", "amox/clav") and you need one stable code per drug for storage, analytics, or interoperability.
  • You must distinguish ingredient ("metformin", IN) from a prescribable product — SCD (Semantic Clinical Drug, generic) or SBD (Semantic Brand Drug) — e.g. "metformin 500 MG Oral Tablet".
  • You need to de-duplicate brand/generic synonyms onto one concept.
  • You need NDC codes (package-level) for a product, or a US Core Medication/MedicationRequest coded with RxNorm.

If the source text is non-English or you need ATC/SNOMED links instead, see mapping-to-snomed; RxNorm itself is U.S.-centric.

Quick start (real RxNav API calls)

Base URL: https://rxnav.nlm.nih.gov/REST. No auth. JSON via ?...&... paths ending in nothing or .json depending on endpoint; the REST root returns XML by default, so request JSON explicitly.

python
import requests

BASE = "https://rxnav.nlm.nih.gov/REST"

def rxcui_for(name: str) -> str | None:
    """Exact-match RxCUI lookup for a normalized drug name."""
    r = requests.get(f"{BASE}/rxcui.json", params={"name": name}, timeout=10)
    r.raise_for_status()
    ids = r.json().get("idGroup", {}).get("rxnormId", [])
    return ids[0] if ids else None

def approximate(name: str, max_entries: int = 3) -> list[dict]:
    """Fuzzy match for misspelled or abbreviated drug text."""
    r = requests.get(
        f"{BASE}/approximateTerm.json",
        params={"term": name, "maxEntries": max_entries},
        timeout=10,
    )
    r.raise_for_status()
    return r.json().get("approximateGroup", {}).get("candidate", [])

print(rxcui_for("metformin"))                       # -> '6809' (ingredient)
print(approximate("metformin 500"))                 # fuzzy -> candidate RxCUIs

Resolve a full prescribable product (ingredient + strength + form) to an SCD:

python
# getApproximateMatch / getRxConceptProperties give term type (TTY)
def properties(rxcui: str) -> dict:
    r = requests.get(f"{BASE}/rxcui/{rxcui}/properties.json", timeout=10)
    r.raise_for_status()
    return r.json().get("properties", {})

# Find the SCD ("metformin 500 MG Oral Tablet") from the ingredient:
def related_by_tty(rxcui: str, tty: str) -> list[dict]:
    r = requests.get(
        f"{BASE}/rxcui/{rxcui}/related.json", params={"tty": tty}, timeout=10
    )
    r.raise_for_status()
    groups = r.json().get("relatedGroup", {}).get("conceptGroup", [])
    out = []
    for g in groups:
        out.extend(g.get("conceptProperties", []) or [])
    return out

Attach NDCs and check interactions (both public):

python
ndcs = requests.get(f"{BASE}/rxcui/{rxcui}/ndcs.json").json()   # package codes

Workflow

  1. Extract drug spans with OpenMed (pharma_detection_superclinical).
  2. Parse each span into name + strength + dose form when present ("metformin 500 mg tablet" → ingredient metformin, strength 500 MG, form Oral Tablet).
  3. Exact match the cleaned name with /rxcui.json?name=. If empty, fall back to /approximateTerm.json.
  4. Pick the right term type (TTY) for your use case:
    • IN ingredient — analytics, allergy lists, class rollups.
    • SCD generic product / SBD brand product — orders, US Core Medication.
    • BN brand name, PIN precise ingredient — display/lineage.
  5. Validate by reading /rxcui/{rxcui}/properties.json and confirming the tty and name match expectations; record the score from approximate matches as a confidence signal.
  6. Emit {system: "http://www.nlm.nih.gov/research/umls/rxnorm", code, display}.

Hand-off from OpenMed

OpenMed's analyze_text returns a dict whose entities list contains, per span, the keys text, label, confidence, start, end. Consume the Pharmaceutical/Chemical entities directly:

python
import openmed, requests

note = "Patient on metformin 500 mg BID and atorvastatin 20 mg nightly."
result = openmed.analyze_text(
    note,
    model_name="pharma_detection_superclinical",   # Pharmaceutical category
    output_format="dict",
)

DRUG_LABELS = {"DRUG", "MEDICATION", "CHEM"}        # OpenMed Pharmaceutical labels
for ent in result["entities"]:
    if ent["label"] in DRUG_LABELS:
        span = ent["text"]                          # e.g. "metformin"
        rxcui = rxcui_for(span) or (
            (approximate(span) or [{}])[0].get("rxcui")
        )
        print(span, "->", rxcui, f"(conf {ent['confidence']:.2f})")

Keep OpenMed's character offsets (start/end) alongside the RxCUI so every code is traceable back to the exact source span — never store the raw note text in your mapping table.

Edge cases & gotchas

  • Strength/form live in separate spans. OpenMed labels the drug name; the "500 mg" and "tablet" may be adjacent tokens. Reassemble using offsets before querying for an SCD, or you will only get the ingredient.
  • Combination products ("amoxicillin/clavulanate") normalize to a single multi-ingredient SCD; do not split them into two RxCUIs.
  • Brand vs generic. Lipitor (SBD/BN) and atorvastatin (IN/SCD) are different RxCUIs of the same drug. Decide up front which TTY your pipeline stores and map the other via /related.json.
  • Approximate-match noise. approximateTerm will happily return a candidate for garbage input. Gate on the returned score and re-validate with /properties.json before trusting it.
  • Obsolete RxCUIs. Use /rxcui/{rxcui}/historystatus.json to detect retired/remapped concepts; follow the remap rather than storing a dead code.
  • Licensing: none for RxNorm/RxNav. RxNorm is public domain. But RxNorm includes source vocabularies (e.g. some proprietary drug data) whose own terms-of-use apply if you redistribute the full dataset — calling the live API for normalization is unrestricted. Do not bundle UMLS to get RxNorm; RxNav is the clean path.
  • Local-first stays intact. Run OpenMed NER on-device; only the de-identified drug string leaves the process to hit RxNav. Never send a raw note containing PHI to the API.

Standards & references

Frequently asked questions

What does the Normalizing Rxnorm AI skill do?

Normalizes drug mentions extracted by OpenMed to RxNorm RxCUIs using the free public RxNav/RxNorm REST API. Use when the user wants to code, standardize, or de-duplicate medication names, resolve a brand/generic/ingredient to a stable RxCUI, link strength+dose-form to an SCD/SBD, attach NDCs, or build a US Core Medication resource. Trigger keywords: RxNorm, RxCUI, RxNav, drug normalization, medication coding, NDC, ingredient, SCD, SBD, brand vs generic, getApproximateMatch. Pairs after OpenMed NER: consume Pharmaceutical/Chemical entities from openmed.analyze_text and map each drug span to...

Why use Normalizing Rxnorm on TypingMind?

Because you install it once and use it with any model. Normalizing Rxnorm is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Normalizing Rxnorm in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/maziyarpanahi/openmed/tree/master/skills/normalizing-rxnorm. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Normalizing Rxnorm?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Normalizing Rxnorm?

As many as you like. As long as a model supports skills, you can use Normalizing Rxnorm with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Normalizing Rxnorm AI skill free?

Yes. It is published on GitHub by maziyarpanahi under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇