assembling-fhir-bundles
Fungsinya
Skill ini menggabungkan beberapa rekam kesehatan FHIR menjadi satu Bundle, sehingga sistem kesehatan bisa menerimanya bersama-sama. Skill ini untuk pengembang yang membangun ekspor data klinis untuk sistem rekam kesehatan elektronik.
Kapan dipakai
- โSaat Anda punya sekumpulan sumber daya FHIR yang harus dikirim ke EHR bersama-sama.
- โSaat sumber daya dalam kumpulan itu saling merujuk, misalnya kondisi yang menunjuk ke pasien.
- โSaat Anda perlu memilih antara Bundle transaksi dan batch untuk server FHIR.
Link skill
https://github.com/maziyarpanahi/openmed/blob/master/skills/assembling-fhir-bundles/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โSaya punya pasien, encounter, dan dua kondisi sebagai sumber daya FHIR. Kemas menjadi satu Bundle yang bisa saya kirim ke EHR.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent memberi identifier yang stabil untuk setiap sumber daya, menulis ulang referensi internal agar cocok, dan mengatur detail permintaan yang diharapkan server untuk jenis Bundle tersebut.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Assembling FHIR Bundles
A FHIR server ingests one transaction Bundle, not loose resources, and the
resources inside it must cross-reference each other (Condition.subject โ
Patient, Observation.encounter โ Encounter, DiagnosticReport.result โ
Observation). OpenMed ships a deterministic, mechanical Bundle assembler โ
openmed.clinical.exporters.fhir.to_bundle โ that wraps the resources you built
in exporting-to-fhir into a valid R4 Bundle and wires up the references.
When to use
Use after you have a list of standalone resources from exporting-to-fhir and
the destination is a FHIR server. Reach for it when the user says "build a
Bundle", "transaction", "POST these resources", or needs internal references
resolved. To check the Bundle against US Core, hand off to validating-us-core.
What OpenMed gives you (verified API)
from openmed.clinical.exporters.fhir import to_bundle, deterministic_fullurl
bundle = to_bundle(
resources, # Sequence[Mapping] each with a resourceType
doc_id="note-2024-03-02-001", # seeds stable urn:uuid fullUrls
bundle_type="transaction", # "transaction" | "batch" | "collection" | ...
)
to_bundle does exactly three things, and never synthesises or validates:
- Deterministic
fullUrl. Each resource gets aurn:uuidseeded bydoc_id+ its index, so the same input always produces byte-identical output (golden-test friendly). You can pre-compute the same urn withdeterministic_fullurl(doc_id, index). - Reference rewriting. Any
{"reference": "ResourceType/id"}whose target is present in the Bundle is repointed at that resource'sfullUrl. References to resources absent from the Bundle (e.g. a Patient removed by de-identification) are left untouched โ no dangling internal refs. - Request blocks. For
transaction/batchbundles each entry gets arequestblock ({"method": "POST", "url": "<ResourceType>"}) so the server knows to create it.
It raises ValueError if a resource lacks resourceType, or if two
resources share the same ResourceType/id (duplicate ids would silently corrupt
the reference map).
Quick start
from openmed.clinical.exporters.fhir import to_bundle
from openmed.clinical.exporters.codeable_concept_simple import coding, codeable_concept
condition = {
"resourceType": "Condition", "id": "cond-1",
"clinicalStatus": {"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
"code": "active"}]},
"code": codeable_concept(
[coding("snomed", "44054006", "Diabetes mellitus type 2")],
text="type 2 diabetes"),
"subject": {"reference": "Patient/patient-1"}, # internal ref, rewritten
}
medication = {
"resourceType": "MedicationStatement", "id": "med-1", "status": "active",
"medicationCodeableConcept": codeable_concept(
[coding("rxnorm", "860975", "metformin 500 MG Oral Tablet")],
text="metformin 500 mg"),
"subject": {"reference": "Patient/patient-1"},
}
patient = {
"resourceType": "Patient", "id": "patient-1",
"gender": "unknown", # de-identified, synthetic
}
bundle = to_bundle([patient, condition, medication],
doc_id="demo-note", bundle_type="transaction")
Worked: the transaction Bundle
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "urn:uuid:6f1c...e2",
"resource": { "resourceType": "Patient", "id": "patient-1", "gender": "unknown" },
"request": { "method": "POST", "url": "Patient" }
},
{
"fullUrl": "urn:uuid:9a3b...77",
"resource": {
"resourceType": "Condition", "id": "cond-1",
"subject": { "reference": "urn:uuid:6f1c...e2" }
},
"request": { "method": "POST", "url": "Condition" }
},
{
"fullUrl": "urn:uuid:c0d4...19",
"resource": {
"resourceType": "MedicationStatement", "id": "med-1",
"subject": { "reference": "urn:uuid:6f1c...e2" }
},
"request": { "method": "POST", "url": "MedicationStatement" }
}
]
}
Note Condition.subject and MedicationStatement.subject were rewritten from
"Patient/patient-1" to the Patient entry's fullUrl โ that is what makes the
transaction resolvable in a single POST.
Workflow
- Build resources with
exporting-to-fhir; give each a uniqueid. - Put a
Pertanyaan umum
Apakah skill ini memeriksa Bundle terhadap standar?
Tidak pada langkah ini. Pemeriksaan terhadap US Core ditangani oleh skill validasi terpisah.
Jenis Bundle apa yang didukung?
Skill mendukung Bundle transaksi dan batch, sehingga Anda memilih jenis yang sesuai dengan cara server menangani entri.
Apakah skill ini membuat sumber daya FHIR?
Tidak pada langkah ini. Skill mengemas sumber daya yang sudah dibuat pada langkah ekspor terpisah.
Detail
Deskripsi asli dari pembuat
Package multiple FHIR R4 resources produced from OpenMed output into a single valid transaction Bundle ready to POST to an EHR, using OpenMed's verified bundle assembler openmed.clinical.exporters.fhir.to_bundle. Covers deterministic urn:uuid fullUrls, automatic in-Bundle reference rewriting, request blocks (method/url) for transaction vs batch, and conditional create. Use after exporting-to-fhir when the user has several Condition/Observation/MedicationStatement resources and wants one transaction Bundle, mentions Bundle, transaction, references, or posting to a FHIR server. Builds on exporti
repo: maziyarpanahi/openmed
Popularitas
- Bintang GitHub
- 5.8k
- Peringkat
- #14667
- Lisensi
- Apache-2.0
- Diperbarui
- 2/11/2026
Komentar
- โฆ
Skill lain dari repositori ini
annotating-variants
5.8kMembantu agent Anda memperkirakan apa yang dilakukan varian genetik, mengubah nama HGVS menjadi posisi genom, dan menambahkan frekuensi populasi, dengan memakai anotator publik yang gratis.
ask-openmed
5.8kMembantu agent Anda memilih alur kerja OpenMed yang tepat untuk permintaan teks klinis, dimulai dengan pemeriksaan privasi setiap kali data pasien mungkin ada.
auditing-deid-leakage
5.8kMemindai teks klinis yang sudah dihapus identitasnya untuk mencari pengenal yang tertinggal, seperti nomor SSN, nomor kartu, email, dan tanggal, dan memblokir rilis jika masih ada.
auditing-deidentification-runs
5.8kMembuat catatan yang ditandatangani dan dapat direproduksi untuk sebuah proses penghapusan identitas, yang menunjukkan apa yang dihapus dan alasannya, tanpa data pasien di dalam catatan.
Skill serupa
discrawl
394kMemungkinkan agent Anda mencari dan merangkum arsip pesan Discord lokal yang tersimpan, memeriksa seberapa baru arsipnya, dan membaca pesan langsung.
clickhouse-io
280kMembantu agent Anda mengoptimalkan query dan skema di database ClickHouse dengan praktik terbaik analitik berperforma tinggi. Gunakan saat query analitik terlalu lambat.
scientific-db-pubmed-database
280kMembantu agent Anda mencari artikel ilmiah di bidang biomedis. Berguna untuk riset yang membutuhkan informasi medis spesifik.