Authored in FHIR Mapping Language. Executed natively in Python by the mapper; this map is the authored spec and a CI-only fidelity oracle.
| Canonical | https://emsinterop.com/fhir/StructureMap/NemsisEMedicationsToMedicationAdministration |
|---|---|
| Resource type | StructureMap |
| Status | draft |
../NemsisEMedicationsToMedicationAdministration.json
../NemsisEMedicationsToMedicationAdministration.fml — the authored FML source
{
"resourceType": "StructureMap",
"url": "https://emsinterop.com/fhir/StructureMap/NemsisEMedicationsToMedicationAdministration",
"name": "NemsisEMedicationsToMedicationAdministration",
"status": "draft",
"description": "Authored in FHIR Mapping Language. Executed natively in Python by the mapper; this map is the authored spec and a CI-only fidelity oracle.",
"_fml": "// NEMSIS eMedications.MedicationGroup -> FHIR R4 MedicationAdministration\n// The flagship PN rule (hard rule #4): a pertinent negative on eMedications.03\n// (contraindicated / refused / denied by order...) means the medication was\n// NOT given \u2014 status=not-done + statusReason \u2014 never a dropped element.\n// Dispatch is presence-driven: the oracle exporter emits either the valued\n// eMedications_03 (given) or eMedications_03_pn (withheld), never both.\n// Production execution is native Python (mapping/medications.py); the\n// reference Java engine runs this map in CI as the fidelity oracle.\n\nmap \"https://emsinterop.com/fhir/StructureMap/NemsisEMedicationsToMedicationAdministration\" = \"NemsisEMedicationsToMedicationAdministration\"\n\nuses \"https://emsinterop.com/fhir/StructureDefinition/NemsisEMedicationGroup\" alias EMedGroup as source\nuses \"http://hl7.org/fhir/StructureDefinition/MedicationAdministration\" alias MedicationAdministration as target\n\ngroup MedicationGroupToAdministration(source grp : EMedGroup, target tgt : MedicationAdministration) {\n grp.eMedications_01 as t -> tgt.effective = cast(t, \"dateTime\") \"effective\";\n\n // Given: RxNorm pass-through, status completed.\n grp.eMedications_03 as med -> tgt.status = 'completed', tgt.medication = create('CodeableConcept') as cc then {\n med -> cc.coding as c, c.system = 'http://www.nlm.nih.gov/research/umls/rxnorm', c.code = med \"medCoding\";\n } \"given\";\n\n // Withheld (pertinent negative): status not-done + NEMSIS-coded statusReason.\n grp.eMedications_03_pn as pn -> tgt.status = 'not-done', tgt.statusReason = create('CodeableConcept') as cc then {\n pn -> cc.coding as c, c.system = 'https://profiles.ihe.net/PCC/mPSC/CodeSystem/NEMSIS', c.code = pn \"pnCoding\";\n } \"withheld\";\n\n // Dosage only when the medication was given (route via cm-nemsis-medroute).\n grp.eMedications_03 as med -> tgt.dosage as d then {\n grp.eMedications_04 as rt -> d.route = create('CodeableConcept') as cc, cc.coding as c,\n c.system = 'http://snomed.info/sct',\n c.code = translate(rt, 'https://emsinterop.com/fhir/ConceptMap/cm-nemsis-medroute', 'code') \"route\";\n grp.eMedications_05 as dv -> d.dose as q, q.value = cast(dv, \"decimal\") \"doseValue\";\n } \"dosage\";\n}\n"
}