Best for
- 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 r…
maziyarpanahi/openmed/skills/assembling-fhir-bundles/SKILL.md
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 transact
Decision brief
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 Bundl…
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/maziyarpanahi/openmed --skill "skills/assembling-fhir-bundles"Inspect the Agent Skill "assembling-fhir-bundles" from https://github.com/maziyarpanahi/openmed/blob/e412ae8f3b04ae79b13663d34a422efc22109a3a/skills/assembling-fhir-bundles/SKILL.md at commit e412ae8f3b04ae79b13663d34a422efc22109a3a. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Review the “Quick start” section in the pinned source before continuing.
1. Build resources with exporting-to-fhir; give each a unique id. 2. Put any resource you reference inside the same Bundle — including the Patient — so the reference resolves. References to resources you intend to be already on the server (e.g. an existing Patient) are left as l…
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, han…
tobundle does exactly three things, and never synthesises or validates:
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.
Permission review
The documentation includes network, browsing, or remote request actions.
`request` block (`{"method": "POST", "url": "<ResourceType>"}`) so the serverThe documentation includes network, browsing, or remote request actions.
"system": "http://terminology.hl7.org/CodeSystem/condition-clinical",Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 88/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 4,847 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
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.
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.
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:
fullUrl. Each resource gets a urn:uuid seeded by
doc_id + its index, so the same input always produces byte-identical
output (golden-test friendly). You can pre-compute the same urn with
deterministic_fullurl(doc_id, index).{"reference": "ResourceType/id"} whose target
is present in the Bundle is repointed at that resource's fullUrl. References
to resources absent from the Bundle (e.g. a Patient removed by
de-identification) are left untouched — no dangling internal refs.transaction/batch bundles each entry gets a
request block ({"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).
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")
{
"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.
exporting-to-fhir; give each a unique id."Patient/<id>"; resolve those with conditional create (below).to_bundle(resources, doc_id=<stable>, bundle_type="transaction").POST [base] {Bundle}.validating-us-core).to_bundle writes POST <ResourceType> request blocks. To make a transaction
idempotent, post-process the entry's request to add an ifNoneExist query
so the server reuses an existing match instead of creating a duplicate:
for entry in bundle["entry"]:
if entry["resource"]["resourceType"] == "Patient":
entry["request"]["ifNoneExist"] = "identifier=http://hospital.example|MRN-REDACTED"
The server creates the Patient only if no match exists; otherwise it links the
references to the existing one. PUT with a known id is the alternative for
true upserts.
exporting-to-fhir, which in
turn comes from openmed.analyze_text. Keep doc_id stable per source
document so re-running the pipeline yields the same Bundle.openmed.interop.fhir_operations.de_identify_bundle(bundle)
walks every entry's free text + XHTML narrative and de-identifies it while
preserving Bundle type, entry order, fullUrls, request blocks, and
references — codes, systems, and temporal values are never altered. Use it as
a final safety pass before transmission if any narrative might carry PHI.OperationOutcome on error).
Surface those to the user; for your own pre-flight findings use
to_operation_outcome(...) from the same package.id are valid but unreferenceable — nothing can
point at them and they will not be reference-rewrite targets.ResourceType/id raises. This is intentional: a duplicate id
would silently overwrite an entry in the reference map and corrupt
cross-references. Make ids unique."Patient/existing-123" you mean to resolve on
the server stays literal — pair it with ifNoneExist or a PUT.transaction vs batch. transaction is atomic (all-or-nothing, server
resolves urn:uuid references); batch is independent per-entry and does not
guarantee reference resolution. Use transaction when entries reference each
other.collection/document bundles get no request blocks (only
transaction/batch do) — correct, since they are not meant to be POSTed for
creation.validating-us-core before
submission.fullUrl resolution: https://hl7.org/fhir/R4/bundle.html#referencesifNoneExist): https://hl7.org/fhir/R4/http.html#cond-updateAlternatives
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing
HKUDS/Vibe-Trading
Create, modify, and optimize quantitative trading strategies, then backtest and evaluate them.
K-Dense-AI/scientific-agent-skills
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.