FHIR © HL7.org  |  Server Home  |  XIG Home  |  XIG Stats  |  Server Source  |  FHIR  

FHIR IG Statistics: StructureMap/BundleToCdaChEmedMedicationTreatmentPlanDocument

Packagech.fhir.ig.cda-fhir-maps
Resource TypeStructureMap
IdBundleToCdaChEmedMedicationTreatmentPlanDocument
FHIR VersionR4
Sourcehttp://fhir.ch/ig/cda-fhir-maps/http://fhir.ch/ig/cda-fhir-maps/StructureMap-BundleToCdaChEmedMedicationTreatmentPlanDocument.html
URLhttp://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmedMedicationTreatmentPlanDocument
Version0.3.0
Statusdraft
Date2022-02-11T11:14:39+01:00
NameBundleToCdaChEmedMedicationTreatmentPlanDocument
Realmch
Authorityhl7
DescriptionMedication Treatment Plan document, 2.16.756.5.30.1.1.10.1.7 2020-11-12 Michaela Ziegler, copyright ahdis ag, Apache License CDA-CH-EMED: https://art-decor.org/art-decor/decor-project--cdachemed- FHIR CH-EMED: http://fhir.ch/ig/ch-emed/index.html
CopyrightCC-BY-SA-4.0

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

map "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmedMedicationTreatmentPlanDocument" = "BundleToCdaChEmedMedicationTreatmentPlanDocument"

// Medication Treatment Plan document, 2.16.756.5.30.1.1.10.1.7
// 2020-11-12 Michaela Ziegler, copyright ahdis ag, Apache License
// CDA-CH-EMED:  https://art-decor.org/art-decor/decor-project--cdachemed-
// FHIR CH-EMED: http://fhir.ch/ig/ch-emed/index.html

uses "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument" alias ClinicalDocument as target
uses "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor" alias AssignedAuthor as target
uses "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity" alias AssignedEntity as target
uses "http://hl7.org/fhir/cda/StructureDefinition/Author" alias Author as target
uses "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization" alias CustodianOrganization as target
uses "http://hl7.org/fhir/cda/StructureDefinition/IVL_TS" alias IVL_TS as target
uses "http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS" alias EIVL_TS as target
uses "http://hl7.org/fhir/cda/StructureDefinition/PatientRole" alias PatientRole as target
uses "http://hl7.org/fhir/cda/StructureDefinition/RecordTarget" alias RecordTarget as target
uses "http://hl7.org/fhir/cda/StructureDefinition/Section" alias Section as target
uses "http://hl7.org/fhir/cda/StructureDefinition/SubstanceAdministration" alias SubstanceAdministration as target
uses "http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS" alias SXPR_TS as target
uses "http://hl7.org/fhir/cda/StructureDefinition/Supply" alias Supply as target
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source
uses "http://hl7.org/fhir/StructureDefinition/Composition" alias Composition as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source
uses "http://hl7.org/fhir/StructureDefinition/Practitioner" alias Practitioner as source
uses "http://hl7.org/fhir/StructureDefinition/Organization" alias Organization as source
uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedicationStatement as source
uses "http://hl7.org/fhir/StructureDefinition/Dosage" alias Dosage as source

imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/FhirToCdaTypes"
imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda"
imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaCh"
imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmed"

// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html
// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.1.7
group BundleToCdaChEmedMedicationTreatmentPlanDocument(source bundle : Bundle, target cda : ClinicalDocument) {
  bundle ->  cda.recordTarget as recordTarget,  cda.author as author then BundleToClinicalDocumentEmedMedicationTreatmentPlanDocument(bundle, recordTarget, author, cda) "bundle";
}

// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html
// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.1.7
group CompositionClinicalDocumentChEmedMedicationTreatmentPlanDocument(source bundle : Bundle, source composition : Composition, target cda : ClinicalDocument) {
  composition.type ->  cda.code as code,  code.codeSystem = '2.16.840.1.113883.6.1',  code.codeSystemName = 'LOINC',  code.code = '77603-9',  code.displayName = 'Medication treatment plan.extended' "fixloinc";
  composition.section as section where $this.code.coding.where((system = 'http://loinc.org') and (code = '77604-7')) -> cda.component as component then {
    section -> component.contextConductionInd = true "contextConductionInd";
    section ->  component.structuredBody as structuredBody,  structuredBody.component as component,  component.section as cdasection then SectionMedicationTreatmentPlanSectionContentModule(bundle, section, cdasection) "cdasection";
  } "SectionMedicationTreatmentPlanSectionContentModule";
  composition.section as section where $this.code.coding.where((system = 'http://loinc.org') and (code = '48767-8')) -> cda.component as component then {
    section -> component.contextConductionInd = true "contextConductionInd";
    section ->  component.structuredBody as structuredBody,  structuredBody.component as component,  component.section as cdasection then SectionCdaRemarksCoded(bundle, section, cdasection) "cdasection";
  } "SectionRemarksCoded";
  composition.section as section where $this.code.coding.where((system = 'http://loinc.org') and (code = '55108-5')) -> cda.component as component then {
    section -> component.contextConductionInd = true "contextConductionInd";
    section ->  component.structuredBody as structuredBody,  structuredBody.component as component,  component.section as cdasection then SectionCdaOriginalRepresentation(bundle, section, cdasection) "cdasection";
  } "SectionCdaOriginalRepresentation";
}

// _________________________ Section Level Templates _________________________
// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html
// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.3.13
group SectionMedicationTreatmentPlanSectionContentModule(source bundle : Bundle, source section : Section, target cdasection : CdaSection) extends SectionCdaSection {
  section ->  cdasection.templateId as templateId,  templateId.root = '2.16.756.5.30.1.1.10.3.13' "CH-PHARM-MTP";
  section ->  cdasection.templateId as templateId,  templateId.root = '1.3.6.1.4.1.19376.1.9.1.2.6' "IHE-PHARM-MTP";
  section where text.exists() = false -> cdasection.text = '<div xmlns=\"http://www.w3.org/1999/xhtml\"><span id=\"refpdf\">see pdf</span></div>' "Section";
  bundle.entry as entry then {
    entry.fullUrl where ($this in %section.entry.reference) and $this.startsWith('urn:uuid') then {
      entry.resource as medicationStatement where $this.ofType(FHIR.MedicationStatement) ->  cdasection.entry as entry,  entry.substanceAdministration as substanceAdministration then MedicationTreatmentPlanItemEntryContentModule(bundle, medicationStatement, substanceAdministration) "MedicationStatement";
    } "fullUrlAsUuid";
    entry.resource as medicationStatement where $this.ofType(FHIR.MedicationStatement) and (('MedicationStatement' + '/' + $this.id) in %section.entry.reference) ->  cdasection.entry as entry,  entry.substanceAdministration as substanceAdministration then MedicationTreatmentPlanItemEntryContentModule(bundle, medicationStatement, substanceAdministration) "MedicationStatement";
  };
}

// _________________________ Header Level Templates _________________________
// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html
// target: 2.16.756.5.30.1.1.10.9.44
group BundleToClinicalDocumentEmedMedicationTreatmentPlanDocument(source bundle : Bundle, target recordTarget : RecordTarget, target author : Author, target cda : ClinicalDocument) extends BundleToClinicalDocumentCh {
  bundle ->  cda.templateId as templateId,  templateId.root = '2.16.756.5.30.1.127.1.4' "exchangeFormatAccordingToTheSwissEPR";
  bundle ->  cda.templateId as templateId,  templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.1.1' "IHE-PCC";
  bundle ->  cda.templateId as templateId,  templateId.root = '1.3.6.1.4.1.19376.1.9.1.1.6' "IHE-PHARM-MTP";
  bundle ->  cda.templateId as templateId,  templateId.root = '2.16.756.5.30.1.1.10.1.7' "CDA-CH-EMED-MedicationTretmentPlanDocument";
  bundle.entry as entry then {
    entry.resource as resource where $this.ofType(FHIR.Composition) then CompositionClinicalDocumentChEmedMedicationTreatmentPlanDocument(bundle, resource, cda);
  };
}


