CDA-FHIR-Maps (R4)
0.3.0 - DSTU 1
This page is part of the CDA-FHIR-Maps (R4) (v0.3.0: DSTU 1) based on FHIR R4. . For a full list of available versions, see the Directory of published versions
{
"resourceType" : "StructureMap",
"id" : "BundleToCdaChEmed",
"meta" : {
"versionId" : "2",
"lastUpdated" : "2021-11-04T13:41:21.790+01:00"
},
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <pre>map "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmed" = "BundleToCdaChEmed"\n\n\n// Medication Entries\n// 2020-11-11 Michaela Ziegler, copyright ahdis ag, Apache License\n// CDA-CH-EMED: https://art-decor.org/art-decor/decor-project--cdachemed-\n// FHIR CH-EMED: http://fhir.ch/ig/ch-emed/index.html\n\nuses "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument" alias ClinicalDocument as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor" alias AssignedAuthor as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity" alias AssignedEntity as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/Author" alias Author as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization" alias CustodianOrganization as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/IVL_TS" alias IVL_TS as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS" alias EIVL_TS as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/PatientRole" alias PatientRole as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/RecordTarget" alias RecordTarget as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/Section" alias Section as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/SubstanceAdministration" alias SubstanceAdministration as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS" alias SXPR_TS as target\nuses "http://hl7.org/fhir/cda/StructureDefinition/Supply" alias Supply as target\nuses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source\nuses "http://hl7.org/fhir/StructureDefinition/Composition" alias Composition as source\nuses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source\nuses "http://hl7.org/fhir/StructureDefinition/Practitioner" alias Practitioner as source\nuses "http://hl7.org/fhir/StructureDefinition/Organization" alias Organization as source\nuses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedicationStatement as source\nuses "http://hl7.org/fhir/StructureDefinition/Dosage" alias Dosage as source\n\nimports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/FhirToCdaTypes"\nimports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda"\nimports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaCh"\n\n// source: Annotation note (e.g. http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationstatement.html)\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.2\ngroup AnnotationComment(source note : Annotation, target act : Act) {\n note -> act.classCode = 'ACT' "ACT";\n note -> act.moodCode = 'EVN' "EVN";\n note -> act.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.2' "templateId";\n note -> act.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.40' "templateId";\n note -> act.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.2' "templateId";\n note -> act.code as code, code.code = '48767-8', code.codeSystem = '2.16.840.1.113883.6.1', code.displayName = 'Annotation comment', code.codeSystemName = 'LOINC' "code";\n note.text as noteText -> act.text as text then {\n noteText -> text.data = noteText "text";\n note.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' then {\n extension.valueUrl as valueUrl -> text.reference as reference, reference.value = valueUrl "reference";\n } "id";\n note where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> text.reference as reference, reference.value = '#refpdf' "reference";\n };\n note -> act.statusCode as code, code.code = 'completed' "statusCode";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationstatement.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.33&effectiveDate=2019-12-11T11:34:24&language=en-US\ngroup ManufacturedMaterialEntryContentModuleStatement(source bundle : Bundle, source medicationStatement : MedicationStatement, source medication : Medication, target manufacturedMaterial : ManufacturedMaterial) {\n medication -> manufacturedMaterial.classCode = 'MMAT' "MMAT";\n medication -> manufacturedMaterial.determinerCode = 'KIND' "KIND";\n medication -> manufacturedMaterial.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.33' "CH-PHARM-ManufacturedMaterialContentModule";\n medication -> manufacturedMaterial.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.1' "templateId";\n medication.code as code then {\n code.text as text -> manufacturedMaterial.name as name, name.other = text "brandname";\n } "name";\n medication.code as code then {\n // #mtpc.no.brandedmedication\n code.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' -> manufacturedMaterial.code as code then {\n extension.valueUrl as valueUrl -> code.originalText as text, text.reference as reference, reference.value = valueUrl "reference";\n } "id";\n code where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> manufacturedMaterial.code as code, code.originalText as text, text.reference as reference, reference.value = '#refpdf' "reference";\n code.coding as coding -> manufacturedMaterial.code as ce then CodingCE(coding, ce) "code";\n code where coding.exists() = false -> manufacturedMaterial.code as ce, ce.nullFlavor = 'NA' "nullFlavor";\n };\n medication.form as form then {\n form.coding as coding -> manufacturedMaterial.formCode as formCode then CodingCE(coding, formCode) "formCode";\n };\n medication.code as code -> manufacturedMaterial.asContent as asContent, asContent.classCode = 'CONT', asContent.containerPackagedMedicine as containerPackagedMedicine then {\n code -> containerPackagedMedicine.classCode = 'CONT' "CONT";\n code -> containerPackagedMedicine.determinerCode = 'INSTANCE' "INSTANCE";\n code.coding as coding -> containerPackagedMedicine.code as ce then CodingCE(coding, ce) "pharm-code";\n code.text as text -> containerPackagedMedicine.name as name, name.other = text "pharm-name";\n medication.form as form then {\n form.coding as coding -> containerPackagedMedicine.formCode as formCode then CodingCE(coding, formCode) "pharm-formCode";\n };\n // Package size\n medication.amount as amount then {\n amount.numerator as numerator -> containerPackagedMedicine.capacityQuantity as capacityQuantity then {\n numerator.value as value -> capacityQuantity.value = value;\n numerator.code as unit -> capacityQuantity.unit = unit "unit";\n };\n };\n };\n medication.ingredient as ingredient -> manufacturedMaterial.ingredient as ingredient, ingredient.classCode = 'ACTI' then {\n ingredient.itemCodeableConcept as itemCodeableConcept -> ingredient.ingredient as pharmsubstance then {\n itemCodeableConcept -> pharmsubstance.classCode = 'MMAT' "MMAT";\n itemCodeableConcept -> pharmsubstance.determinerCode = 'KIND' "KIND";\n itemCodeableConcept.text as text -> pharmsubstance.name as name, name.other = text "name";\n itemCodeableConcept.coding as coding then {\n coding -> pharmsubstance.code as ce then CodingCE(coding, ce) "formCode";\n };\n } "PharmSubstance";\n ingredient.strength as strength -> ingredient.quantity as quantity then RatioRTOPQPQ(strength, quantity);\n };\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationstatement.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.34&effectiveDate=2019-12-11T11:31:52&language=en-US\ngroup MedicationTreatmentPlanItemEntryContentModule(source bundle : Bundle, source medicationStatement : MedicationStatement, target substanceAdministration : SubstanceAdministration) {\n medicationStatement -> substanceAdministration.classCode = 'SBADM' "SBADM";\n medicationStatement -> substanceAdministration.moodCode = 'INT' "INT";\n medicationStatement -> substanceAdministration.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.34' "CH-PHARM-MedicationTreatmentPlanItemEntryContentModule";\n medicationStatement -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.7' "IHE-PHARM-MTP";\n medicationStatement -> substanceAdministration.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.24' "CCD";\n medicationStatement -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7' "PCC-MedicationEntryContentModule";\n medicationStatement.identifier as identifier -> substanceAdministration.id as id then IdentifierII(identifier, id) "id";\n medicationStatement.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' -> substanceAdministration.text as text, text.reference as reference then {\n extension.valueUrl as valueUrl -> reference.value = valueUrl;\n } "narrativeLink";\n medicationStatement where extension.where(url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists().not() -> substanceAdministration.text as text, text.reference as reference then {\n medicationStatement -> reference.value = '#refpdf' "referencetopdf";\n } "cat1narrativelink";\n medicationStatement -> substanceAdministration.statusCode as statusCode, statusCode.code = 'completed' "code";\n medicationStatement.contained as medication where ('#' + $this.id) in %medicationStatement.medicationReference.reference -> substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.classCode = 'MANU' then {\n medication -> manufacturedProduct.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.2' "MP-TemplateId";\n medication -> manufacturedProduct.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.53' "MP-TemplateId";\n medication -> manufacturedProduct.manufacturedMaterial as manufacturedMaterial then ManufacturedMaterialEntryContentModuleStatement(bundle, medicationStatement, medication, manufacturedMaterial) "manufacturedMaterial";\n };\n // TODO: AUTHOR1 Medication Treatment Plan Author\n medicationStatement where dosage.count() = 1 then {\n medicationStatement.dosage as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured') -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.1' "normalDose";\n } "onylonedosage";\n // dosage for normal dosing, as no sequences are present there\n medicationStatement.dosage as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal') then DosageInstructionsStartStopFrequencySubstanceAdministration(dosage, substanceAdministration) "DosageSubstanceAdministration";\n // dosage for split dosing (with sequences): effectiveTime (start/stop) & routeCode\n medicationStatement.dosage first as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split') -> substanceAdministration.entryRelationship as entryRelationship then DosageInstructionsEntryStartStopRoute(dosage, substanceAdministration, entryRelationship) "DosageSubstanceAdministration";\n // dosage for split dosing (with sequences): sequence number, effectiveTime (when), dose quantity, consumable\n medicationStatement.dosage as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split') -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP' then DosageInstructionsEntryDosageChangeSubstanceAdministration(dosage, substanceAdministration, entryRelationship) "DosageSubstanceAdministration";\n medicationStatement.reasonCode as reasonCode -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'RSON', entryRelationship.observation as observation then TreatmentReasonEntryContentModule(reasonCode, observation) "TreatmentReasonEntryContentModule";\n medicationStatement.extension as extension where url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan' -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'REFR', entryRelationship.substanceAdministration as substanceAdministration then MTPReferenceEntryContentModule(extension, substanceAdministration) "MTP-Reference";\n // https://github.com/ehealthsuisse/ch-emed/issues/56\n medicationStatement -> substanceAdministration.repeatNumber as repeatNumber, repeatNumber.nullFlavor = 'NI' "repeatNumberDefault";\n // TODO: Patient Medication Instructions Contains 1.3.6.1.4.1.19376.1.5.3.1.4.3 IHE Patient Medication Instructions (DYNAMIC)\n medicationStatement.dosage as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured') -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.substanceAdministration as substanceAdministration then DosageInstructionsNonStructuredEntryContentModule(dosage, substanceAdministration) "DosageInstructionsNonStructuredEntryContentModule";\n medicationStatement.note as note -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.act as act then AnnotationComment(note, act) "AnnotationComment";\n medicationStatement.extension as extension where $this.url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-substitution' -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.act as act then SubstitutionStatement(extension, act) "Substitution";\n}\n\n// TODO: Tapered Dose\n// medicationStatement -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.8' "taperedDose";\n// source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.35\n// dosage for normal dosing (without sequences) (Statement, Prescription)\ngroup DosageInstructionsStartStopFrequencySubstanceAdministration(source dosage : Dosage, target substanceAdministration : SubstanceAdministration) {\n dosage -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.1' "normalDose";\n dosage as dosage -> substanceAdministration as substanceAdministration then EffectiveTimeStartEnd(dosage, substanceAdministration) "effectiveTimeStartEnd";\n dosage as dosage -> substanceAdministration as substanceAdministration then EffectiveTimeWhenNormal(dosage, substanceAdministration) "effectiveTimeWhen";\n dosage.route as route -> substanceAdministration.routeCode as routeCode then CodeableConceptCE(route, routeCode);\n dosage as dosage -> substanceAdministration as substanceAdministration then DoseQuantity(dosage, substanceAdministration) "doseQuantity";\n}\n\n// source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\n// dosage for split dosing: effectiveTime (start/stop) & routeCode (Statement, Prescription)\ngroup DosageInstructionsEntryStartStopRoute(source dosage : Dosage, target substanceAdministration : substanceAdministration, target entry : entryRelationship) {\n // if the FHIR doucment has no dosage templateId -> create templateId for split dose\n dosage -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.9' "splitDose";\n dosage as dosage -> substanceAdministration as substanceAdministration then EffectiveTimeStartEnd(dosage, substanceAdministration) "effectiveTimeStartEnd";\n dosage.route as route -> substanceAdministration.routeCode as routeCode then CodeableConceptCE(route, routeCode);\n}\n\n// source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\n// dosage for split dosing: sequence number, effectiveTime (when), dose quantity, consumable (Statement, Prescription)\ngroup DosageInstructionsEntryDosageChangeSubstanceAdministration(source dosage : Dosage, target substanceAdministration : substanceAdministration, target entry : entryRelationship) {\n dosage.sequence as sequence -> entry.sequenceNumber as sequenceNumber, sequenceNumber.value = sequence;\n dosage -> entry.substanceAdministration as substanceAdministration, substanceAdministration.classCode = 'SBADM', substanceAdministration.moodCode = 'INT' then {\n dosage as dosage -> substanceAdministration as substanceAdministration then EffectiveTimeWhenSplit(dosage, substanceAdministration) "effectiveTimeWhen";\n dosage as dosage -> substanceAdministration as substanceAdministration then DoseQuantity(dosage, substanceAdministration) "doseQuantity";\n dosage as dosage -> substanceAdministration as substanceAdministration, substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.manufacturedMaterial as manufacturedMaterial, manufacturedMaterial.nullFlavor = 'NA' "consumable";\n } "dosage";\n}\n\n// effective time low and high for dosage (Statement, Prescription)\ngroup EffectiveTimeStartEnd(source dosage : Dosage, target substanceAdministration : SubstanceAdministration) {\n dosage.timing as timing then {\n timing.repeat as repeat then {\n repeat.bounds : Period as bounds -> substanceAdministration.effectiveTime = create('IVL_TS') as effectiveTime then {\n bounds.start as start -> effectiveTime.low as low then DateTS(start, low) "low";\n bounds where start.exists().not() -> effectiveTime.low as low, low.nullFlavor = 'UNK' "NullFlavorLow";\n bounds.end as end -> effectiveTime.high as high then DateTS(end, high) "high";\n bounds where end.exists().not() -> effectiveTime.high as high, high.nullFlavor = 'UNK' "NullFlavorhigh";\n };\n };\n };\n}\n\n// dose quantity for dosage (application schema) (Statement)\ngroup DoseQuantity(source dosage : Dosage, target substanceAdministration : SubstanceAdministration) {\n dosage.doseAndRate as doseAndRate -> substanceAdministration.doseQuantity as doseQuantity then {\n doseAndRate.dose : Quantity as quantity then {\n quantity.value as value -> doseQuantity.value = value;\n quantity.code as code -> doseQuantity.unit = code;\n } "quantity";\n } "doseQuantity";\n}\n\n// source: reasonCode Coding (e.g. http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-medicationstatement)\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.41\n// Treatment Reason (Statement, Prescription)\ngroup TreatmentReasonEntryContentModule(source reasonCode : Coding, target observation : Observation) {\n reasonCode -> observation.classCode = 'OBS' "OBS";\n reasonCode -> observation.moodCode = 'EVN' "EVN";\n reasonCode -> observation.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.41' "TreatmentReasonEntryContentModule";\n reasonCode -> observation.code as code, code.code = '75326-9', code.codeSystem = '2.16.840.1.113883.6.1', code.displayName = 'Problem', code.codeSystemName = 'LOINC' "code";\n reasonCode.text as reasonText -> observation.text as text then {\n reasonText -> text.data = reasonText "text";\n reasonCode.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' then {\n extension.valueUrl as valueUrl -> text.reference as reference, reference.value = valueUrl "reference";\n } "id";\n reasonCode where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> text.reference as reference, reference.value = '#refpdf' "reference";\n };\n reasonCode -> observation.statusCode as code, code.code = 'completed' "statusCode";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-ext-treatmentplan.html\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?section=templates&id=2.16.756.5.30.1.1.10.4.45&effectiveDate=2017-01-10T15:34:25&language=en-US\ngroup MTPReferenceEntryContentModule(source ext : Extension, target substanceAdministration : SubstanceAdministration) {\n ext -> substanceAdministration.classCode = 'SBADM' "SBADM";\n ext -> substanceAdministration.moodCode = 'INT' "INT";\n ext -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.10' "referenceTo-MTP-PlanItemGeneralSpecificationTemplateId";\n ext -> substanceAdministration.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.45' "CH-PHARM-templateId";\n ext.extension as extension where $this.url = 'id' then {\n extension.valueIdentifier as valueIdentifier -> substanceAdministration.id as id then IdentifierII(valueIdentifier, id) "id";\n } "id";\n ext -> substanceAdministration.code as code, code.code = 'MTPItem', code.codeSystem = '1.3.6.1.4.1.19376.1.9.2.2', code.displayName = 'Medication Treatment Plan Item', code.codeSystemName = 'IHE Pharmacy Item Type List' "code";\n ext -> substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.manufacturedMaterial as manufacturedMaterial, manufacturedMaterial.nullFlavor = 'NA' "consumable";\n ext.extension as extension where $this.url = 'externalDocumentId' then {\n extension.valueIdentifier as valueIdentifier -> substanceAdministration.reference as reference, reference.typeCode = 'XCRPT', reference.externalDocument as externalDocument, externalDocument.id as id then IdentifierII(valueIdentifier, id) "id";\n } "externalDocumentId";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-dosage-nonstructured.html\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?section=templates&id=2.16.756.5.30.1.1.10.4.52\n// Dosage Instruction (Statement, Prescription)\ngroup DosageInstructionsNonStructuredEntryContentModule(source dosage : Dosage, target substanceAdministration : SubstanceAdministration) {\n dosage -> substanceAdministration.classCode = 'SBADM' "SBADM";\n dosage -> substanceAdministration.moodCode = 'INT' "INT";\n dosage -> substanceAdministration.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.52' "templateId";\n dosage.text as noteText -> substanceAdministration.text as text then {\n noteText -> text.data = noteText "text";\n dosage.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' then {\n extension.valueUrl as valueUrl -> text.reference as reference, reference.value = valueUrl "reference";\n } "id";\n dosage where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> text.reference as reference, reference.value = '#refpdf' "reference";\n };\n dosage -> substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.manufacturedMaterial as manufacturedMaterial, manufacturedMaterial.nullFlavor = 'NA' "consumable";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationdispense.html\n// target: Substitution act Contains 1.3.6.1.4.1.19376.1.9.1.3.9.2 IHE Substitution Act Content Module\n// Substitution (Dispense)\ngroup SubstitutionDispense(source substitution : Substitution, target act : Act) {\n substitution -> act.classCode = 'ACT' "ACT";\n substitution -> act.moodCode = 'EVN' "EVN";\n substitution -> act.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.9.2' "templateId";\n substitution.type as type -> act.code as code then CodeableConceptCE(type, code) "substitution";\n substitution -> act.statusCode as statusCode, statusCode.code = 'completed' "statusCode";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationdispense.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.33&effectiveDate=2019-12-11T11:34:24&language=en-US\ngroup ManufacturedMaterialEntryContentModuleDispense(source bundle : Bundle, source medicationDispense : MedicationDispense, source medication : Medication, target manufacturedMaterial : ManufacturedMaterial) {\n medication -> manufacturedMaterial.classCode = 'MMAT' "MMAT";\n medication -> manufacturedMaterial.determinerCode = 'KIND' "KIND";\n medication -> manufacturedMaterial.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.33' "CH-PHARM-ManufacturedMaterialContentModule";\n medication -> manufacturedMaterial.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.1' "templateId";\n medication.code as code then {\n code.text as text -> manufacturedMaterial.name as name, name.other = text "brandname";\n } "name";\n medication.code as code then {\n // #dis.no.brandedmedication\n code.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' -> manufacturedMaterial.code as code then {\n extension.valueUrl as valueUrl -> code.originalText as text, text.reference as reference, reference.value = valueUrl "reference";\n } "id";\n code where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> manufacturedMaterial.code as code, code.originalText as text, text.reference as reference, reference.value = '#refpdf' "reference";\n code.coding as coding -> manufacturedMaterial.code as ce then CodingCE(coding, ce) "code";\n };\n medication.form as form then {\n form.coding as coding -> manufacturedMaterial.formCode as formCode then CodingCE(coding, formCode) "formCode";\n };\n medication.code as code -> manufacturedMaterial.asContent as asContent, asContent.classCode = 'CONT', asContent.containerPackagedMedicine as containerPackagedMedicine then {\n code -> containerPackagedMedicine.classCode = 'CONT' "CONT";\n code -> containerPackagedMedicine.determinerCode = 'INSTANCE' "INSTANCE";\n code.coding as coding -> containerPackagedMedicine.code as ce then CodingCE(coding, ce) "pharm-code";\n code.text as text -> containerPackagedMedicine.name as name, name.other = text "pharm-name";\n medication.form as form then {\n form.coding as coding -> containerPackagedMedicine.formCode as formCode then CodingCE(coding, formCode) "pharm-formCode";\n };\n // Package size\n medication.amount as amount then {\n amount.numerator as numerator -> containerPackagedMedicine.capacityQuantity as capacityQuantity then {\n numerator.value as value -> capacityQuantity.value = value;\n numerator.code as unit -> capacityQuantity.unit = unit "unit";\n };\n };\n };\n medication.ingredient as ingredient -> manufacturedMaterial.ingredient as ingredient, ingredient.classCode = 'ACTI' then {\n ingredient.itemCodeableConcept as itemCodeableConcept -> ingredient.ingredient as pharmsubstance then {\n itemCodeableConcept -> pharmsubstance.classCode = 'MMAT' "MMAT";\n itemCodeableConcept -> pharmsubstance.determinerCode = 'KIND' "KIND";\n itemCodeableConcept.text as text -> pharmsubstance.name as name, name.other = text "name";\n itemCodeableConcept.coding as coding then {\n coding -> pharmsubstance.code as ce then CodingCE(coding, ce) "formCode";\n };\n } "PharmSubstance";\n ingredient.strength as strength -> ingredient.quantity as quantity then RatioRTOPQPQ(strength, quantity);\n };\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationdispense.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.42\ngroup DispenseItemEntryContentModule(source bundle : Bundle, source medicationDispense : MedicationDispense, target supply : Supply) {\n medicationDispense -> supply.classCode = 'SPLY' "SPLY";\n medicationDispense -> supply.moodCode = 'EVN' "EVN";\n medicationDispense -> supply.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.42' "CH-PHARM-DispenseItemEntryContentModule";\n medicationDispense -> supply.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.4' "IHE-PHARM-DIS";\n medicationDispense -> supply.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.3' "supplyEntry";\n medicationDispense -> supply.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.34' "CCD";\n medicationDispense.identifier as identifier -> supply.id as id then IdentifierII(identifier, id) "id";\n medicationDispense.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' -> supply.text as text, text.reference as reference then {\n extension.valueUrl as valueUrl -> reference.value = valueUrl;\n } "narrativeLink";\n medicationDispense where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> supply.text as text, text.reference as reference, text.reference as reference, reference.value = '#refpdf' "reference";\n medicationDispense.contained as medication where ('#' + $this.id) in %medicationDispense.medicationReference.reference -> supply.product as product, product.manufacturedProduct as manufacturedProduct, manufacturedProduct.classCode = 'MANU' then {\n medication -> manufacturedProduct.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.2' "MP-TemplateId";\n medication -> manufacturedProduct.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.53' "MP-TemplateId";\n medication -> manufacturedProduct.manufacturedMaterial as manufacturedMaterial then ManufacturedMaterialEntryContentModuleDispense(bundle, medicationDispense, medication, manufacturedMaterial) "manufacturedMaterial";\n };\n // TODO: AUTHOR1 Medication Treatment Plan Author\n medicationDispense.extension as extension where url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan' -> supply.entryRelationship as entryRelationship, entryRelationship.typeCode = 'REFR', entryRelationship.substanceAdministration as substanceAdministration then MTPReferenceEntryContentModule(extension, substanceAdministration) "MTP-Reference";\n // #24 missing template it if ch-emed-dosage-nonstructured\n medicationDispense where dosageInstruction.count() = 1 then {\n medicationDispense.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured') -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.1' "normalDose";\n } "onylonedosage";\n // dosage for normal dosing, as no sequences are present there\n medicationDispense.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal') then DosageInstructionsStartStopFrequencySupply(dosage, supply) "DosageSubstanceAdministration";\n // dosage for split dosing, as sequences are present there\n medicationDispense -> supply.entryRelationship as entryRelationship then {\n medicationDispense -> entryRelationship.substanceAdministration as substanceAdministration then {\n // split dosing (with sequences): effectiveTime (start/stop) & routeCode & consumable\n medicationDispense.dosageInstruction first as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split') -> substanceAdministration then DosageInstructionsEntryStartStopRouteConsumable(dosage, entryRelationship, substanceAdministration) "DosageSubstanceAdministration";\n // split dosing (with sequences): sequence number, effectiveTime (when), dose quantity, consumable\n medicationDispense.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split') -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP' then DosageInstructionsEntryDosageChangeEntryRelationship(dosage, entryRelationship) "DosageSubstanceAdministration";\n } "substanceAdministration";\n } "entryRelationship";\n // TODO: Precondition Criterion\n medicationDispense.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured') -> supply.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.substanceAdministration as substanceAdministration then DosageInstructionsNonStructuredEntryContentModule(dosage, substanceAdministration) "DosageInstructionsNonStructuredEntryContentModule";\n // Number of packages\n medicationDispense.quantity as quantity -> supply.quantity as supplyQuantity then {\n quantity.value as value -> supplyQuantity.value = value;\n };\n medicationDispense.note as note -> supply.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.act as act then AnnotationComment(note, act) "AnnotationComment";\n medicationDispense.substitution as substitution -> supply.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.act as act then SubstitutionDispense(substitution, act) "Substitution";\n}\n\n// source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.35\n// dosage for normal dosing (without sequences) (Dispense)\ngroup DosageInstructionsStartStopFrequencySupply(source dosage : Dosage, target supply : Supply) {\n dosage -> supply.entryRelationship as entryRelationship then {\n dosage -> entryRelationship.typeCode = 'COMP' "COMP";\n dosage -> entryRelationship.substanceAdministration as substanceAdministration then {\n dosage -> substanceAdministration.classCode = 'SBADM' "SBADM";\n dosage -> substanceAdministration.moodCode = 'INT' "INT";\n dosage -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.6' "templateId";\n dosage -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.1' "normalDose";\n dosage -> substanceAdministration as substanceAdministration then EffectiveTimeStartEnd(dosage, substanceAdministration) "effectiveTimeStartEnd";\n dosage -> substanceAdministration as substanceAdministration then EffectiveTimeWhenNormal(dosage, substanceAdministration) "effectiveTimeWhen";\n dosage.route as route -> substanceAdministration.routeCode as routeCode then CodeableConceptCE(route, routeCode);\n dosage -> substanceAdministration as substanceAdministration then DoseQuantity(dosage, substanceAdministration) "doseQuantity";\n dosage -> substanceAdministration as substanceAdministration, substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.manufacturedMaterial as manufacturedMaterial, manufacturedMaterial.nullFlavor = 'NA' "consumable";\n } "substanceAdministration";\n } "entryRelationship";\n}\n\n// source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\n// dosage for split dosing: effectiveTime (start/stop) & routeCode & consumable (Dispense)\ngroup DosageInstructionsEntryStartStopRouteConsumable(source dosage : Dosage, target entryRelationship : entryRelationship, target substanceAdministration : SubstanceAdministration) {\n dosage -> entryRelationship.typeCode = 'COMP' "COMP";\n dosage -> substanceAdministration.classCode = 'SBADM' "SBADM";\n dosage -> substanceAdministration.moodCode = 'INT' "INT";\n dosage -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.6' "templateId";\n dosage -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.9' "splitDose";\n dosage -> substanceAdministration as substanceAdministration then EffectiveTimeStartEnd(dosage, substanceAdministration) "effectiveTimeStartEnd";\n dosage.route as route -> substanceAdministration.routeCode as routeCode then CodeableConceptCE(route, routeCode);\n dosage -> substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.manufacturedMaterial as manufacturedMaterial, manufacturedMaterial.nullFlavor = 'NA' "consumable";\n}\n\n// source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\n// target: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\n// dosage for split dosing: sequence number, effectiveTime (when), dose quantity, consumable (Dispense)\ngroup DosageInstructionsEntryDosageChangeEntryRelationship(source dosage : Dosage, target entryRelationship : entryRelationship) {\n dosage.sequence as sequence -> entryRelationship.sequenceNumber as sequenceNumber, sequenceNumber.value = sequence;\n dosage -> entryRelationship.substanceAdministration as substanceAdministration, substanceAdministration.classCode = 'SBADM', substanceAdministration.moodCode = 'INT' then {\n dosage as dosage -> substanceAdministration then EffectiveTimeWhenSplit(dosage, substanceAdministration) "effectiveTimeWhen";\n dosage as dosage -> substanceAdministration then DoseQuantity(dosage, substanceAdministration) "doseQuantity";\n dosage as dosage -> substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.manufacturedMaterial as manufacturedMaterial, manufacturedMaterial.nullFlavor = 'NA' "consumable";\n } "dosage";\n}\n\n// effective time when for normal dosage (Dispense, Statement, Prescription)\ngroup EffectiveTimeWhenNormal(source dosage : Dosage, target substanceAdministration : SubstanceAdministration) {\n dosage.timing as timing then {\n timing.repeat as repeat then {\n repeat where $this.when.count() = 1 -> substanceAdministration.effectiveTime = create('EIVL_TS') as effectiveTime, effectiveTime.operator = 'A' then {\n repeat.when as when -> effectiveTime.event as event, event.code = when;\n } "when";\n repeat where $this.when.count() > 1 -> substanceAdministration.effectiveTime = create('SXPR_TS') as effectiveTime, effectiveTime.operator = 'A' then {\n repeat.when first as when -> effectiveTime.comp = create('EIVL_TS') as comp then {\n when -> comp.event as event, event.code = when "when";\n } "comp";\n repeat.when not_first as when -> effectiveTime.comp = create('EIVL_TS') as comp, comp.operator = 'I' then {\n when -> comp.event as event, event.code = when "when";\n } "compnotfirst";\n } "when";\n };\n };\n}\n\n// effective time when for split dosage (Dispense, Statement, Prescription)\ngroup EffectiveTimeWhenSplit(source dosage : Dosage, target substanceAdministration : SubstanceAdministration) {\n dosage.timing as timing then {\n timing.repeat as repeat then {\n repeat where $this.when.count() = 1 -> substanceAdministration.effectiveTime = create('EIVL_TS') as effectiveTime then {\n repeat.when as when -> effectiveTime.event as event, event.code = when;\n } "when";\n repeat where $this.when.count() > 1 -> substanceAdministration.effectiveTime = create('SXPR_TS') as effectiveTime, effectiveTime.operator = 'A' then {\n repeat.when first as when -> effectiveTime.comp = create('EIVL_TS') as comp then {\n when -> comp.event as event, event.code = when "when";\n } "comp";\n repeat.when not_first as when -> effectiveTime.comp = create('EIVL_TS') as comp, comp.operator = 'I' then {\n when -> comp.event as event, event.code = when "when";\n } "compnotfirst";\n } "when";\n };\n };\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\n// target: Substitution permission Contains 1.3.6.1.4.1.19376.1.9.1.3.9.1 IHE Substitution Permission Content Module\ngroup SubstitutionRequest(source substitution : Substitution, target act : Act) {\n substitution -> act.classCode = 'ACT' "ACT";\n substitution -> act.moodCode = 'DEF' "DEF";\n substitution -> act.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.9.1' "templateId";\n substitution.allowedCodeableConcept as allowedCC -> act.code as code then CodeableConceptCE(allowedCC, code) "substitution";\n substitution -> act.statusCode as statusCode, statusCode.code = 'completed' "statusCode";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\n// target: Substitution permission Contains 1.3.6.1.4.1.19376.1.9.1.3.9.1 IHE Substitution Permission Content Module\ngroup SubstitutionStatement(source extension : Extension, target act : Act) {\n extension -> act.classCode = 'ACT' "ACT";\n extension -> act.moodCode = 'DEF' "DEF";\n extension -> act.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.9.1' "templateId";\n extension.valueCodeableConcept as valueCC -> act.code as code then CodeableConceptCE(valueCC, code) "extension";\n extension -> act.statusCode as statusCode, statusCode.code = 'completed' "statusCode";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?id=2.16.756.5.30.1.1.10.4.38\ngroup PrescribedQuantity(source dispenseRequest : DispenseRequest, target supply : Supply) {\n dispenseRequest -> supply.classCode = 'SPLY' "SPLY";\n dispenseRequest -> supply.moodCode = 'RQO' "RQO";\n dispenseRequest -> supply.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.8' "templateId";\n dispenseRequest -> supply.independentInd as independentInd, independentInd.value = 'false' "independentInd";\n // Number of packages\n dispenseRequest.quantity as quantity -> supply.quantity as quant then {\n quantity.value as value -> quant.value = value;\n };\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?id=2.16.756.5.30.1.1.10.4.38\ngroup PrescribedQuantityUnit(source dispenseRequest : DispenseRequest, target supply : Supply) {\n dispenseRequest -> supply.classCode = 'SPLY' "SPLY";\n dispenseRequest -> supply.moodCode = 'RQO' "RQO";\n dispenseRequest -> supply.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.8' "TemplateId";\n dispenseRequest -> supply.independentInd as independentInd, independentInd.value = 'false' "independentInd";\n // Number of packages\n dispenseRequest.quantity as quantity -> supply.quantity as quant then {\n quantity.value as value -> quant.value = value;\n quantity.unit as unit -> quant.unit = unit;\n };\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.33\ngroup ManufacturedMaterialEntryContentModulePrescription(source bundle : Bundle, source medicationRequest : MedicationRequest, source medication : Medication, target manufacturedMaterial : ManufacturedMaterial, target substanceAdministration : SubstanceAdministration) {\n medication -> manufacturedMaterial.classCode = 'MMAT' "MMAT";\n medication -> manufacturedMaterial.determinerCode = 'KIND' "KIND";\n medication -> manufacturedMaterial.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.33' "CH-PHARM-ManufacturedMaterialContentModule";\n medication -> manufacturedMaterial.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.1' "templateId";\n medication.code as code then {\n code.text as text -> manufacturedMaterial.name as name, name.other = text "brandname";\n } "name";\n medication.code as code then {\n // #pre.no.brandedmedication\n code.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' -> manufacturedMaterial.code as code then {\n extension.valueUrl as valueUrl -> code.originalText as text, text.reference as reference, reference.value = valueUrl "reference";\n } "id";\n code where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> manufacturedMaterial.code as code, code.originalText as text, text.reference as reference, reference.value = '#refpdf' "reference";\n code.coding as coding -> manufacturedMaterial.code as ce then CodingCE(coding, ce) "code";\n };\n medication.form as form then {\n form.coding as coding -> manufacturedMaterial.formCode as formCode then CodingCE(coding, formCode) "formCode";\n };\n medication.code as code -> manufacturedMaterial.asContent as asContent, asContent.classCode = 'CONT', asContent.containerPackagedMedicine as containerPackagedMedicine then {\n code -> containerPackagedMedicine.classCode = 'CONT' "CONT";\n code -> containerPackagedMedicine.determinerCode = 'INSTANCE' "INSTANCE";\n code.coding as coding -> containerPackagedMedicine.code as ce then CodingCE(coding, ce) "pharm-code";\n code.text as text -> containerPackagedMedicine.name as name, name.other = text "pharm-name";\n medication.form as form then {\n form.coding as coding -> containerPackagedMedicine.formCode as formCode then CodingCE(coding, formCode) "pharm-formCode";\n };\n // Package size\n medication.amount as amount then {\n amount.numerator as numerator -> containerPackagedMedicine.capacityQuantity as capacityQuantity then {\n numerator.value as value -> capacityQuantity.value = value;\n numerator.code as unit -> capacityQuantity.unit = unit "unit";\n };\n // IHE-DIS: Case 1: If the product-element contains package information, the unit attribute is not be present\n medicationRequest.dispenseRequest as dispenseRequest -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.supply as supply then PrescribedQuantity(dispenseRequest, supply) "PrescribedQuantity";\n };\n // IHE-DIS: Case 2: If the product-element does not contain package information, the unit attribut is present and the value SHALL be out of the UCUM code system\n medication where $this.amount.exists() = false then {\n medicationRequest.dispenseRequest as dispenseRequest -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.supply as supply then PrescribedQuantityUnit(dispenseRequest, supply) "PrescribedQuantityUnit";\n } "noAmount";\n };\n medication.ingredient as ingredient -> manufacturedMaterial.ingredient as ingredient, ingredient.classCode = 'ACTI' then {\n ingredient.itemCodeableConcept as itemCodeableConcept -> ingredient.ingredient as pharmsubstance then {\n itemCodeableConcept -> pharmsubstance.classCode = 'MMAT' "MMAT";\n itemCodeableConcept -> pharmsubstance.determinerCode = 'KIND' "KIND";\n itemCodeableConcept.text as text -> pharmsubstance.name as name, name.other = text "name";\n itemCodeableConcept.coding as coding then {\n coding -> pharmsubstance.code as ce then CodingCE(coding, ce) "formCode";\n };\n } "PharmSubstance";\n ingredient.strength as strength -> ingredient.quantity as quantity then RatioRTOPQPQ(strength, quantity);\n };\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.43\ngroup PrescriptionItemEntryContentModule(source bundle : Bundle, source medicationRequest : MedicationRequest, target substanceAdministration : SubstanceAdministration) {\n medicationRequest -> substanceAdministration.classCode = 'SBADM' "SBADM";\n medicationRequest -> substanceAdministration.moodCode = 'INT' "INT";\n medicationRequest -> substanceAdministration.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.43' "CH-PHARM-PrescriptionItemEntryContentModule";\n medicationRequest -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.2' "PrescriptionItemEntryTemplateId";\n medicationRequest -> substanceAdministration.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.24' "CCD";\n medicationRequest -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7' "PCC-MedicationEntryContentModule";\n medicationRequest.identifier as identifier -> substanceAdministration.id as id then IdentifierII(identifier, id) "id";\n medicationRequest.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' -> substanceAdministration.text as text, text.reference as reference then {\n extension.valueUrl as valueUrl -> reference.value = valueUrl;\n } "narrativeLink";\n medicationRequest where extension.where(url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists().not() -> substanceAdministration.text as text, text.reference as reference then {\n medicationRequest -> reference.value = '#refpdf' "referencetopdf";\n } "cat1narrativelink";\n medicationRequest -> substanceAdministration.statusCode as statusCode, statusCode.code = 'completed' "code";\n medicationRequest.dispenseRequest as dispenseRequest -> substanceAdministration.repeatNumber as repeatNumber then {\n dispenseRequest.numberOfRepeatsAllowed as number -> repeatNumber.value = number "repeatNumber";\n dispenseRequest where numberOfRepeatsAllowed.exists() = false -> repeatNumber.nullFlavor = 'NI' "repeatNumberNull";\n };\n medicationRequest.contained as medication where ('#' + $this.id) in %medicationRequest.medicationReference.reference -> substanceAdministration.consumable as consumable, consumable.manufacturedProduct as manufacturedProduct, manufacturedProduct.classCode = 'MANU' then {\n medication -> manufacturedProduct.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.2' "MP-templateId";\n medication -> manufacturedProduct.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.53' "MP-templateId";\n medication -> manufacturedProduct.manufacturedMaterial as manufacturedMaterial then ManufacturedMaterialEntryContentModulePrescription(bundle, medicationRequest, medication, manufacturedMaterial, substanceAdministration) "manufacturedMaterial";\n };\n // TODO: AUTHOR1 Medication Treatment Plan Author\n medicationRequest where dosageInstruction.count() = 1 then {\n medicationRequest.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured') -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.7.1' "normalDose";\n } "onylonedosage";\n medicationRequest.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal-medicationrequest') then DosageInstructionsStartStopFrequencySubstanceAdministration(dosage, substanceAdministration) "DosageSubstanceAdministration";\n // dosage for split dosing (with sequences): effectiveTime (start/stop) & routeCode\n medicationRequest.dosageInstruction first as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split-medicationrequest') -> substanceAdministration.entryRelationship as entryRelationship then DosageInstructionsEntryStartStopRoute(dosage, substanceAdministration, entryRelationship) "DosageSubstanceAdministration";\n // dosage for split dosing (with sequences): sequence number, effectiveTime (when), dose quantity, consumable\n medicationRequest.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split-medicationrequest') -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP' then DosageInstructionsEntryDosageChangeSubstanceAdministration(dosage, substanceAdministration, entryRelationship) "DosageSubstanceAdministration";\n medicationRequest.reasonCode as reasonCode -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'RSON', entryRelationship.observation as observation then TreatmentReasonEntryContentModule(reasonCode, observation) "TreatmentReasonEntryContentModule";\n medicationRequest.extension as extension where url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan' -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'REFR', entryRelationship.substanceAdministration as substanceAdministration then MTPReferenceEntryContentModule(extension, substanceAdministration) "MTP-Reference";\n // TODO: Patient Medication Instructions Contains 1.3.6.1.4.1.19376.1.5.3.1.4.3 IHE Patient Medication Instructions (DYNAMIC)\n medicationRequest.dosageInstruction as dosage where $this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured') -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.substanceAdministration as substanceAdministration then DosageInstructionsNonStructuredEntryContentModule(dosage, substanceAdministration) "DosageInstructionsNonStructuredEntryContentModule";\n medicationRequest.note as note -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.act as act then AnnotationComment(note, act) "AnnotationComment";\n medicationRequest.substitution as substitution -> substanceAdministration.entryRelationship as entryRelationship, entryRelationship.typeCode = 'COMP', entryRelationship.act as act then SubstitutionRequest(substitution, act) "Substitution";\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-observation.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.44\ngroup PharmaceuticalAdviceItemEntryContentModule(source bundle : Bundle, source fhirobservation : Observation, target cdaobservation : Observation) {\n fhirobservation -> cdaobservation.classCode = 'OBS' "OBS";\n fhirobservation -> cdaobservation.moodCode = 'EVN' "EVN";\n fhirobservation -> cdaobservation.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.9.1.3.3' "IHE-PHARM-PADV";\n fhirobservation -> cdaobservation.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.44' "CH-PHARM-PharmaceuticalAdviceItemEntryContentModule";\n fhirobservation.identifier as identifier -> cdaobservation.id as id then IdentifierII(identifier, id) "id";\n fhirobservation.code as fhirCode -> cdaobservation.code as cdaCode then CodeableConceptCE(fhirCode, cdaCode);\n fhirobservation -> cdaobservation.statusCode as statusCode, statusCode.code = 'completed' "code";\n fhirobservation.effectiveDateTime as effectiveDateTime -> cdaobservation.effectiveTime as effectiveTime then {\n effectiveDateTime -> effectiveTime.value = effectiveDateTime "value";\n } "effectiveTime";\n fhirobservation.extension as extension where url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan' -> cdaobservation.entryRelationship as entryRelationship, entryRelationship.typeCode = 'REFR', entryRelationship.substanceAdministration as substanceAdministration then MTPReferenceEntryContentModule(extension, substanceAdministration) "MTP-Reference";\n fhirobservation.extension as extension where url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-medicationstatement-changed' -> cdaobservation.entryRelationship as entryRelationship, entryRelationship.typeCode = 'REFR' then {\n bundle.entry as entry then {\n entry.fullUrl where ($this in %extension.valueReference.reference) and $this.startsWith('urn:uuid') then {\n entry.resource as medicationStatement where $this.ofType(FHIR.MedicationStatement) -> entryRelationship.substanceAdministration as substanceAdministration then MedicationTreatmentPlanItemEntryContentModule(bundle, medicationStatement, substanceAdministration) "MedicationStatement";\n } "fullUrlAsUuid";\n entry.resource as medicationStatement where $this.ofType(FHIR.MedicationStatement) and (('MedicationStatement' + '/' + $this.id) in %extension.valueReference.reference) -> entryRelationship.substanceAdministration as substanceAdministration then MedicationTreatmentPlanItemEntryContentModule(bundle, medicationStatement, substanceAdministration) "MedicationStatement";\n };\n } "changedmtp";\n fhirobservation.note as note then {\n note.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' -> cdaobservation.text as text, text.reference as reference then {\n extension.valueUrl as valueUrl -> reference.value = valueUrl;\n } "narrativeLink";\n note where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> cdaobservation.text as text, text.reference as reference, reference.value = '#refpdf' "reference";\n };\n fhirobservation.note as note -> cdaobservation.text as text then {\n note.text as noteText -> text.data = noteText;\n note.extension as extension where $this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' then {\n extension.valueUrl as valueUrl -> text.reference as reference, reference.value = valueUrl "reference";\n } "id";\n note where (extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false) -> text.reference as reference, reference.value = '#refpdf' "reference";\n } "text";\n}\n\n</pre>\n </div>"
},
"url" : "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmed",
"version" : "0.3.0",
"name" : "BundleToCdaChEmed",
"status" : "draft",
"date" : "2022-02-11T11:14:39+01:00",
"publisher" : "ahdis",
"contact" : [
{
"name" : "ahdis",
"telecom" : [
{
"system" : "url",
"value" : "http://www.ahdis.ch/"
}
]
}
],
"description" : "\r\nMedication Entries\r\n2020-11-11 Michaela Ziegler, copyright ahdis ag, Apache License\r\nCDA-CH-EMED: https://art-decor.org/art-decor/decor-project--cdachemed-\r\nFHIR CH-EMED: http://fhir.ch/ig/ch-emed/index.html\r\n",
"copyright" : "CC-BY-SA-4.0",
"structure" : [
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument",
"mode" : "target",
"alias" : "ClinicalDocument"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor",
"mode" : "target",
"alias" : "AssignedAuthor"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity",
"mode" : "target",
"alias" : "AssignedEntity"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/Author",
"mode" : "target",
"alias" : "Author"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization",
"mode" : "target",
"alias" : "CustodianOrganization"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/IVL_TS",
"mode" : "target",
"alias" : "IVL_TS"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS",
"mode" : "target",
"alias" : "EIVL_TS"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/PatientRole",
"mode" : "target",
"alias" : "PatientRole"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/RecordTarget",
"mode" : "target",
"alias" : "RecordTarget"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/Section",
"mode" : "target",
"alias" : "Section"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/SubstanceAdministration",
"mode" : "target",
"alias" : "SubstanceAdministration"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS",
"mode" : "target",
"alias" : "SXPR_TS"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/Supply",
"mode" : "target",
"alias" : "Supply"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
"mode" : "source",
"alias" : "Bundle"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Composition",
"mode" : "source",
"alias" : "Composition"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Patient",
"mode" : "source",
"alias" : "Patient"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
"mode" : "source",
"alias" : "Practitioner"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Organization",
"mode" : "source",
"alias" : "Organization"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/MedicationStatement",
"mode" : "source",
"alias" : "MedicationStatement"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Dosage",
"mode" : "source",
"alias" : "Dosage"
}
],
"import" : [
"http://fhir.ch/ig/cda-fhir-maps/StructureMap/FhirToCdaTypes",
"http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda",
"http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaCh"
],
"group" : [
{
"name" : "AnnotationComment",
"typeMode" : "none",
"documentation" : "source: Annotation note (e.g. http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationstatement.html)\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.2",
"input" : [
{
"name" : "note",
"type" : "Annotation",
"mode" : "source"
},
{
"name" : "act",
"type" : "Act",
"mode" : "target"
}
],
"rule" : [
{
"name" : "ACT",
"source" : [
{
"context" : "note"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ACT"
}
]
}
]
},
{
"name" : "EVN",
"source" : [
{
"context" : "note"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "EVN"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "note"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.2"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "note"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.10.20.1.40"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "note"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.2"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "note"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "48767-8"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "codeSystem",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.6.1"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "displayName",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Annotation comment"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "codeSystemName",
"transform" : "copy",
"parameter" : [
{
"valueString" : "LOINC"
}
]
}
]
},
{
"name" : "text",
"source" : [
{
"context" : "note",
"element" : "text",
"variable" : "noteText"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
}
],
"rule" : [
{
"name" : "text",
"source" : [
{
"context" : "noteText"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "data",
"transform" : "copy",
"parameter" : [
{
"valueId" : "noteText"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "note",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"rule" : [
{
"name" : "reference",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "reference",
"source" : [
{
"context" : "note",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
}
]
},
{
"name" : "statusCode",
"source" : [
{
"context" : "note"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
}
]
},
{
"name" : "ManufacturedMaterialEntryContentModuleStatement",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationstatement.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.33&effectiveDate=2019-12-11T11:34:24&language=en-US",
"input" : [
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "source"
},
{
"name" : "medicationStatement",
"type" : "MedicationStatement",
"mode" : "source"
},
{
"name" : "medication",
"type" : "Medication",
"mode" : "source"
},
{
"name" : "manufacturedMaterial",
"type" : "ManufacturedMaterial",
"mode" : "target"
}
],
"rule" : [
{
"name" : "MMAT",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MMAT"
}
]
}
]
},
{
"name" : "KIND",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "KIND"
}
]
}
]
},
{
"name" : "CH-PHARM-ManufacturedMaterialContentModule",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.33"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.1"
}
]
}
]
},
{
"name" : "name",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "brandname",
"source" : [
{
"context" : "code",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "code",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "reference",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "code",
"contextType" : "variable",
"element" : "originalText",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
],
"documentation" : "#mtpc.no.brandedmedication"
},
{
"name" : "reference",
"source" : [
{
"context" : "code",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "originalText",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "code",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
},
{
"name" : "nullFlavor",
"source" : [
{
"context" : "code",
"condition" : "coding.exists() = false"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
},
{
"context" : "ce",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NA"
}
]
}
]
}
]
},
{
"name" : "form",
"source" : [
{
"context" : "medication",
"element" : "form",
"variable" : "form"
}
],
"rule" : [
{
"name" : "formCode",
"source" : [
{
"context" : "form",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "formCode",
"variable" : "formCode"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"formCode"
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "asContent",
"variable" : "asContent"
},
{
"context" : "asContent",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "CONT"
}
]
},
{
"context" : "asContent",
"contextType" : "variable",
"element" : "containerPackagedMedicine",
"variable" : "containerPackagedMedicine"
}
],
"rule" : [
{
"name" : "CONT",
"source" : [
{
"context" : "code"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "CONT"
}
]
}
]
},
{
"name" : "INSTANCE",
"source" : [
{
"context" : "code"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INSTANCE"
}
]
}
]
},
{
"name" : "pharm-code",
"source" : [
{
"context" : "code",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
},
{
"name" : "pharm-name",
"source" : [
{
"context" : "code",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
},
{
"name" : "form",
"source" : [
{
"context" : "medication",
"element" : "form",
"variable" : "form"
}
],
"rule" : [
{
"name" : "pharm-formCode",
"source" : [
{
"context" : "form",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "formCode",
"variable" : "formCode"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"formCode"
]
}
]
}
]
},
{
"name" : "amount",
"source" : [
{
"context" : "medication",
"element" : "amount",
"variable" : "amount"
}
],
"rule" : [
{
"name" : "numerator",
"source" : [
{
"context" : "amount",
"element" : "numerator",
"variable" : "numerator"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "capacityQuantity",
"variable" : "capacityQuantity"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "numerator",
"element" : "value",
"variable" : "value"
}
],
"target" : [
{
"context" : "capacityQuantity",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "unit",
"source" : [
{
"context" : "numerator",
"element" : "code",
"variable" : "unit"
}
],
"target" : [
{
"context" : "capacityQuantity",
"contextType" : "variable",
"element" : "unit",
"transform" : "copy",
"parameter" : [
{
"valueId" : "unit"
}
]
}
]
}
]
}
],
"documentation" : "Package size"
}
]
},
{
"name" : "ingredient",
"source" : [
{
"context" : "medication",
"element" : "ingredient",
"variable" : "ingredient"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "ingredient",
"variable" : "ingredient"
},
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ACTI"
}
]
}
],
"rule" : [
{
"name" : "PharmSubstance",
"source" : [
{
"context" : "ingredient",
"element" : "itemCodeableConcept",
"variable" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "ingredient",
"variable" : "pharmsubstance"
}
],
"rule" : [
{
"name" : "MMAT",
"source" : [
{
"context" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MMAT"
}
]
}
]
},
{
"name" : "KIND",
"source" : [
{
"context" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "KIND"
}
]
}
]
},
{
"name" : "name",
"source" : [
{
"context" : "itemCodeableConcept",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
},
{
"name" : "coding",
"source" : [
{
"context" : "itemCodeableConcept",
"element" : "coding",
"variable" : "coding"
}
],
"rule" : [
{
"name" : "formCode",
"source" : [
{
"context" : "coding"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
}
]
}
]
},
{
"name" : "strength",
"source" : [
{
"context" : "ingredient",
"element" : "strength",
"variable" : "strength"
}
],
"target" : [
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "quantity",
"variable" : "quantity"
}
],
"dependent" : [
{
"name" : "RatioRTOPQPQ",
"variable" : [
"strength",
"quantity"
]
}
]
}
]
}
]
},
{
"name" : "MedicationTreatmentPlanItemEntryContentModule",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationstatement.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.34&effectiveDate=2019-12-11T11:31:52&language=en-US",
"input" : [
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "source"
},
{
"name" : "medicationStatement",
"type" : "MedicationStatement",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "SBADM",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
}
]
},
{
"name" : "INT",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
]
},
{
"name" : "CH-PHARM-MedicationTreatmentPlanItemEntryContentModule",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.34"
}
]
}
]
},
{
"name" : "IHE-PHARM-MTP",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.7"
}
]
}
]
},
{
"name" : "CCD",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.10.20.1.24"
}
]
}
]
},
{
"name" : "PCC-MedicationEntryContentModule",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "medicationStatement",
"element" : "identifier",
"variable" : "identifier"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "id",
"variable" : "id"
}
],
"dependent" : [
{
"name" : "IdentifierII",
"variable" : [
"identifier",
"id"
]
}
]
},
{
"name" : "narrativeLink",
"source" : [
{
"context" : "medicationStatement",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
}
],
"rule" : [
{
"name" : "valueUrl",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "cat1narrativelink",
"source" : [
{
"context" : "medicationStatement",
"condition" : "extension.where(url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists().not()"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
}
],
"rule" : [
{
"name" : "referencetopdf",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "statusCode"
},
{
"context" : "statusCode",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
},
{
"name" : "contained",
"source" : [
{
"context" : "medicationStatement",
"element" : "contained",
"variable" : "medication",
"condition" : "('#' + $this.id) in %medicationStatement.medicationReference.reference"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MANU"
}
]
}
],
"rule" : [
{
"name" : "MP-TemplateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.2"
}
]
}
]
},
{
"name" : "MP-TemplateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.10.20.1.53"
}
]
}
]
},
{
"name" : "manufacturedMaterial",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
}
],
"dependent" : [
{
"name" : "ManufacturedMaterialEntryContentModuleStatement",
"variable" : [
"bundle",
"medicationStatement",
"medication",
"manufacturedMaterial"
]
}
]
}
]
},
{
"name" : "onylonedosage",
"source" : [
{
"context" : "medicationStatement",
"condition" : "dosage.count() = 1"
}
],
"rule" : [
{
"name" : "normalDose",
"source" : [
{
"context" : "medicationStatement",
"element" : "dosage",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.1"
}
]
}
]
}
],
"documentation" : "TODO: AUTHOR1 Medication Treatment Plan Author"
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationStatement",
"element" : "dosage",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal')"
}
],
"dependent" : [
{
"name" : "DosageInstructionsStartStopFrequencySubstanceAdministration",
"variable" : [
"dosage",
"substanceAdministration"
]
}
],
"documentation" : "dosage for normal dosing, as no sequences are present there"
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationStatement",
"element" : "dosage",
"listMode" : "first",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
}
],
"dependent" : [
{
"name" : "DosageInstructionsEntryStartStopRoute",
"variable" : [
"dosage",
"substanceAdministration",
"entryRelationship"
]
}
],
"documentation" : "dosage for split dosing (with sequences): effectiveTime (start/stop) & routeCode"
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationStatement",
"element" : "dosage",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
}
],
"dependent" : [
{
"name" : "DosageInstructionsEntryDosageChangeSubstanceAdministration",
"variable" : [
"dosage",
"substanceAdministration",
"entryRelationship"
]
}
],
"documentation" : "dosage for split dosing (with sequences): sequence number, effectiveTime (when), dose quantity, consumable"
},
{
"name" : "TreatmentReasonEntryContentModule",
"source" : [
{
"context" : "medicationStatement",
"element" : "reasonCode",
"variable" : "reasonCode"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "RSON"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "observation",
"variable" : "observation"
}
],
"dependent" : [
{
"name" : "TreatmentReasonEntryContentModule",
"variable" : [
"reasonCode",
"observation"
]
}
]
},
{
"name" : "MTP-Reference",
"source" : [
{
"context" : "medicationStatement",
"element" : "extension",
"variable" : "extension",
"condition" : "url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan'"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "REFR"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "MTPReferenceEntryContentModule",
"variable" : [
"extension",
"substanceAdministration"
]
}
]
},
{
"name" : "repeatNumberDefault",
"source" : [
{
"context" : "medicationStatement"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "repeatNumber",
"variable" : "repeatNumber"
},
{
"context" : "repeatNumber",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NI"
}
]
}
],
"documentation" : "https://github.com/ehealthsuisse/ch-emed/issues/56"
},
{
"name" : "DosageInstructionsNonStructuredEntryContentModule",
"source" : [
{
"context" : "medicationStatement",
"element" : "dosage",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "DosageInstructionsNonStructuredEntryContentModule",
"variable" : [
"dosage",
"substanceAdministration"
]
}
],
"documentation" : "TODO: Patient Medication Instructions Contains 1.3.6.1.4.1.19376.1.5.3.1.4.3 IHE Patient Medication Instructions (DYNAMIC)"
},
{
"name" : "AnnotationComment",
"source" : [
{
"context" : "medicationStatement",
"element" : "note",
"variable" : "note"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "act",
"variable" : "act"
}
],
"dependent" : [
{
"name" : "AnnotationComment",
"variable" : [
"note",
"act"
]
}
]
},
{
"name" : "Substitution",
"source" : [
{
"context" : "medicationStatement",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-substitution'"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "act",
"variable" : "act"
}
],
"dependent" : [
{
"name" : "SubstitutionStatement",
"variable" : [
"extension",
"act"
]
}
]
}
]
},
{
"name" : "DosageInstructionsStartStopFrequencySubstanceAdministration",
"typeMode" : "none",
"documentation" : "TODO: Tapered Dose\r\nmedicationStatement -> substanceAdministration.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.8' \"taperedDose\";\r\nsource: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.35\r\ndosage for normal dosing (without sequences) (Statement, Prescription)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "normalDose",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.1"
}
]
}
]
},
{
"name" : "effectiveTimeStartEnd",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeStartEnd",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "effectiveTimeWhen",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeWhenNormal",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "route",
"source" : [
{
"context" : "dosage",
"element" : "route",
"variable" : "route"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "routeCode",
"variable" : "routeCode"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"route",
"routeCode"
]
}
]
},
{
"name" : "doseQuantity",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "DoseQuantity",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
}
]
},
{
"name" : "DosageInstructionsEntryStartStopRoute",
"typeMode" : "none",
"documentation" : "source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\r\ndosage for split dosing: effectiveTime (start/stop) & routeCode (Statement, Prescription)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "substanceAdministration",
"mode" : "target"
},
{
"name" : "entry",
"type" : "entryRelationship",
"mode" : "target"
}
],
"rule" : [
{
"name" : "splitDose",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.9"
}
]
}
],
"documentation" : "if the FHIR doucment has no dosage templateId -> create templateId for split dose"
},
{
"name" : "effectiveTimeStartEnd",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeStartEnd",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "route",
"source" : [
{
"context" : "dosage",
"element" : "route",
"variable" : "route"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "routeCode",
"variable" : "routeCode"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"route",
"routeCode"
]
}
]
}
]
},
{
"name" : "DosageInstructionsEntryDosageChangeSubstanceAdministration",
"typeMode" : "none",
"documentation" : "source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\r\ndosage for split dosing: sequence number, effectiveTime (when), dose quantity, consumable (Statement, Prescription)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "substanceAdministration",
"mode" : "target"
},
{
"name" : "entry",
"type" : "entryRelationship",
"mode" : "target"
}
],
"rule" : [
{
"name" : "sequence",
"source" : [
{
"context" : "dosage",
"element" : "sequence",
"variable" : "sequence"
}
],
"target" : [
{
"context" : "entry",
"contextType" : "variable",
"element" : "sequenceNumber",
"variable" : "sequenceNumber"
},
{
"context" : "sequenceNumber",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "sequence"
}
]
}
]
},
{
"name" : "dosage",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "entry",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
},
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
},
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
],
"rule" : [
{
"name" : "effectiveTimeWhen",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeWhenSplit",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "doseQuantity",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "DoseQuantity",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "consumable",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
},
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
},
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NA"
}
]
}
]
}
]
}
]
},
{
"name" : "EffectiveTimeStartEnd",
"typeMode" : "none",
"documentation" : "effective time low and high for dosage (Statement, Prescription)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "timing",
"source" : [
{
"context" : "dosage",
"element" : "timing",
"variable" : "timing"
}
],
"rule" : [
{
"name" : "repeat",
"source" : [
{
"context" : "timing",
"element" : "repeat",
"variable" : "repeat"
}
],
"rule" : [
{
"name" : "bounds",
"source" : [
{
"context" : "repeat",
"type" : "Period",
"element" : "bounds",
"variable" : "bounds"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "effectiveTime",
"variable" : "effectiveTime",
"transform" : "create",
"parameter" : [
{
"valueString" : "IVL_TS"
}
]
}
],
"rule" : [
{
"name" : "low",
"source" : [
{
"context" : "bounds",
"element" : "start",
"variable" : "start"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "low",
"variable" : "low"
}
],
"dependent" : [
{
"name" : "DateTS",
"variable" : [
"start",
"low"
]
}
]
},
{
"name" : "NullFlavorLow",
"source" : [
{
"context" : "bounds",
"condition" : "start.exists().not()"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "low",
"variable" : "low"
},
{
"context" : "low",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "UNK"
}
]
}
]
},
{
"name" : "high",
"source" : [
{
"context" : "bounds",
"element" : "end",
"variable" : "end"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "high",
"variable" : "high"
}
],
"dependent" : [
{
"name" : "DateTS",
"variable" : [
"end",
"high"
]
}
]
},
{
"name" : "NullFlavorhigh",
"source" : [
{
"context" : "bounds",
"condition" : "end.exists().not()"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "high",
"variable" : "high"
},
{
"context" : "high",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "UNK"
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "DoseQuantity",
"typeMode" : "none",
"documentation" : "dose quantity for dosage (application schema) (Statement)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "doseQuantity",
"source" : [
{
"context" : "dosage",
"element" : "doseAndRate",
"variable" : "doseAndRate"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "doseQuantity",
"variable" : "doseQuantity"
}
],
"rule" : [
{
"name" : "quantity",
"source" : [
{
"context" : "doseAndRate",
"type" : "Quantity",
"element" : "dose",
"variable" : "quantity"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "quantity",
"element" : "value",
"variable" : "value"
}
],
"target" : [
{
"context" : "doseQuantity",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "quantity",
"element" : "code",
"variable" : "code"
}
],
"target" : [
{
"context" : "doseQuantity",
"contextType" : "variable",
"element" : "unit",
"transform" : "copy",
"parameter" : [
{
"valueId" : "code"
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "TreatmentReasonEntryContentModule",
"typeMode" : "none",
"documentation" : "source: reasonCode Coding (e.g. http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-medicationstatement)\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.41\r\nTreatment Reason (Statement, Prescription)",
"input" : [
{
"name" : "reasonCode",
"type" : "Coding",
"mode" : "source"
},
{
"name" : "observation",
"type" : "Observation",
"mode" : "target"
}
],
"rule" : [
{
"name" : "OBS",
"source" : [
{
"context" : "reasonCode"
}
],
"target" : [
{
"context" : "observation",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "OBS"
}
]
}
]
},
{
"name" : "EVN",
"source" : [
{
"context" : "reasonCode"
}
],
"target" : [
{
"context" : "observation",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "EVN"
}
]
}
]
},
{
"name" : "TreatmentReasonEntryContentModule",
"source" : [
{
"context" : "reasonCode"
}
],
"target" : [
{
"context" : "observation",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.41"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "reasonCode"
}
],
"target" : [
{
"context" : "observation",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "75326-9"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "codeSystem",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.6.1"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "displayName",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Problem"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "codeSystemName",
"transform" : "copy",
"parameter" : [
{
"valueString" : "LOINC"
}
]
}
]
},
{
"name" : "text",
"source" : [
{
"context" : "reasonCode",
"element" : "text",
"variable" : "reasonText"
}
],
"target" : [
{
"context" : "observation",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
}
],
"rule" : [
{
"name" : "text",
"source" : [
{
"context" : "reasonText"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "data",
"transform" : "copy",
"parameter" : [
{
"valueId" : "reasonText"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "reasonCode",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"rule" : [
{
"name" : "reference",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "reference",
"source" : [
{
"context" : "reasonCode",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
}
]
},
{
"name" : "statusCode",
"source" : [
{
"context" : "reasonCode"
}
],
"target" : [
{
"context" : "observation",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
}
]
},
{
"name" : "MTPReferenceEntryContentModule",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-ext-treatmentplan.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?section=templates&id=2.16.756.5.30.1.1.10.4.45&effectiveDate=2017-01-10T15:34:25&language=en-US",
"input" : [
{
"name" : "ext",
"type" : "Extension",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "SBADM",
"source" : [
{
"context" : "ext"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
}
]
},
{
"name" : "INT",
"source" : [
{
"context" : "ext"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
]
},
{
"name" : "referenceTo-MTP-PlanItemGeneralSpecificationTemplateId",
"source" : [
{
"context" : "ext"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.10"
}
]
}
]
},
{
"name" : "CH-PHARM-templateId",
"source" : [
{
"context" : "ext"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.45"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "ext",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'id'"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "extension",
"element" : "valueIdentifier",
"variable" : "valueIdentifier"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "id",
"variable" : "id"
}
],
"dependent" : [
{
"name" : "IdentifierII",
"variable" : [
"valueIdentifier",
"id"
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "ext"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MTPItem"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "codeSystem",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.2.2"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "displayName",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Medication Treatment Plan Item"
}
]
},
{
"context" : "code",
"contextType" : "variable",
"element" : "codeSystemName",
"transform" : "copy",
"parameter" : [
{
"valueString" : "IHE Pharmacy Item Type List"
}
]
}
]
},
{
"name" : "consumable",
"source" : [
{
"context" : "ext"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
},
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NA"
}
]
}
]
},
{
"name" : "externalDocumentId",
"source" : [
{
"context" : "ext",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'externalDocumentId'"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "extension",
"element" : "valueIdentifier",
"variable" : "valueIdentifier"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "XCRPT"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "externalDocument",
"variable" : "externalDocument"
},
{
"context" : "externalDocument",
"contextType" : "variable",
"element" : "id",
"variable" : "id"
}
],
"dependent" : [
{
"name" : "IdentifierII",
"variable" : [
"valueIdentifier",
"id"
]
}
]
}
]
}
]
},
{
"name" : "DosageInstructionsNonStructuredEntryContentModule",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-dosage-nonstructured.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?section=templates&id=2.16.756.5.30.1.1.10.4.52\r\nDosage Instruction (Statement, Prescription)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "SBADM",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
}
]
},
{
"name" : "INT",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.52"
}
]
}
]
},
{
"name" : "text",
"source" : [
{
"context" : "dosage",
"element" : "text",
"variable" : "noteText"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
}
],
"rule" : [
{
"name" : "text",
"source" : [
{
"context" : "noteText"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "data",
"transform" : "copy",
"parameter" : [
{
"valueId" : "noteText"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "dosage",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"rule" : [
{
"name" : "reference",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "reference",
"source" : [
{
"context" : "dosage",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
}
]
},
{
"name" : "consumable",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
},
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NA"
}
]
}
]
}
]
},
{
"name" : "SubstitutionDispense",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationdispense.html\r\ntarget: Substitution act Contains 1.3.6.1.4.1.19376.1.9.1.3.9.2 IHE Substitution Act Content Module\r\nSubstitution (Dispense)",
"input" : [
{
"name" : "substitution",
"type" : "Substitution",
"mode" : "source"
},
{
"name" : "act",
"type" : "Act",
"mode" : "target"
}
],
"rule" : [
{
"name" : "ACT",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ACT"
}
]
}
]
},
{
"name" : "EVN",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "EVN"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.9.2"
}
]
}
]
},
{
"name" : "substitution",
"source" : [
{
"context" : "substitution",
"element" : "type",
"variable" : "type"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"type",
"code"
]
}
]
},
{
"name" : "statusCode",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "statusCode"
},
{
"context" : "statusCode",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
}
]
},
{
"name" : "ManufacturedMaterialEntryContentModuleDispense",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationdispense.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.33&effectiveDate=2019-12-11T11:34:24&language=en-US",
"input" : [
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "source"
},
{
"name" : "medicationDispense",
"type" : "MedicationDispense",
"mode" : "source"
},
{
"name" : "medication",
"type" : "Medication",
"mode" : "source"
},
{
"name" : "manufacturedMaterial",
"type" : "ManufacturedMaterial",
"mode" : "target"
}
],
"rule" : [
{
"name" : "MMAT",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MMAT"
}
]
}
]
},
{
"name" : "KIND",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "KIND"
}
]
}
]
},
{
"name" : "CH-PHARM-ManufacturedMaterialContentModule",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.33"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.1"
}
]
}
]
},
{
"name" : "name",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "brandname",
"source" : [
{
"context" : "code",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "code",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "reference",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "code",
"contextType" : "variable",
"element" : "originalText",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
],
"documentation" : "#dis.no.brandedmedication"
},
{
"name" : "reference",
"source" : [
{
"context" : "code",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "originalText",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "code",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
}
]
},
{
"name" : "form",
"source" : [
{
"context" : "medication",
"element" : "form",
"variable" : "form"
}
],
"rule" : [
{
"name" : "formCode",
"source" : [
{
"context" : "form",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "formCode",
"variable" : "formCode"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"formCode"
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "asContent",
"variable" : "asContent"
},
{
"context" : "asContent",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "CONT"
}
]
},
{
"context" : "asContent",
"contextType" : "variable",
"element" : "containerPackagedMedicine",
"variable" : "containerPackagedMedicine"
}
],
"rule" : [
{
"name" : "CONT",
"source" : [
{
"context" : "code"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "CONT"
}
]
}
]
},
{
"name" : "INSTANCE",
"source" : [
{
"context" : "code"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INSTANCE"
}
]
}
]
},
{
"name" : "pharm-code",
"source" : [
{
"context" : "code",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
},
{
"name" : "pharm-name",
"source" : [
{
"context" : "code",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
},
{
"name" : "form",
"source" : [
{
"context" : "medication",
"element" : "form",
"variable" : "form"
}
],
"rule" : [
{
"name" : "pharm-formCode",
"source" : [
{
"context" : "form",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "formCode",
"variable" : "formCode"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"formCode"
]
}
]
}
]
},
{
"name" : "amount",
"source" : [
{
"context" : "medication",
"element" : "amount",
"variable" : "amount"
}
],
"rule" : [
{
"name" : "numerator",
"source" : [
{
"context" : "amount",
"element" : "numerator",
"variable" : "numerator"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "capacityQuantity",
"variable" : "capacityQuantity"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "numerator",
"element" : "value",
"variable" : "value"
}
],
"target" : [
{
"context" : "capacityQuantity",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "unit",
"source" : [
{
"context" : "numerator",
"element" : "code",
"variable" : "unit"
}
],
"target" : [
{
"context" : "capacityQuantity",
"contextType" : "variable",
"element" : "unit",
"transform" : "copy",
"parameter" : [
{
"valueId" : "unit"
}
]
}
]
}
]
}
],
"documentation" : "Package size"
}
]
},
{
"name" : "ingredient",
"source" : [
{
"context" : "medication",
"element" : "ingredient",
"variable" : "ingredient"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "ingredient",
"variable" : "ingredient"
},
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ACTI"
}
]
}
],
"rule" : [
{
"name" : "PharmSubstance",
"source" : [
{
"context" : "ingredient",
"element" : "itemCodeableConcept",
"variable" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "ingredient",
"variable" : "pharmsubstance"
}
],
"rule" : [
{
"name" : "MMAT",
"source" : [
{
"context" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MMAT"
}
]
}
]
},
{
"name" : "KIND",
"source" : [
{
"context" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "KIND"
}
]
}
]
},
{
"name" : "name",
"source" : [
{
"context" : "itemCodeableConcept",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
},
{
"name" : "coding",
"source" : [
{
"context" : "itemCodeableConcept",
"element" : "coding",
"variable" : "coding"
}
],
"rule" : [
{
"name" : "formCode",
"source" : [
{
"context" : "coding"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
}
]
}
]
},
{
"name" : "strength",
"source" : [
{
"context" : "ingredient",
"element" : "strength",
"variable" : "strength"
}
],
"target" : [
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "quantity",
"variable" : "quantity"
}
],
"dependent" : [
{
"name" : "RatioRTOPQPQ",
"variable" : [
"strength",
"quantity"
]
}
]
}
]
}
]
},
{
"name" : "DispenseItemEntryContentModule",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationdispense.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.42",
"input" : [
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "source"
},
{
"name" : "medicationDispense",
"type" : "MedicationDispense",
"mode" : "source"
},
{
"name" : "supply",
"type" : "Supply",
"mode" : "target"
}
],
"rule" : [
{
"name" : "SPLY",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SPLY"
}
]
}
]
},
{
"name" : "EVN",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "EVN"
}
]
}
]
},
{
"name" : "CH-PHARM-DispenseItemEntryContentModule",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.42"
}
]
}
]
},
{
"name" : "IHE-PHARM-DIS",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.4"
}
]
}
]
},
{
"name" : "supplyEntry",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.3"
}
]
}
]
},
{
"name" : "CCD",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.10.20.1.34"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "medicationDispense",
"element" : "identifier",
"variable" : "identifier"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "id",
"variable" : "id"
}
],
"dependent" : [
{
"name" : "IdentifierII",
"variable" : [
"identifier",
"id"
]
}
]
},
{
"name" : "narrativeLink",
"source" : [
{
"context" : "medicationDispense",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
}
],
"rule" : [
{
"name" : "valueUrl",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "reference",
"source" : [
{
"context" : "medicationDispense",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
},
{
"name" : "contained",
"source" : [
{
"context" : "medicationDispense",
"element" : "contained",
"variable" : "medication",
"condition" : "('#' + $this.id) in %medicationDispense.medicationReference.reference"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "product",
"variable" : "product"
},
{
"context" : "product",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MANU"
}
]
}
],
"rule" : [
{
"name" : "MP-TemplateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.2"
}
]
}
]
},
{
"name" : "MP-TemplateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.10.20.1.53"
}
]
}
]
},
{
"name" : "manufacturedMaterial",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
}
],
"dependent" : [
{
"name" : "ManufacturedMaterialEntryContentModuleDispense",
"variable" : [
"bundle",
"medicationDispense",
"medication",
"manufacturedMaterial"
]
}
]
}
]
},
{
"name" : "MTP-Reference",
"source" : [
{
"context" : "medicationDispense",
"element" : "extension",
"variable" : "extension",
"condition" : "url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan'"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "REFR"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "MTPReferenceEntryContentModule",
"variable" : [
"extension",
"substanceAdministration"
]
}
],
"documentation" : "TODO: AUTHOR1 Medication Treatment Plan Author"
},
{
"name" : "onylonedosage",
"source" : [
{
"context" : "medicationDispense",
"condition" : "dosageInstruction.count() = 1"
}
],
"rule" : [
{
"name" : "normalDose",
"source" : [
{
"context" : "medicationDispense",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.1"
}
]
}
]
}
],
"documentation" : "#24 missing template it if ch-emed-dosage-nonstructured"
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationDispense",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal')"
}
],
"dependent" : [
{
"name" : "DosageInstructionsStartStopFrequencySupply",
"variable" : [
"dosage",
"supply"
]
}
],
"documentation" : "dosage for normal dosing, as no sequences are present there"
},
{
"name" : "entryRelationship",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
}
],
"rule" : [
{
"name" : "substanceAdministration",
"source" : [
{
"context" : "medicationDispense"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"rule" : [
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationDispense",
"element" : "dosageInstruction",
"listMode" : "first",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split')"
}
],
"target" : [
{
"contextType" : "variable",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "DosageInstructionsEntryStartStopRouteConsumable",
"variable" : [
"dosage",
"entryRelationship",
"substanceAdministration"
]
}
],
"documentation" : "split dosing (with sequences): effectiveTime (start/stop) & routeCode & consumable"
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationDispense",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
}
],
"dependent" : [
{
"name" : "DosageInstructionsEntryDosageChangeEntryRelationship",
"variable" : [
"dosage",
"entryRelationship"
]
}
],
"documentation" : "split dosing (with sequences): sequence number, effectiveTime (when), dose quantity, consumable"
}
]
}
],
"documentation" : "dosage for split dosing, as sequences are present there"
},
{
"name" : "DosageInstructionsNonStructuredEntryContentModule",
"source" : [
{
"context" : "medicationDispense",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured')"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "DosageInstructionsNonStructuredEntryContentModule",
"variable" : [
"dosage",
"substanceAdministration"
]
}
],
"documentation" : "TODO: Precondition Criterion"
},
{
"name" : "quantity",
"source" : [
{
"context" : "medicationDispense",
"element" : "quantity",
"variable" : "quantity"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "quantity",
"variable" : "supplyQuantity"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "quantity",
"element" : "value",
"variable" : "value"
}
],
"target" : [
{
"context" : "supplyQuantity",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
}
],
"documentation" : "Number of packages"
},
{
"name" : "AnnotationComment",
"source" : [
{
"context" : "medicationDispense",
"element" : "note",
"variable" : "note"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "act",
"variable" : "act"
}
],
"dependent" : [
{
"name" : "AnnotationComment",
"variable" : [
"note",
"act"
]
}
]
},
{
"name" : "Substitution",
"source" : [
{
"context" : "medicationDispense",
"element" : "substitution",
"variable" : "substitution"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "act",
"variable" : "act"
}
],
"dependent" : [
{
"name" : "SubstitutionDispense",
"variable" : [
"substitution",
"act"
]
}
]
}
]
},
{
"name" : "DosageInstructionsStartStopFrequencySupply",
"typeMode" : "none",
"documentation" : "source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.35\r\ndosage for normal dosing (without sequences) (Dispense)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "supply",
"type" : "Supply",
"mode" : "target"
}
],
"rule" : [
{
"name" : "entryRelationship",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
}
],
"rule" : [
{
"name" : "COMP",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
}
]
},
{
"name" : "substanceAdministration",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"rule" : [
{
"name" : "SBADM",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
}
]
},
{
"name" : "INT",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.6"
}
]
}
]
},
{
"name" : "normalDose",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.1"
}
]
}
]
},
{
"name" : "effectiveTimeStartEnd",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeStartEnd",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "effectiveTimeWhen",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeWhenNormal",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "route",
"source" : [
{
"context" : "dosage",
"element" : "route",
"variable" : "route"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "routeCode",
"variable" : "routeCode"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"route",
"routeCode"
]
}
]
},
{
"name" : "doseQuantity",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "DoseQuantity",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "consumable",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
},
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
},
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NA"
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "DosageInstructionsEntryStartStopRouteConsumable",
"typeMode" : "none",
"documentation" : "source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\r\ndosage for split dosing: effectiveTime (start/stop) & routeCode & consumable (Dispense)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "entryRelationship",
"type" : "entryRelationship",
"mode" : "target"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "COMP",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
}
]
},
{
"name" : "SBADM",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
}
]
},
{
"name" : "INT",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.6"
}
]
}
]
},
{
"name" : "splitDose",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.9"
}
]
}
]
},
{
"name" : "effectiveTimeStartEnd",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"variable" : "substanceAdministration",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeStartEnd",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "route",
"source" : [
{
"context" : "dosage",
"element" : "route",
"variable" : "route"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "routeCode",
"variable" : "routeCode"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"route",
"routeCode"
]
}
]
},
{
"name" : "consumable",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
},
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NA"
}
]
}
]
}
]
},
{
"name" : "DosageInstructionsEntryDosageChangeEntryRelationship",
"typeMode" : "none",
"documentation" : "source: http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split\r\ntarget: https://art-decor.org/art-decor/decor-templates--ch-pharm-?id=2.16.756.5.30.1.1.10.4.36\r\ndosage for split dosing: sequence number, effectiveTime (when), dose quantity, consumable (Dispense)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "entryRelationship",
"type" : "entryRelationship",
"mode" : "target"
}
],
"rule" : [
{
"name" : "sequence",
"source" : [
{
"context" : "dosage",
"element" : "sequence",
"variable" : "sequence"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "sequenceNumber",
"variable" : "sequenceNumber"
},
{
"context" : "sequenceNumber",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "sequence"
}
]
}
]
},
{
"name" : "dosage",
"source" : [
{
"context" : "dosage"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
},
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
},
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
],
"rule" : [
{
"name" : "effectiveTimeWhen",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "EffectiveTimeWhenSplit",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "doseQuantity",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"contextType" : "variable",
"transform" : "copy",
"parameter" : [
{
"valueId" : "substanceAdministration"
}
]
}
],
"dependent" : [
{
"name" : "DoseQuantity",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "consumable",
"source" : [
{
"context" : "dosage",
"variable" : "dosage"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
},
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NA"
}
]
}
]
}
]
}
]
},
{
"name" : "EffectiveTimeWhenNormal",
"typeMode" : "none",
"documentation" : "effective time when for normal dosage (Dispense, Statement, Prescription)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "timing",
"source" : [
{
"context" : "dosage",
"element" : "timing",
"variable" : "timing"
}
],
"rule" : [
{
"name" : "repeat",
"source" : [
{
"context" : "timing",
"element" : "repeat",
"variable" : "repeat"
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "repeat",
"condition" : "$this.when.count() = 1"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "effectiveTime",
"variable" : "effectiveTime",
"transform" : "create",
"parameter" : [
{
"valueString" : "EIVL_TS"
}
]
},
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "operator",
"transform" : "copy",
"parameter" : [
{
"valueString" : "A"
}
]
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "repeat",
"element" : "when",
"variable" : "when"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "event",
"variable" : "event"
},
{
"context" : "event",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueId" : "when"
}
]
}
]
}
]
},
{
"name" : "when",
"source" : [
{
"context" : "repeat",
"condition" : "$this.when.count() > 1"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "effectiveTime",
"variable" : "effectiveTime",
"transform" : "create",
"parameter" : [
{
"valueString" : "SXPR_TS"
}
]
},
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "operator",
"transform" : "copy",
"parameter" : [
{
"valueString" : "A"
}
]
}
],
"rule" : [
{
"name" : "comp",
"source" : [
{
"context" : "repeat",
"element" : "when",
"listMode" : "first",
"variable" : "when"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "comp",
"variable" : "comp",
"transform" : "create",
"parameter" : [
{
"valueString" : "EIVL_TS"
}
]
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "when"
}
],
"target" : [
{
"context" : "comp",
"contextType" : "variable",
"element" : "event",
"variable" : "event"
},
{
"context" : "event",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueId" : "when"
}
]
}
]
}
]
},
{
"name" : "compnotfirst",
"source" : [
{
"context" : "repeat",
"element" : "when",
"listMode" : "not_first",
"variable" : "when"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "comp",
"variable" : "comp",
"transform" : "create",
"parameter" : [
{
"valueString" : "EIVL_TS"
}
]
},
{
"context" : "comp",
"contextType" : "variable",
"element" : "operator",
"transform" : "copy",
"parameter" : [
{
"valueString" : "I"
}
]
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "when"
}
],
"target" : [
{
"context" : "comp",
"contextType" : "variable",
"element" : "event",
"variable" : "event"
},
{
"context" : "event",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueId" : "when"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "EffectiveTimeWhenSplit",
"typeMode" : "none",
"documentation" : "effective time when for split dosage (Dispense, Statement, Prescription)",
"input" : [
{
"name" : "dosage",
"type" : "Dosage",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "timing",
"source" : [
{
"context" : "dosage",
"element" : "timing",
"variable" : "timing"
}
],
"rule" : [
{
"name" : "repeat",
"source" : [
{
"context" : "timing",
"element" : "repeat",
"variable" : "repeat"
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "repeat",
"condition" : "$this.when.count() = 1"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "effectiveTime",
"variable" : "effectiveTime",
"transform" : "create",
"parameter" : [
{
"valueString" : "EIVL_TS"
}
]
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "repeat",
"element" : "when",
"variable" : "when"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "event",
"variable" : "event"
},
{
"context" : "event",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueId" : "when"
}
]
}
]
}
]
},
{
"name" : "when",
"source" : [
{
"context" : "repeat",
"condition" : "$this.when.count() > 1"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "effectiveTime",
"variable" : "effectiveTime",
"transform" : "create",
"parameter" : [
{
"valueString" : "SXPR_TS"
}
]
},
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "operator",
"transform" : "copy",
"parameter" : [
{
"valueString" : "A"
}
]
}
],
"rule" : [
{
"name" : "comp",
"source" : [
{
"context" : "repeat",
"element" : "when",
"listMode" : "first",
"variable" : "when"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "comp",
"variable" : "comp",
"transform" : "create",
"parameter" : [
{
"valueString" : "EIVL_TS"
}
]
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "when"
}
],
"target" : [
{
"context" : "comp",
"contextType" : "variable",
"element" : "event",
"variable" : "event"
},
{
"context" : "event",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueId" : "when"
}
]
}
]
}
]
},
{
"name" : "compnotfirst",
"source" : [
{
"context" : "repeat",
"element" : "when",
"listMode" : "not_first",
"variable" : "when"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "comp",
"variable" : "comp",
"transform" : "create",
"parameter" : [
{
"valueString" : "EIVL_TS"
}
]
},
{
"context" : "comp",
"contextType" : "variable",
"element" : "operator",
"transform" : "copy",
"parameter" : [
{
"valueString" : "I"
}
]
}
],
"rule" : [
{
"name" : "when",
"source" : [
{
"context" : "when"
}
],
"target" : [
{
"context" : "comp",
"contextType" : "variable",
"element" : "event",
"variable" : "event"
},
{
"context" : "event",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueId" : "when"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "SubstitutionRequest",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\r\ntarget: Substitution permission Contains 1.3.6.1.4.1.19376.1.9.1.3.9.1 IHE Substitution Permission Content Module",
"input" : [
{
"name" : "substitution",
"type" : "Substitution",
"mode" : "source"
},
{
"name" : "act",
"type" : "Act",
"mode" : "target"
}
],
"rule" : [
{
"name" : "ACT",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ACT"
}
]
}
]
},
{
"name" : "DEF",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "DEF"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.9.1"
}
]
}
]
},
{
"name" : "substitution",
"source" : [
{
"context" : "substitution",
"element" : "allowedCodeableConcept",
"variable" : "allowedCC"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"allowedCC",
"code"
]
}
]
},
{
"name" : "statusCode",
"source" : [
{
"context" : "substitution"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "statusCode"
},
{
"context" : "statusCode",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
}
]
},
{
"name" : "SubstitutionStatement",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\r\ntarget: Substitution permission Contains 1.3.6.1.4.1.19376.1.9.1.3.9.1 IHE Substitution Permission Content Module",
"input" : [
{
"name" : "extension",
"type" : "Extension",
"mode" : "source"
},
{
"name" : "act",
"type" : "Act",
"mode" : "target"
}
],
"rule" : [
{
"name" : "ACT",
"source" : [
{
"context" : "extension"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ACT"
}
]
}
]
},
{
"name" : "DEF",
"source" : [
{
"context" : "extension"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "DEF"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "extension"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.9.1"
}
]
}
]
},
{
"name" : "extension",
"source" : [
{
"context" : "extension",
"element" : "valueCodeableConcept",
"variable" : "valueCC"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"valueCC",
"code"
]
}
]
},
{
"name" : "statusCode",
"source" : [
{
"context" : "extension"
}
],
"target" : [
{
"context" : "act",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "statusCode"
},
{
"context" : "statusCode",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
}
]
},
{
"name" : "PrescribedQuantity",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?id=2.16.756.5.30.1.1.10.4.38",
"input" : [
{
"name" : "dispenseRequest",
"type" : "DispenseRequest",
"mode" : "source"
},
{
"name" : "supply",
"type" : "Supply",
"mode" : "target"
}
],
"rule" : [
{
"name" : "SPLY",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SPLY"
}
]
}
]
},
{
"name" : "RQO",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "RQO"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.8"
}
]
}
]
},
{
"name" : "independentInd",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "independentInd",
"variable" : "independentInd"
},
{
"context" : "independentInd",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "false"
}
]
}
]
},
{
"name" : "quantity",
"source" : [
{
"context" : "dispenseRequest",
"element" : "quantity",
"variable" : "quantity"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "quantity",
"variable" : "quant"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "quantity",
"element" : "value",
"variable" : "value"
}
],
"target" : [
{
"context" : "quant",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
}
],
"documentation" : "Number of packages"
}
]
},
{
"name" : "PrescribedQuantityUnit",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?id=2.16.756.5.30.1.1.10.4.38",
"input" : [
{
"name" : "dispenseRequest",
"type" : "DispenseRequest",
"mode" : "source"
},
{
"name" : "supply",
"type" : "Supply",
"mode" : "target"
}
],
"rule" : [
{
"name" : "SPLY",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SPLY"
}
]
}
]
},
{
"name" : "RQO",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "RQO"
}
]
}
]
},
{
"name" : "TemplateId",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.8"
}
]
}
]
},
{
"name" : "independentInd",
"source" : [
{
"context" : "dispenseRequest"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "independentInd",
"variable" : "independentInd"
},
{
"context" : "independentInd",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "false"
}
]
}
]
},
{
"name" : "quantity",
"source" : [
{
"context" : "dispenseRequest",
"element" : "quantity",
"variable" : "quantity"
}
],
"target" : [
{
"context" : "supply",
"contextType" : "variable",
"element" : "quantity",
"variable" : "quant"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "quantity",
"element" : "value",
"variable" : "value"
}
],
"target" : [
{
"context" : "quant",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "unit",
"source" : [
{
"context" : "quantity",
"element" : "unit",
"variable" : "unit"
}
],
"target" : [
{
"context" : "quant",
"contextType" : "variable",
"element" : "unit",
"transform" : "copy",
"parameter" : [
{
"valueId" : "unit"
}
]
}
]
}
],
"documentation" : "Number of packages"
}
]
},
{
"name" : "ManufacturedMaterialEntryContentModulePrescription",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.33",
"input" : [
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "source"
},
{
"name" : "medicationRequest",
"type" : "MedicationRequest",
"mode" : "source"
},
{
"name" : "medication",
"type" : "Medication",
"mode" : "source"
},
{
"name" : "manufacturedMaterial",
"type" : "ManufacturedMaterial",
"mode" : "target"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "MMAT",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MMAT"
}
]
}
]
},
{
"name" : "KIND",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "KIND"
}
]
}
]
},
{
"name" : "CH-PHARM-ManufacturedMaterialContentModule",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.33"
}
]
}
]
},
{
"name" : "templateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.1"
}
]
}
]
},
{
"name" : "name",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "brandname",
"source" : [
{
"context" : "code",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "code",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
}
],
"rule" : [
{
"name" : "reference",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "code",
"contextType" : "variable",
"element" : "originalText",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
],
"documentation" : "#pre.no.brandedmedication"
},
{
"name" : "reference",
"source" : [
{
"context" : "code",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "originalText",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "code",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
}
]
},
{
"name" : "form",
"source" : [
{
"context" : "medication",
"element" : "form",
"variable" : "form"
}
],
"rule" : [
{
"name" : "formCode",
"source" : [
{
"context" : "form",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "formCode",
"variable" : "formCode"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"formCode"
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medication",
"element" : "code",
"variable" : "code"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "asContent",
"variable" : "asContent"
},
{
"context" : "asContent",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "CONT"
}
]
},
{
"context" : "asContent",
"contextType" : "variable",
"element" : "containerPackagedMedicine",
"variable" : "containerPackagedMedicine"
}
],
"rule" : [
{
"name" : "CONT",
"source" : [
{
"context" : "code"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "CONT"
}
]
}
]
},
{
"name" : "INSTANCE",
"source" : [
{
"context" : "code"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INSTANCE"
}
]
}
]
},
{
"name" : "pharm-code",
"source" : [
{
"context" : "code",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
},
{
"name" : "pharm-name",
"source" : [
{
"context" : "code",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
},
{
"name" : "form",
"source" : [
{
"context" : "medication",
"element" : "form",
"variable" : "form"
}
],
"rule" : [
{
"name" : "pharm-formCode",
"source" : [
{
"context" : "form",
"element" : "coding",
"variable" : "coding"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "formCode",
"variable" : "formCode"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"formCode"
]
}
]
}
]
},
{
"name" : "amount",
"source" : [
{
"context" : "medication",
"element" : "amount",
"variable" : "amount"
}
],
"rule" : [
{
"name" : "numerator",
"source" : [
{
"context" : "amount",
"element" : "numerator",
"variable" : "numerator"
}
],
"target" : [
{
"context" : "containerPackagedMedicine",
"contextType" : "variable",
"element" : "capacityQuantity",
"variable" : "capacityQuantity"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "numerator",
"element" : "value",
"variable" : "value"
}
],
"target" : [
{
"context" : "capacityQuantity",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "unit",
"source" : [
{
"context" : "numerator",
"element" : "code",
"variable" : "unit"
}
],
"target" : [
{
"context" : "capacityQuantity",
"contextType" : "variable",
"element" : "unit",
"transform" : "copy",
"parameter" : [
{
"valueId" : "unit"
}
]
}
]
}
]
},
{
"name" : "PrescribedQuantity",
"source" : [
{
"context" : "medicationRequest",
"element" : "dispenseRequest",
"variable" : "dispenseRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "supply",
"variable" : "supply"
}
],
"dependent" : [
{
"name" : "PrescribedQuantity",
"variable" : [
"dispenseRequest",
"supply"
]
}
],
"documentation" : "IHE-DIS: Case 1: If the product-element contains package information, the unit attribute is not be present"
}
],
"documentation" : "Package size"
},
{
"name" : "noAmount",
"source" : [
{
"context" : "medication",
"condition" : "$this.amount.exists() = false"
}
],
"rule" : [
{
"name" : "PrescribedQuantityUnit",
"source" : [
{
"context" : "medicationRequest",
"element" : "dispenseRequest",
"variable" : "dispenseRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "supply",
"variable" : "supply"
}
],
"dependent" : [
{
"name" : "PrescribedQuantityUnit",
"variable" : [
"dispenseRequest",
"supply"
]
}
]
}
],
"documentation" : "IHE-DIS: Case 2: If the product-element does not contain package information, the unit attribut is present and the value SHALL be out of the UCUM code system"
}
]
},
{
"name" : "ingredient",
"source" : [
{
"context" : "medication",
"element" : "ingredient",
"variable" : "ingredient"
}
],
"target" : [
{
"context" : "manufacturedMaterial",
"contextType" : "variable",
"element" : "ingredient",
"variable" : "ingredient"
},
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ACTI"
}
]
}
],
"rule" : [
{
"name" : "PharmSubstance",
"source" : [
{
"context" : "ingredient",
"element" : "itemCodeableConcept",
"variable" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "ingredient",
"variable" : "pharmsubstance"
}
],
"rule" : [
{
"name" : "MMAT",
"source" : [
{
"context" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MMAT"
}
]
}
]
},
{
"name" : "KIND",
"source" : [
{
"context" : "itemCodeableConcept"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "determinerCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "KIND"
}
]
}
]
},
{
"name" : "name",
"source" : [
{
"context" : "itemCodeableConcept",
"element" : "text",
"variable" : "text"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "other",
"transform" : "copy",
"parameter" : [
{
"valueId" : "text"
}
]
}
]
},
{
"name" : "coding",
"source" : [
{
"context" : "itemCodeableConcept",
"element" : "coding",
"variable" : "coding"
}
],
"rule" : [
{
"name" : "formCode",
"source" : [
{
"context" : "coding"
}
],
"target" : [
{
"context" : "pharmsubstance",
"contextType" : "variable",
"element" : "code",
"variable" : "ce"
}
],
"dependent" : [
{
"name" : "CodingCE",
"variable" : [
"coding",
"ce"
]
}
]
}
]
}
]
},
{
"name" : "strength",
"source" : [
{
"context" : "ingredient",
"element" : "strength",
"variable" : "strength"
}
],
"target" : [
{
"context" : "ingredient",
"contextType" : "variable",
"element" : "quantity",
"variable" : "quantity"
}
],
"dependent" : [
{
"name" : "RatioRTOPQPQ",
"variable" : [
"strength",
"quantity"
]
}
]
}
]
}
]
},
{
"name" : "PrescriptionItemEntryContentModule",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationrequest.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.43",
"input" : [
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "source"
},
{
"name" : "medicationRequest",
"type" : "MedicationRequest",
"mode" : "source"
},
{
"name" : "substanceAdministration",
"type" : "SubstanceAdministration",
"mode" : "target"
}
],
"rule" : [
{
"name" : "SBADM",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "SBADM"
}
]
}
]
},
{
"name" : "INT",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "INT"
}
]
}
]
},
{
"name" : "CH-PHARM-PrescriptionItemEntryContentModule",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.43"
}
]
}
]
},
{
"name" : "PrescriptionItemEntryTemplateId",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.2"
}
]
}
]
},
{
"name" : "CCD",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.10.20.1.24"
}
]
}
]
},
{
"name" : "PCC-MedicationEntryContentModule",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "medicationRequest",
"element" : "identifier",
"variable" : "identifier"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "id",
"variable" : "id"
}
],
"dependent" : [
{
"name" : "IdentifierII",
"variable" : [
"identifier",
"id"
]
}
]
},
{
"name" : "narrativeLink",
"source" : [
{
"context" : "medicationRequest",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
}
],
"rule" : [
{
"name" : "valueUrl",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "cat1narrativelink",
"source" : [
{
"context" : "medicationRequest",
"condition" : "extension.where(url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists().not()"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
}
],
"rule" : [
{
"name" : "referencetopdf",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "medicationRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "statusCode"
},
{
"context" : "statusCode",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
},
{
"name" : "dispenseRequest",
"source" : [
{
"context" : "medicationRequest",
"element" : "dispenseRequest",
"variable" : "dispenseRequest"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "repeatNumber",
"variable" : "repeatNumber"
}
],
"rule" : [
{
"name" : "repeatNumber",
"source" : [
{
"context" : "dispenseRequest",
"element" : "numberOfRepeatsAllowed",
"variable" : "number"
}
],
"target" : [
{
"context" : "repeatNumber",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "number"
}
]
}
]
},
{
"name" : "repeatNumberNull",
"source" : [
{
"context" : "dispenseRequest",
"condition" : "numberOfRepeatsAllowed.exists() = false"
}
],
"target" : [
{
"context" : "repeatNumber",
"contextType" : "variable",
"element" : "nullFlavor",
"transform" : "copy",
"parameter" : [
{
"valueString" : "NI"
}
]
}
]
}
]
},
{
"name" : "contained",
"source" : [
{
"context" : "medicationRequest",
"element" : "contained",
"variable" : "medication",
"condition" : "('#' + $this.id) in %medicationRequest.medicationReference.reference"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "consumable",
"variable" : "consumable"
},
{
"context" : "consumable",
"contextType" : "variable",
"element" : "manufacturedProduct",
"variable" : "manufacturedProduct"
},
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MANU"
}
]
}
],
"rule" : [
{
"name" : "MP-templateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.2"
}
]
}
]
},
{
"name" : "MP-templateId",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.840.1.113883.10.20.1.53"
}
]
}
]
},
{
"name" : "manufacturedMaterial",
"source" : [
{
"context" : "medication"
}
],
"target" : [
{
"context" : "manufacturedProduct",
"contextType" : "variable",
"element" : "manufacturedMaterial",
"variable" : "manufacturedMaterial"
}
],
"dependent" : [
{
"name" : "ManufacturedMaterialEntryContentModulePrescription",
"variable" : [
"bundle",
"medicationRequest",
"medication",
"manufacturedMaterial",
"substanceAdministration"
]
}
]
}
]
},
{
"name" : "onylonedosage",
"source" : [
{
"context" : "medicationRequest",
"condition" : "dosageInstruction.count() = 1"
}
],
"rule" : [
{
"name" : "normalDose",
"source" : [
{
"context" : "medicationRequest",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.5.3.1.4.7.1"
}
]
}
]
}
],
"documentation" : "TODO: AUTHOR1 Medication Treatment Plan Author"
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationRequest",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-normal-medicationrequest')"
}
],
"dependent" : [
{
"name" : "DosageInstructionsStartStopFrequencySubstanceAdministration",
"variable" : [
"dosage",
"substanceAdministration"
]
}
]
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationRequest",
"element" : "dosageInstruction",
"listMode" : "first",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split-medicationrequest')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
}
],
"dependent" : [
{
"name" : "DosageInstructionsEntryStartStopRoute",
"variable" : [
"dosage",
"substanceAdministration",
"entryRelationship"
]
}
],
"documentation" : "dosage for split dosing (with sequences): effectiveTime (start/stop) & routeCode"
},
{
"name" : "DosageSubstanceAdministration",
"source" : [
{
"context" : "medicationRequest",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-structured-split-medicationrequest')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
}
],
"dependent" : [
{
"name" : "DosageInstructionsEntryDosageChangeSubstanceAdministration",
"variable" : [
"dosage",
"substanceAdministration",
"entryRelationship"
]
}
],
"documentation" : "dosage for split dosing (with sequences): sequence number, effectiveTime (when), dose quantity, consumable"
},
{
"name" : "TreatmentReasonEntryContentModule",
"source" : [
{
"context" : "medicationRequest",
"element" : "reasonCode",
"variable" : "reasonCode"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "RSON"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "observation",
"variable" : "observation"
}
],
"dependent" : [
{
"name" : "TreatmentReasonEntryContentModule",
"variable" : [
"reasonCode",
"observation"
]
}
]
},
{
"name" : "MTP-Reference",
"source" : [
{
"context" : "medicationRequest",
"element" : "extension",
"variable" : "extension",
"condition" : "url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan'"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "REFR"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "MTPReferenceEntryContentModule",
"variable" : [
"extension",
"substanceAdministration"
]
}
]
},
{
"name" : "DosageInstructionsNonStructuredEntryContentModule",
"source" : [
{
"context" : "medicationRequest",
"element" : "dosageInstruction",
"variable" : "dosage",
"condition" : "$this.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-dosage-nonstructured')"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "DosageInstructionsNonStructuredEntryContentModule",
"variable" : [
"dosage",
"substanceAdministration"
]
}
],
"documentation" : "TODO: Patient Medication Instructions Contains 1.3.6.1.4.1.19376.1.5.3.1.4.3 IHE Patient Medication Instructions (DYNAMIC)"
},
{
"name" : "AnnotationComment",
"source" : [
{
"context" : "medicationRequest",
"element" : "note",
"variable" : "note"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "act",
"variable" : "act"
}
],
"dependent" : [
{
"name" : "AnnotationComment",
"variable" : [
"note",
"act"
]
}
]
},
{
"name" : "Substitution",
"source" : [
{
"context" : "medicationRequest",
"element" : "substitution",
"variable" : "substitution"
}
],
"target" : [
{
"context" : "substanceAdministration",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "COMP"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "act",
"variable" : "act"
}
],
"dependent" : [
{
"name" : "SubstitutionRequest",
"variable" : [
"substitution",
"act"
]
}
]
}
]
},
{
"name" : "PharmaceuticalAdviceItemEntryContentModule",
"typeMode" : "none",
"documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-observation.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.44",
"input" : [
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "source"
},
{
"name" : "fhirobservation",
"type" : "Observation",
"mode" : "source"
},
{
"name" : "cdaobservation",
"type" : "Observation",
"mode" : "target"
}
],
"rule" : [
{
"name" : "OBS",
"source" : [
{
"context" : "fhirobservation"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "classCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "OBS"
}
]
}
]
},
{
"name" : "EVN",
"source" : [
{
"context" : "fhirobservation"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "moodCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "EVN"
}
]
}
]
},
{
"name" : "IHE-PHARM-PADV",
"source" : [
{
"context" : "fhirobservation"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "1.3.6.1.4.1.19376.1.9.1.3.3"
}
]
}
]
},
{
"name" : "CH-PHARM-PharmaceuticalAdviceItemEntryContentModule",
"source" : [
{
"context" : "fhirobservation"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "templateId",
"variable" : "templateId"
},
{
"context" : "templateId",
"contextType" : "variable",
"element" : "root",
"transform" : "copy",
"parameter" : [
{
"valueString" : "2.16.756.5.30.1.1.10.4.44"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "fhirobservation",
"element" : "identifier",
"variable" : "identifier"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "id",
"variable" : "id"
}
],
"dependent" : [
{
"name" : "IdentifierII",
"variable" : [
"identifier",
"id"
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "fhirobservation",
"element" : "code",
"variable" : "fhirCode"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "code",
"variable" : "cdaCode"
}
],
"dependent" : [
{
"name" : "CodeableConceptCE",
"variable" : [
"fhirCode",
"cdaCode"
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "fhirobservation"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "statusCode",
"variable" : "statusCode"
},
{
"context" : "statusCode",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "completed"
}
]
}
]
},
{
"name" : "effectiveTime",
"source" : [
{
"context" : "fhirobservation",
"element" : "effectiveDateTime",
"variable" : "effectiveDateTime"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "effectiveTime",
"variable" : "effectiveTime"
}
],
"rule" : [
{
"name" : "value",
"source" : [
{
"context" : "effectiveDateTime"
}
],
"target" : [
{
"context" : "effectiveTime",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "effectiveDateTime"
}
]
}
]
}
]
},
{
"name" : "MTP-Reference",
"source" : [
{
"context" : "fhirobservation",
"element" : "extension",
"variable" : "extension",
"condition" : "url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-treatmentplan'"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "REFR"
}
]
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "MTPReferenceEntryContentModule",
"variable" : [
"extension",
"substanceAdministration"
]
}
]
},
{
"name" : "changedmtp",
"source" : [
{
"context" : "fhirobservation",
"element" : "extension",
"variable" : "extension",
"condition" : "url = 'http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-ext-medicationstatement-changed'"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "entryRelationship",
"variable" : "entryRelationship"
},
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "typeCode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "REFR"
}
]
}
],
"rule" : [
{
"name" : "entry",
"source" : [
{
"context" : "bundle",
"element" : "entry",
"variable" : "entry"
}
],
"rule" : [
{
"name" : "fullUrlAsUuid",
"source" : [
{
"context" : "entry",
"element" : "fullUrl",
"condition" : "($this in %extension.valueReference.reference) and $this.startsWith('urn:uuid')"
}
],
"rule" : [
{
"name" : "MedicationStatement",
"source" : [
{
"context" : "entry",
"element" : "resource",
"variable" : "medicationStatement",
"condition" : "$this.ofType(FHIR.MedicationStatement)"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "MedicationTreatmentPlanItemEntryContentModule",
"variable" : [
"bundle",
"medicationStatement",
"substanceAdministration"
]
}
]
}
]
},
{
"name" : "MedicationStatement",
"source" : [
{
"context" : "entry",
"element" : "resource",
"variable" : "medicationStatement",
"condition" : "$this.ofType(FHIR.MedicationStatement) and (('MedicationStatement' + '/' + $this.id) in %extension.valueReference.reference)"
}
],
"target" : [
{
"context" : "entryRelationship",
"contextType" : "variable",
"element" : "substanceAdministration",
"variable" : "substanceAdministration"
}
],
"dependent" : [
{
"name" : "MedicationTreatmentPlanItemEntryContentModule",
"variable" : [
"bundle",
"medicationStatement",
"substanceAdministration"
]
}
]
}
]
}
]
},
{
"name" : "note",
"source" : [
{
"context" : "fhirobservation",
"element" : "note",
"variable" : "note"
}
],
"rule" : [
{
"name" : "narrativeLink",
"source" : [
{
"context" : "note",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
}
],
"rule" : [
{
"name" : "valueUrl",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "reference",
"source" : [
{
"context" : "note",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
},
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
}
]
},
{
"name" : "text",
"source" : [
{
"context" : "fhirobservation",
"element" : "note",
"variable" : "note"
}
],
"target" : [
{
"context" : "cdaobservation",
"contextType" : "variable",
"element" : "text",
"variable" : "text"
}
],
"rule" : [
{
"name" : "text",
"source" : [
{
"context" : "note",
"element" : "text",
"variable" : "noteText"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "data",
"transform" : "copy",
"parameter" : [
{
"valueId" : "noteText"
}
]
}
]
},
{
"name" : "id",
"source" : [
{
"context" : "note",
"element" : "extension",
"variable" : "extension",
"condition" : "$this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink'"
}
],
"rule" : [
{
"name" : "reference",
"source" : [
{
"context" : "extension",
"element" : "valueUrl",
"variable" : "valueUrl"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "valueUrl"
}
]
}
]
}
]
},
{
"name" : "reference",
"source" : [
{
"context" : "note",
"condition" : "(extension.where($this.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink').exists() = false)"
}
],
"target" : [
{
"context" : "text",
"contextType" : "variable",
"element" : "reference",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#refpdf"
}
]
}
]
}
]
}
]
}
]
}