extract-clinical-entities-to-fhir
できること
このスキルは、合成または匿名化済みのテキストから臨床エンティティを抽出し、ConditionやObservationなどのFHIR R4のリソースに対応づけます。ローカルの臨床テキストから構造化されたFHIRの出力が必要で、承認された情報源からのみコードを加える開発者向けです。
使う場面
- ✓エージェントが、臨床テキストをFHIRのConditionやObservationのリソースに変える必要があるとき。
- ✓抽出と臨床のコード化の判断を、分けておきたいとき。
- ✓元のテキストが合成データか、抽出の前に信頼境界の中で匿名化済みのとき。
スキルのリンク
https://github.com/maziyarpanahi/openmed/blob/master/skills/extract-clinical-entities-to-fhir/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
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
- Keep the source synthetic, or de-identify it inside the trusted boundary before extraction.
- Run
openmed.analyze_textwith the task-appropriate clinical model. - Filter predictions by label and confidence; preserve offsets in a PHI-safe audit record.
- Map each accepted span to the correct FHIR resource type.
- Add terminology codes only from a user-approved mapping or terminology service. Never invent a code.
- Assemble resources with
to_bundleand 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
CodeableConceptwhen 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などのコードを自分で付けますか?
いいえ。コードは、あなたが承認した対応づけか、用語のサービスからのみ得られます。
どのテキストが許可されていますか?
合成のテキスト、または信頼境界の内側で抽出の前に匿名化されたテキストが必要です。
出力を確認しますか?
ガイダンスでは、対象のプロファイルに対してリソースを検証するよう求めています。
詳細
作者による元の説明
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
コメント
- …
このリポジトリの他のスキル
annotating-variants
5.8kエージェントが、無料の公開アノテーターを使って、遺伝子バリアントの作用を予測し、HGVS名をゲノム上の位置に変換し、集団の頻度を付与できるよう支援します。
ask-openmed
5.8kエージェントが、臨床テキストの依頼に合ったOpenMedのワークフローを選べるよう支援します。患者データが含まれる可能性がある場合は、必ずプライバシーの確認から始めます。
assembling-fhir-bundles
5.8kエージェントが、複数のFHIR健康記録を、内部の参照を正しくつないだ一つのトランザクションBundleにまとめ、EHRに送れる状態にします。
auditing-deid-leakage
5.8kエージェントが、匿名化済みの臨床テキストに残っている識別子(SSN、カード番号、メール、日付など)をスキャンし、残っていれば公開を止めます。
似ているスキル
discrawl
394k保存済みのローカルなDiscordメッセージのアーカイブを検索して要約し、その新しさを確認し、ダイレクトメッセージを読めるようエージェントを支援します。
clickhouse-io
280kエージェントがClickHouseデータベースのクエリとスキーマを最適化できるようにします。高性能な分析処理向けのベストプラクティスを適用します。分析クエリが遅すぎるときに使います。
scientific-db-pubmed-database
280kエージェントが生物医学分野の科学論文を検索するのに役立ちます。特定の医療情報が必要な研究に便利です。