Source

{
  "resourceType": "StructureMap",
  "id": "BundleToCdaChEmedMedicationTreatmentPlanDocument",
  "meta": {
    "versionId": "2",
    "lastUpdated": "2021-11-04T13:33:32.767+01:00"
  },
  "text": {
    "status": "generated",
    "div": "<!-- snip (see above) -->"
  },
  "url": "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmedMedicationTreatmentPlanDocument",
  "version": "0.3.0",
  "name": "BundleToCdaChEmedMedicationTreatmentPlanDocument",
  "status": "draft",
  "date": "2022-02-11T11:14:39+01:00",
  "publisher": "ahdis",
  "contact": [
    {
      "name": "ahdis",
      "telecom": [
        {
          "system": "url",
          "value": "http://www.ahdis.ch/"
        }
      ]
    }
  ],
  "description": "Medication Treatment Plan document, 2.16.756.5.30.1.1.10.1.7\r\n2020-11-12 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",
  "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",
    "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmed"
  ],
  "group": [
    {
      "name": "BundleToCdaChEmedMedicationTreatmentPlanDocument",
      "typeMode": "none",
      "documentation": "source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.1.7",
      "input": [
        {
          "name": "bundle",
          "type": "Bundle",
          "mode": "source"
        },
        {
          "name": "cda",
          "type": "ClinicalDocument",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "bundle",
          "source": [
            {
              "context": "bundle"
            }
          ],
          "target": [
            {
              "context": "cda",
              "contextType": "variable",
              "element": "recordTarget",
              "variable": "recordTarget"
            },
            {
              "context": "cda",
              "contextType": "variable",
              "element": "author",
              "variable": "author"
            }
          ],
          "dependent": [
            {
              "name": "BundleToClinicalDocumentEmedMedicationTreatmentPlanDocument",
              "variable": [
                "bundle",
                "recordTarget",
                "author",
                "cda"
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "CompositionClinicalDocumentChEmedMedicationTreatmentPlanDocument",
      "typeMode": "none",
      "documentation": "source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.1.7",
      "input": [
        {
          "name": "bundle",
          "type": "Bundle",
          "mode": "source"
        },
        {
          "name": "composition",
          "type": "Composition",
          "mode": "source"
        },
        {
          "name": "cda",
          "type": "ClinicalDocument",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "fixloinc",
          "source": [
            {
              "context": "composition",
              "element": "type"
            }
          ],
          "target": [
            {
              "context": "cda",
              "contextType": "variable",
              "element": "code",
              "variable": "code"
            },
            {
              "context": "code",
              "contextType": "variable",
              "element": "codeSystem",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "2.16.840.1.113883.6.1"
                }
              ]
            },
            {
              "context": "code",
              "contextType": "variable",
              "element": "codeSystemName",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "LOINC"
                }
              ]
            },
            {
              "context": "code",
              "contextType": "variable",
              "element": "code",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "77603-9"
                }
              ]
            },
            {
              "context": "code",
              "contextType": "variable",
              "element": "displayName",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "Medication treatment plan.extended"
                }
              ]
            }
          ]
        },
        {
          "name": "SectionMedicationTreatmentPlanSectionContentModule",
          "source": [
            {
              "context": "composition",
              "element": "section",
              "variable": "section",
              "condition": "$this.code.coding.where((system = 'http://loinc.org') and (code = '77604-7'))"
            }
          ],
          "target": [
            {
              "context": "cda",
              "contextType": "variable",
              "element": "component",
              "variable": "component"
            }
          ],
          "rule": [
            {
              "name": "contextConductionInd",
              "source": [
                {
                  "context": "section"
                }
              ],
              "target": [
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "contextConductionInd",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueBoolean": true
                    }
                  ]
                }
              ]
            },
            {
              "name": "cdasection",
              "source": [
                {
                  "context": "section"
                }
              ],
              "target": [
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "structuredBody",
                  "variable": "structuredBody"
                },
                {
                  "context": "structuredBody",
                  "contextType": "variable",
                  "element": "component",
                  "variable": "component"
                },
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "section",
                  "variable": "cdasection"
                }
              ],
              "dependent": [
                {
                  "name": "SectionMedicationTreatmentPlanSectionContentModule",
                  "variable": [
                    "bundle",
                    "section",
                    "cdasection"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "SectionRemarksCoded",
          "source": [
            {
              "context": "composition",
              "element": "section",
              "variable": "section",
              "condition": "$this.code.coding.where((system = 'http://loinc.org') and (code = '48767-8'))"
            }
          ],
          "target": [
            {
              "context": "cda",
              "contextType": "variable",
              "element": "component",
              "variable": "component"
            }
          ],
          "rule": [
            {
              "name": "contextConductionInd",
              "source": [
                {
                  "context": "section"
                }
              ],
              "target": [
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "contextConductionInd",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueBoolean": true
                    }
                  ]
                }
              ]
            },
            {
              "name": "cdasection",
              "source": [
                {
                  "context": "section"
                }
              ],
              "target": [
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "structuredBody",
                  "variable": "structuredBody"
                },
                {
                  "context": "structuredBody",
                  "contextType": "variable",
                  "element": "component",
                  "variable": "component"
                },
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "section",
                  "variable": "cdasection"
                }
              ],
              "dependent": [
                {
                  "name": "SectionCdaRemarksCoded",
                  "variable": [
                    "bundle",
                    "section",
                    "cdasection"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "SectionCdaOriginalRepresentation",
          "source": [
            {
              "context": "composition",
              "element": "section",
              "variable": "section",
              "condition": "$this.code.coding.where((system = 'http://loinc.org') and (code = '55108-5'))"
            }
          ],
          "target": [
            {
              "context": "cda",
              "contextType": "variable",
              "element": "component",
              "variable": "component"
            }
          ],
          "rule": [
            {
              "name": "contextConductionInd",
              "source": [
                {
                  "context": "section"
                }
              ],
              "target": [
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "contextConductionInd",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueBoolean": true
                    }
                  ]
                }
              ]
            },
            {
              "name": "cdasection",
              "source": [
                {
                  "context": "section"
                }
              ],
              "target": [
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "structuredBody",
                  "variable": "structuredBody"
                },
                {
                  "context": "structuredBody",
                  "contextType": "variable",
                  "element": "component",
                  "variable": "component"
                },
                {
                  "context": "component",
                  "contextType": "variable",
                  "element": "section",
                  "variable": "cdasection"
                }
              ],
              "dependent": [
                {
                  "name": "SectionCdaOriginalRepresentation",
                  "variable": [
                    "bundle",
                    "section",
                    "cdasection"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SectionMedicationTreatmentPlanSectionContentModule",
      "extends": "SectionCdaSection",
      "typeMode": "none",
      "documentation": "_________________________ Section Level Templates _________________________\r\nsource: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.3.13",
      "input": [
        {
          "name": "bundle",
          "type": "Bundle",
          "mode": "source"
        },
        {
          "name": "section",
          "type": "Section",
          "mode": "source"
        },
        {
          "name": "cdasection",
          "type": "CdaSection",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "CH-PHARM-MTP",
          "source": [
            {
              "context": "section"
            }
          ],
          "target": [
            {
              "context": "cdasection",
              "contextType": "variable",
              "element": "templateId",
              "variable": "templateId"
            },
            {
              "context": "templateId",
              "contextType": "variable",
              "element": "root",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "2.16.756.5.30.1.1.10.3.13"
                }
              ]
            }
          ]
        },
        {
          "name": "IHE-PHARM-MTP",
          "source": [
            {
              "context": "section"
            }
          ],
          "target": [
            {
              "context": "cdasection",
              "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.2.6"
                }
              ]
            }
          ]
        },
        {
          "name": "Section",
          "source": [
            {
              "context": "section",
              "condition": "text.exists() = false"
            }
          ],
          "target": [
            {
              "context": "cdasection",
              "contextType": "variable",
              "element": "text",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><span id=\"refpdf\">see pdf</span></div>"
                }
              ]
            }
          ]
        },
        {
          "name": "entry",
          "source": [
            {
              "context": "bundle",
              "element": "entry",
              "variable": "entry"
            }
          ],
          "rule": [
            {
              "name": "fullUrlAsUuid",
              "source": [
                {
                  "context": "entry",
                  "element": "fullUrl",
                  "condition": "($this in %section.entry.reference) and $this.startsWith('urn:uuid')"
                }
              ],
              "rule": [
                {
                  "name": "MedicationStatement",
                  "source": [
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "medicationStatement",
                      "condition": "$this.ofType(FHIR.MedicationStatement)"
                    }
                  ],
                  "target": [
                    {
                      "context": "cdasection",
                      "contextType": "variable",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "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 %section.entry.reference)"
                }
              ],
              "target": [
                {
                  "context": "cdasection",
                  "contextType": "variable",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "contextType": "variable",
                  "element": "substanceAdministration",
                  "variable": "substanceAdministration"
                }
              ],
              "dependent": [
                {
                  "name": "MedicationTreatmentPlanItemEntryContentModule",
                  "variable": [
                    "bundle",
                    "medicationStatement",
                    "substanceAdministration"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "BundleToClinicalDocumentEmedMedicationTreatmentPlanDocument",
      "extends": "BundleToClinicalDocumentCh",
      "typeMode": "none",
      "documentation": "_________________________ Header Level Templates _________________________\r\nsource: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-medicationtreatmentplan.html\r\ntarget: 2.16.756.5.30.1.1.10.9.44",
      "input": [
        {
          "name": "bundle",
          "type": "Bundle",
          "mode": "source"
        },
        {
          "name": "recordTarget",
          "type": "RecordTarget",
          "mode": "target"
        },
        {
          "name": "author",
          "type": "Author",
          "mode": "target"
        },
        {
          "name": "cda",
          "type": "ClinicalDocument",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "exchangeFormatAccordingToTheSwissEPR",
          "source": [
            {
              "context": "bundle"
            }
          ],
          "target": [
            {
              "context": "cda",
              "contextType": "variable",
              "element": "templateId",
              "variable": "templateId"
            },
            {
              "context": "templateId",
              "contextType": "variable",
              "element": "root",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "2.16.756.5.30.1.127.1.4"
                }
              ]
            }
          ]
        },
        {
          "name": "IHE-PCC",
          "source": [
            {
              "context": "bundle"
            }
          ],
          "target": [
            {
              "context": "cda",
              "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.1.1"
                }
              ]
            }
          ]
        },
        {
          "name": "IHE-PHARM-MTP",
          "source": [
            {
              "context": "bundle"
            }
          ],
          "target": [
            {
              "context": "cda",
              "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.1.6"
                }
              ]
            }
          ]
        },
        {
          "name": "CDA-CH-EMED-MedicationTretmentPlanDocument",
          "source": [
            {
              "context": "bundle"
            }
          ],
          "target": [
            {
              "context": "cda",
              "contextType": "variable",
              "element": "templateId",
              "variable": "templateId"
            },
            {
              "context": "templateId",
              "contextType": "variable",
              "element": "root",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "2.16.756.5.30.1.1.10.1.7"
                }
              ]
            }
          ]
        },
        {
          "name": "entry",
          "source": [
            {
              "context": "bundle",
              "element": "entry",
              "variable": "entry"
            }
          ],
          "rule": [
            {
              "name": "resource",
              "source": [
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "resource",
                  "condition": "$this.ofType(FHIR.Composition)"
                }
              ],
              "dependent": [
                {
                  "name": "CompositionClinicalDocumentChEmedMedicationTreatmentPlanDocument",
                  "variable": [
                    "bundle",
                    "resource",
                    "cda"
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}