跳到正文
Skillpedia
数据库5.8k · #14698

extract-clinical-entities-to-fhir

它能做什么

这项技能从合成或已去标识化的文本中提取临床实体,并将其映射为 FHIR R4 资源,例如 Condition 或 Observation。适合需要从本地临床文本生成结构化 FHIR 输出的开发者,编码只能来自经批准的来源。

适用场景

  • ✓当智能体需要把临床文本转换为 FHIR Condition 或 Observation 资源的时候。
  • ✓当你希望把实体提取与临床编码决定分开处理的时候。
  • ✓当源文本是合成数据,或已经完成去标识化的时候。

技能链接

https://github.com/maziyarpanahi/openmed/blob/master/skills/extract-clinical-entities-to-fhir/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/maziyarpanahi/openmed/blob/master/skills/extract-clinical-entities-to-fhir/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请从这份合成记录中提取诊断,并把每个诊断转换为 Bundle 中的一个 FHIR Condition。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会运行实体提取,只保留置信度高于阈值且属于已接受标签的实体,将每个实体映射到资源类型,然后组装 Bundle。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Extract clinical entities to FHIR

Separate extraction from clinical coding. OpenMed finds spans and supplies the mechanical FHIR builders; the application decides which resource type and status are clinically appropriate.

Procedure

  1. Keep the source synthetic, or de-identify it inside the trusted boundary before extraction.
  2. Run openmed.analyze_text with the task-appropriate clinical model.
  3. Filter predictions by label and confidence; preserve offsets in a PHI-safe audit record.
  4. Map each accepted span to the correct FHIR resource type.
  5. Add terminology codes only from a user-approved mapping or terminology service. Never invent a code.
  6. Assemble resources with to_bundle and validate against the target profile.

Runnable synthetic example

Install the model runtime first with python -m pip install "openmed[hf]".

import json

from openmed import analyze_text
from openmed.clinical.exporters.fhir import to_bundle

note = "Assessment: type 2 diabetes mellitus is stable on metformin."
result = analyze_text(
    note,
    model_name="disease_detection_superclinical",
    confidence_threshold=0.5,
)

resources = [{"resourceType": "Patient", "id": "synthetic-patient"}]
for index, entity in enumerate(result.entities, start=1):
    if entity.label.upper() not in {"CONDITION", "DIAGNOSIS", "DISEASE"}:
        continue
    resources.append(
        {
            "resourceType": "Condition",
            "id": f"condition-{index}",
            "clinicalStatus": {
                "coding": [
                    {
                        "system": (
                            "http://terminology.hl7.org/CodeSystem/"
                            "condition-clinical"
                        ),
                        "code": "active",
                    }
                ]
            },
            "verificationStatus": {
                "coding": [
                    {
                        "system": (
                            "http://terminology.hl7.org/CodeSystem/"
                            "condition-ver-status"
                        ),
                        "code": "confirmed",
                    }
                ]
            },
            # A text-only CodeableConcept is preferable to an invented code.
            "code": {"text": entity.text},
            "subject": {"reference": "Patient/synthetic-patient"},
        }
    )

if len(resources) == 1:
    raise RuntimeError("No condition spans met the label and confidence rules")

bundle = to_bundle(resources, doc_id="synthetic-note-001")
print(json.dumps(bundle, indent=2))

Safety checks

  • Do not put raw identifiers, source text, or reversible mappings in logs, OperationOutcome.diagnostics, or trace metadata.
  • Keep a patient identity service separate from extracted clinical facts.
  • Preserve negation, temporality, and experiencer context before asserting a resource as active or confirmed.
  • Use a text-only CodeableConcept when no approved code is available.
  • Validate the Bundle against the receiver's FHIR and profile requirements.
  • Do not bundle restricted terminologies; use the user's licensed service.

Repository example

Read and run the redaction-to-FHIR walkthrough for an offline-friendly pipeline with deterministic extraction.

常见问题

它会自行添加 ICD-10 之类的编码吗?

不会。编码只能来自你批准的映射,或来自术语服务。

允许使用哪些文本?

指引要求使用合成文本,或在可信边界内、提取之前已完成去标识化的文本。

它会检查输出结果吗?

指引要求根据目标配置文件(profile)验证资源。

详情

作者的原始描述

Extract clinical entities from synthetic or already de-identified text with OpenMed and map them into deterministic FHIR R4 resources and a Bundle. Use when an agent must turn local clinical NER output into Conditions, MedicationStatements, Observations, or other FHIR resources without inventing terminology codes.

repo: maziyarpanahi/openmed

热度

GitHub 星标
5.8k
排名
#14698
许可证
Apache-2.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能