exporting-to-fhir
できること
このスキルは、ノートにある臨床上の所見を、ConditionやMedicationStatementなどのFHIR R4の健康リソースに変換し、コード化された概念を付けます。電子カルテシステム向けのエクスポートを作る開発者向けです。
使う場面
- ✓臨床上の所見を、構造化されたリソースとしてEHRやFHIRのシステムに送る必要があるとき。
- ✓RxNorm、LOINC、ICD-10、SNOMEDなどのコード化された概念が必要なとき。
- ✓NERの出力から、ConditionやMedicationStatement、Observationのリソースを作りたいとき。
スキルのリンク
https://github.com/maziyarpanahi/openmed/blob/master/skills/exporting-to-fhir/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このノートにある診断と薬を、コード付きのFHIRのConditionとMedicationStatementのリソースにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、OpenMedの補助機能を使ってコード化された概念とリソースの構造を作ります。どの所見がどのリソースになるかという臨床上の対応づけは、利用者が用意します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Exporting to FHIR
OpenMed's NER (openmed.analyze_text) returns spans — text, label, offsets,
confidence. To make those spans interoperable you wrap each clinically relevant
span in a FHIR R4 resource (Condition, MedicationStatement,
Observation, ...) carrying a coded CodeableConcept. OpenMed ships the
mechanical R4 export helpers for this in openmed.clinical.exporters; you
own the small amount of clinical mapping (which span becomes which resource).
When to use
Use this after NER, when the consumer is a FHIR system (an EHR, a registry, a
data lake on FHIR). Reach for it when the user says "export to FHIR", "make a
Condition/Observation", "build a CodeableConcept", or needs RxNorm/LOINC/ICD-10/
SNOMED-coded resources. For packaging many resources into one transaction
Bundle, hand off to assembling-fhir-bundles. To check the result against US
Core, hand off to validating-us-core.
What OpenMed gives you (verified API)
OpenMed deliberately ships the purely mechanical pieces and leaves clinical judgement to you. The verified entry points:
# CodeableConcept builder — openmed/clinical/exporters/codeable_concept_simple.py
from openmed.clinical.exporters.codeable_concept_simple import (
system_uri, # vocab id -> canonical HL7 system URI
coding, # (system, code, display) -> Coding dict
codeable_concept, # [Coding, ...] -> CodeableConcept dict (deterministic order)
)
# Bundle + reference + OperationOutcome — openmed/clinical/exporters/fhir/
from openmed.clinical.exporters.fhir import (
to_bundle, # [resource, ...] -> R4 transaction Bundle
deterministic_fullurl, # (doc_id, index) -> stable urn:uuid
OperationOutcomeIssue, # issue dataclass
to_operation_outcome, # [issue, ...] -> OperationOutcome
from_validation_result, # validator result -> OperationOutcome
)
system_uri knows these vocabularies out of the box: rxnorm, icd-10-cm,
loinc, snomed, hpo, mesh (and passes through any http(s):// URI
unchanged). It is the single source of truth for vocab-id → system-URI mapping.
There is no to_condition() / to_observation() magic function. You build
the resource shell (a small dict) and drop a codeable_concept(...) into its
coded slot. That is by design: the resource type and clinical status are
decisions OpenMed will not make for you.
Quick start: entity → Condition
import openmed
from openmed.clinical.exporters.codeable_concept_simple import coding, codeable_concept
# 1) NER (synthetic note — no real PHI)
result = openmed.analyze_text(
"Assessment: type 2 diabetes mellitus, stable.",
model_name="disease_detection_superclinical",
)
# result.entities -> EntityPrediction(text, label, confidence, start, end)
span = result.entities[0] # e.g. text="type 2 diabetes mellitus"
# 2) Ground to a code OUT OF PROCESS (your terminology server / mapping table).
# OpenMed bundles no restricted vocab — see querying-terminology-service.
icd_code, snomed_code = "E11.9", "44054006"
# 3) Build the CodeableConcept with OpenMed's builder
cc = codeable_concept(
[
coding("snomed", snomed_code, "Diabetes mellitus type 2"),
coding("icd-10-cm", icd_code, "Type 2 diabetes mellitus without complications"),
],
text=span.text,
)
# 4) Assemble the resource shell yourself
condition = {
"resourceType": "Condition",
"id": "cond-1",
"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",
}]
},
"category": [{
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/condition-category",
"code": "encounter-diagnosis",
}]
}],
"code": cc, # OpenMed-built CodeableConcept
"subject": {"reference": "Patient/patient-1"},
"recordedDate": "2024-03-02",
}
codeable_concept sorts codings deterministically (SNOMED, LOINC, RxNorm,
ICD-10-CM, HPO, MeSH first; everything else alphabetical), so the JSON is
byte-stable across runs — important for diffable pipelines and golden tests.
Worked: the resulting Condition.code
{
"code": {
"codi
よくある質問
エージェントがコードを選びますか?
このスキルは機械的な作成の機能を提供します。用語のコードと臨床上の対応づけは、利用者が承認します。
多くのリソースを一度にアップロードするには?
別のバンドルのスキルが、それらを一つのトランザクションのBundleにまとめます。
US Coreに照らして確認しますか?
その確認は、別の検証のスキルに任せます。
詳細
作者による元の説明
Convert OpenMed NER output (entities from openmed.analyze_text) into FHIR R4 resources — Condition, MedicationStatement, Observation — using OpenMed's built-in FHIR R4 export helpers in openmed.clinical.exporters. Covers the verified CodeableConcept builder (coding, codeable_concept, system_uri), deterministic fullUrl references, and OperationOutcome reporting. Use after running OpenMed NER when the user wants standards-conformant FHIR JSON, mentions FHIR, Condition/Observation/MedicationStatement, CodeableConcept, RxNorm/LOINC/ICD-10/SNOMED coding, or interoperability with an EHR. Pairs after
repo: maziyarpanahi/openmed
人気
- GitHubのスター
- 5.8k
- ランキング
- #14697
- ライセンス
- 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エージェントが生物医学分野の科学論文を検索するのに役立ちます。特定の医療情報が必要な研究に便利です。