normalizing-rxnorm
它能做什么
这项技能把药品名称匹配到 RxNorm 编码,RxNorm 是美国标准的药物标识符,并能关联商品名、通用名和剂量。它使用免费的公共 RxNav 服务,因此无需许可证或密钥。适合为记录和数据交换而进行用药编码的团队。
适用场景
- ✓当记录中提到药物,而你需要每种药物有一个稳定编码的时候。
- ✓当你需要区分有效成分与带有剂量和剂型的可开具产品的时候。
- ✓当商品名和通用名需要合并为一个概念,或需要 NDC 编码的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/normalizing-rxnorm/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把记录中的这些药品名称匹配到 RxNorm 编码,包括剂量和剂型,并列出对应的通用名等效药。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把每个药品名称发送到公共 RxNav 服务,为有效成分或产品选择匹配的 RxCUI,并返回带名称的编码。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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/MedicationRequestcoded 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.
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:
# 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):
ndcs = requests.get(f"{BASE}/rxcui/{rxcui}/ndcs.json").json() # package codes
Workflow
- Extract drug spans with OpenMed (
pharma_detection_superclinical). - Parse each span into name + strength + dose form when present
("metformin 500 mg tablet" → ingredient
metformin, strength500 MG, formOral Tablet). - Exact match the cleaned name with
/rxcui.json?name=. If empty, fall back to/approximateTerm.json. - Pick the right term type (TTY) for your use case:
INingredient — analytics, allergy lists, class rollups.SCDgeneric product /SBDbrand product — orders, US Core Medication.BNbrand name,PINprecise ingredient — display/lineage.
- Validate by reading
/rxcui/{rxcui}/properties.jsonand confirming thettyandnamematch expectations; record thescorefrom approximate matches as a confidence signal. - 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 di
常见问题
它需要许可证或 API 密钥吗?
不需要。RxNav 服务是公开的,正常使用免费。
在美国以外有用吗?
RxNorm 以美国为中心,其他国家可能需要使用不同的药物编码系统。
它也提供包装编码吗?
可以。它可以为具体产品附上 NDC 编码。
详情
作者的原始描述
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
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14714
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
annotating-variants
5.8k帮你的智能体预测基因变异的作用,把 HGVS 名称转换为基因组位置,并使用免费的公共注释工具添加人群频率。
ask-openmed
5.8k帮你的智能体为临床文本请求选择合适的 OpenMed 工作流程,并在可能涉及患者数据时,先进行隐私检查。
assembling-fhir-bundles
5.8k把多份 FHIR 健康记录打包成一个事务 Bundle,可直接发送给 EHR 系统,并正确链接其中的内部引用。
auditing-deid-leakage
5.8k扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。