querying-openfda-labels
它能做什么
这项技能教智能体如何在免费的 OpenFDA 服务中查询美国 FDA 官方的药品信息,包括处方说明书细节、包装编码和召回报告。
适用场景
- ✓当用户需要某种药物的官方黑框警告或获批用途的时候。
- ✓当用户想查询某个药品产品的包装编码或剂型的时候。
- ✓当用户想确认某种药物是否存在尚未结束的召回的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/querying-openfda-labels/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我查询我正在研究的这种药物的黑框警告和获批用途。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会向公共的 OpenFDA 网络服务发送搜索,获取说明书、产品编码和召回数据,并把匹配的字段作为事实报告,供人阅读。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Querying OpenFDA drug labels, NDC, and recalls
Once OpenMed has pulled a drug name out of a note, you often need authoritative product facts: the boxed warning, approved indications, dosage form / route, package NDC codes, and whether the product is under recall. The FDA's OpenFDA API exposes the Structured Product Labeling (SPL), the NDC directory, and enforcement (recall) reports — all public and free.
This skill is enrichment: it attaches regulatory facts to an extracted drug. It is not clinical decision support — a label lookup informs a human, it does not prescribe.
When to use
- You extracted a drug and need its boxed warning or indications for display, alerting, or expectedness checks.
- You need NDC package codes, dosage form, or route for a product.
- You want to know if a drug/lot is under an open recall (enforcement).
- You want to map a brand name to its generic ingredient and RxCUI via the
label's
openfdablock.
The three endpoints
| Endpoint | Use | Key fields |
|---|---|---|
https://api.fda.gov/drug/label.json |
SPL prescribing info | boxed_warning, indications_and_usage, warnings, dosage_and_administration, openfda.brand_name, openfda.generic_name, openfda.rxcui, openfda.product_ndc |
https://api.fda.gov/drug/ndc.json |
NDC directory | product_ndc, generic_name, brand_name, dosage_form, route, active_ingredients |
https://api.fda.gov/drug/enforcement.json |
Recalls | product_description, reason_for_recall, classification (Class I/II/III), recalling_firm, status, recall_initiation_date |
No key needed to try it (240 req/min, 1,000/day per IP). A free api_key= raises
the daily cap to 120,000.
Quick start (real OpenFDA queries)
import requests
def openfda(endpoint: str, search: str, limit: int = 1) -> list[dict]:
url = f"https://api.fda.gov/drug/{endpoint}.json"
r = requests.get(url, params={"search": search, "limit": limit}, timeout=30)
if r.status_code == 404: # OpenFDA returns 404 for zero matches
return []
r.raise_for_status()
return r.json().get("results", [])
# 1) Label: boxed warning + indications for a generic drug.
label = openfda("label", 'openfda.generic_name:"warfarin"')
if label:
rec = label[0]
print("Boxed warning:", rec.get("boxed_warning", ["(none)"])[0][:200])
print("Indication:", rec.get("indications_and_usage", ["(none)"])[0][:200])
print("RxCUI:", rec.get("openfda", {}).get("rxcui"))
# 2) NDC: package codes, form, route.
ndc = openfda("ndc", 'generic_name:"warfarin"', limit=5)
for rec in ndc:
print(rec["product_ndc"], rec.get("dosage_form"), rec.get("route"))
# 3) Enforcement: open recalls for a product.
recalls = openfda("enforcement",
'product_description:"warfarin"+AND+status:"Ongoing"', limit=5)
for rec in recalls:
print(rec["classification"], "-", rec["reason_for_recall"][:120])
Workflow
- Normalize the drug name first. Use
openmed.analyze_textto get the span, then prefer the RxNorm ingredient (seenormalizing-rxnorm) as your query term —openfda.generic_nameand the NDCgeneric_nameindex on the ingredient, so a normalized name hits far more records than raw note text. - Query
/drug/labelwithopenfda.generic_name:"<ingredient>"(oropenfda.rxcui:"<rxcui>"for an exact product). Readboxed_warning,indications_and_usage,warnings_and_cautions. - Query
/drug/ndcfor package-level codes, dosage form, and route. - Query
/drug/enforcementfiltered tostatus:"Ongoing"to surface open recalls; gate alerts onclassification(Class I = most serious). - Cache results — labels change rarely; you do not need to re-query per note.
- Attach the facts to the extracted drug keyed by RxCUI/NDC for traceability.
Hand-off to / from OpenMed
OpenMed's analyze_text returns a dict; result["entities"] items carry
text, label, confidence, start, end.
- From
extracting-clinical-entities: Pharmaceutical/Chemical entities are the query seeds. Fromnormalizing-rxnorm: pass the RxCUI toopenfda.rxcui:"..."for an exact label match. - To
reporting-adverse-events: the boxed warning / indications support an expectedness judgment (is this reaction labeled?). Todetecting-pv-signals: confirm whether a disproportionality signal is already
常见问题
OpenFDA 免费使用吗?
免费。这项技能把 OpenFDA 描述为公开且免费的服务。
它能查到商品名对应的通用名吗?
可以。说明书数据包含商品名、通用名和 RxCUI 编码。
这属于医疗建议吗?
不属于。这项技能说明,查询说明书只是为人提供信息,并不开具治疗方案。
详情
作者的原始描述
Looks up FDA drug labels, NDC directory entries, indications, boxed warnings, and recalls/enforcement actions via the free public OpenFDA API to enrich drugs that OpenMed extracts. Use when the user wants the prescribing information for a drug, its boxed warning, approved indications, dosage forms and routes, package NDC codes, RxCUI, or whether a product has an open recall. Trigger keywords: OpenFDA, drug label, SPL, prescribing information, boxed warning, black box warning, indications, NDC, package code, recall, enforcement, Class I recall, drug enrichment. Pairs adjacent to OpenMed NER: ta
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14721
- 许可证
- 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扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。