building-with-openmed
它能做什么
这项技能是 OpenMed 的入门导览。OpenMed 是一个在你自己的电脑上分析和去标识化临床文本的库。适合刚开始临床或医疗文本项目、需要找到正确入口的团队。
适用场景
- ✓当你想安装 OpenMed,或用它开始一条临床文本流程的时候。
- ✓当你不确定哪项 OpenMed 功能或模型适合你的任务的时候。
- ✓当你需要为提取、去标识化或评估找到合适的专门 OpenMed 技能的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/building-with-openmed/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我正在做一个临床记录项目。应该使用 OpenMed 的哪些功能,来提取诊断并去除患者姓名?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会识别你的目标,把它对应到相应的 OpenMed 功能或专门技能,并指引你找到正确的第一步。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Building with OpenMed
OpenMed is an Apache-2.0, local-first Python library for clinical and biomedical NLP. Models download once from the Hugging Face Hub and then run fully on-device — no network calls, no telemetry, no raw PHI in logs, caches, or temp files. This skill is the map: it tells you what OpenMed can do and which focused skill (or API) to reach for next.
When to use this skill
Use it to scope a task and pick an entry point. For the actual work, hand off to the focused OpenMed skills (each is grounded in the real API):
| Task | Skill / API |
|---|---|
| Find and load a model | loading-openmed-models, choosing-openmed-models |
| Run clinical/biomedical NER | extracting-clinical-entities (openmed.analyze_text) |
| Zero-shot NER (no fine-tune) | running-zeroshot-ner (openmed zero) |
| Remove / mask PHI | deidentifying-clinical-text (openmed.deidentify) |
| Detect PHI spans only | extracting-pii-entities (openmed.extract_pii) |
| Restore masked PHI | reidentifying-text (openmed.reidentify) |
| Pick a privacy policy | configuring-privacy-policies (7 bundled profiles) |
| Non-English PHI | deidentifying-multilingual-text |
| Signed, no-PHI audit | auditing-deidentification-runs (audit=True) |
| Negation / temporality | resolving-clinical-context (openmed.clinical) |
| Evaluate with leakage gates | evaluating-with-leakage-gates (openmed.eval) |
| FHIR R4 export | exporting-to-fhir (openmed.interop) |
| Serve REST / MCP | serving-openmed-rest-api, deploying-openmed-mcp |
| Run on Apple Silicon / edge | running-openmed-ondevice (MLX / CoreML / ONNX) |
Install
pip install openmed # core: NER + de-identification
pip install "openmed[hf]" # add Hugging Face model downloads
pip install "openmed[mcp]" # Model Context Protocol server
pip install "openmed[service]" # FastAPI REST service
pip install "openmed[mlx]" # Apple Silicon acceleration
pip install "openmed[presidio]" # Microsoft Presidio bridge
Extras map to capabilities: cli, mcp, service, presidio, spacy,
langchain, gliner (zero-shot), multimodal/ocr-paddle (document intake),
mlx/coreml/onnx (on-device backends), hf (model hub), dev (tests/lint).
The three core calls
import openmed
# 1) Named-entity recognition (token classification)
result = openmed.analyze_text(
"Patient prescribed 500 mg metformin for type 2 diabetes.",
model_name="disease_detection_superclinical", # registry key, HF id, or local path
output_format="dict", # dict | json | html | csv
)
# 2) De-identify PHI (mask | remove | replace | hash | shift_dates)
deid = openmed.deidentify(
"John Doe (MRN 12345) seen on 2024-03-02.",
method="replace",
policy="hipaa_safe_harbor", # bundled policy profile
)
print(deid.deidentified_text) # PHI removed; deid.pii_entities lists the spans
# 3) Detect PHI spans without changing the text
pii = openmed.extract_pii("Call Dr. Smith at 617-555-0123.") # PredictionResult
spans = pii.entities # the PHI spans
analyze_text and deidentify are the workhorses. Everything else
(multilingual, audit, policies, FHIR, eval) layers on top of these.
Discover what is available at runtime
Never hardcode model lists or language counts — query them:
import openmed
openmed.list_model_categories() # e.g. Privacy, Disease, Oncology, Genomics ...
openmed.get_models_by_category("Disease")
openmed.get_pii_models_by_language("es")
from openmed.core.pii_i18n import SUPPORTED_LANGUAGES # de-id language set
CLI equivalents: openmed models list, openmed models info <key>,
openmed analyze --text "<text>" --model <key> --format json. MCP/REST expose
the same surface as tools (openmed_analyze_text, openmed_deidentify,
openmed_list_models, …).
Non-negotiable rules when building with OpenMed
- Local-first. Do not add cloud calls to PHI workflows. Models run on-device after a one-time download.
- No raw PHI in artifacts. Logs, caches, audit reports, and error messages
must use offsets, hashes, and labels — never plaintext identifiers. Use
audit=Truefor tamper-evident, no-PHI audit output. - Permissive licensing only. Do not bundle UMLS, SNOMED CT, CPT, MIMIC, i2b2, or n2c2 assets. Call restricted terminologies out-of-process with the user'
常见问题
OpenMed 会把我的数据发送到互联网上吗?
不会。模型从模型中心下载一次,之后的处理在你的设备上进行,不发起任何网络请求。
它会调用云服务吗?
不会。处理在本地运行,唯一的下载内容是来自模型中心的模型。
OpenMed 免费使用吗?
它是采用 Apache-2.0 许可证的库,因此属于开源软件。
详情
作者的原始描述
Orient and bootstrap any project that uses OpenMed, the on-device clinical and biomedical NLP library, for named-entity recognition, PHI de-identification, FHIR export, and evaluation. Use when the user mentions OpenMed, wants to install it, asks which OpenMed capability or model fits a task, or is starting to build a clinical/medical text pipeline and needs the right entry point.
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14680
- 许可证
- 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扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。