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

: Bundle to CDA-CH-EMED Pharmaceutical Advice document - JSON Representation

Raw json | Download


{
  "resourceType" : "StructureMap",
  "id" : "BundleToCdaChEmedPharmaceuticalAdviceDocument",
  "meta" : {
    "versionId" : "2",
    "lastUpdated" : "2021-11-04T13:32:35.411+01:00"
  },
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n         <pre>map &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmedPharmaceuticalAdviceDocument&quot; = &quot;BundleToCdaChEmedPharmaceuticalAdviceDocument&quot;\n\n// Pharmaceutical Advice document, 2.16.756.5.30.1.1.10.1.6\n// 2020-11-12 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 &quot;http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument&quot; alias ClinicalDocument as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor&quot; alias AssignedAuthor as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity&quot; alias AssignedEntity as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/Author&quot; alias Author as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization&quot; alias CustodianOrganization as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/IVL_TS&quot; alias IVL_TS as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS&quot; alias EIVL_TS as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/PatientRole&quot; alias PatientRole as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/RecordTarget&quot; alias RecordTarget as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/Section&quot; alias Section as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/SubstanceAdministration&quot; alias SubstanceAdministration as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS&quot; alias SXPR_TS as target\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/Supply&quot; alias Supply as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias Bundle as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Composition&quot; alias Composition as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Patient&quot; alias Patient as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Practitioner&quot; alias Practitioner as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Organization&quot; alias Organization as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Observation&quot; alias Observation as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Dosage&quot; alias Dosage as source\n\nimports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/FhirToCdaTypes&quot;\nimports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda&quot;\nimports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaCh&quot;\nimports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmed&quot;\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&amp;id=2.16.756.5.30.1.1.10.1.6\ngroup BundleToCdaChEmedPharmaceuticalAdviceDocument(source bundle : Bundle, target cda : ClinicalDocument) {\n  bundle -&gt;  cda.recordTarget as recordTarget,  cda.author as author then BundleToClinicalDocumentEmedPharmaceuticalAdviceDocument(bundle, recordTarget, author, cda) &quot;bundle&quot;;\n}\n\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&amp;id=2.16.756.5.30.1.1.10.1.6\ngroup CompositionClinicalDocumentChEmedPharmaceuticalAdviceDocument(source bundle : Bundle, source composition : Composition, target cda : ClinicalDocument) {\n  composition.type -&gt;  cda.code as code,  code.codeSystem = '2.16.840.1.113883.6.1',  code.codeSystemName = 'LOINC',  code.code = '61356-2',  code.displayName = 'Medication pharmaceutical advice.extended' &quot;fixloinc&quot;;\n  composition.section as section where $this.code.coding.where((system = 'http://loinc.org') and (code = '61357-0')) -&gt; cda.component as component then {\n    section -&gt; component.contextConductionInd = true &quot;contextConductionInd&quot;;\n    section -&gt;  component.structuredBody as structuredBody,  structuredBody.component as component,  component.section as cdasection then SectionPharmaceuticalAdviceSectionContentModule(bundle, section, cdasection) &quot;cdasection&quot;;\n  } &quot;SectionPharmaceuticalAdviceSectionContentModule&quot;;\n  composition.section as section where $this.code.coding.where((system = 'http://loinc.org') and (code = '48767-8')) -&gt; cda.component as component then {\n    section -&gt; component.contextConductionInd = true &quot;contextConductionInd&quot;;\n    section -&gt;  component.structuredBody as structuredBody,  structuredBody.component as component,  component.section as cdasection then SectionCdaRemarksCoded(bundle, section, cdasection) &quot;cdasection&quot;;\n  } &quot;SectionRemarksCoded&quot;;\n  composition.section as section where $this.code.coding.where((system = 'http://loinc.org') and (code = '55108-5')) -&gt; cda.component as component then {\n    section -&gt; component.contextConductionInd = true &quot;contextConductionInd&quot;;\n    section -&gt;  component.structuredBody as structuredBody,  structuredBody.component as component,  component.section as cdasection then SectionCdaOriginalRepresentation(bundle, section, cdasection) &quot;cdasection&quot;;\n  } &quot;SectionCdaOriginalRepresentation&quot;;\n}\n\n// _________________________ Section Level Templates _________________________\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\n// target: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&amp;id=2.16.756.5.30.1.1.10.3.12\ngroup SectionPharmaceuticalAdviceSectionContentModule(source bundle : Bundle, source section : Section, target cdasection : CdaSection) extends SectionCdaSection {\n  section -&gt;  cdasection.templateId as templateId,  templateId.root = '2.16.756.5.30.1.1.10.3.12' &quot;CH-PHARM-PharmaceuticalAdviceSectionContentModule&quot;;\n  section -&gt;  cdasection.templateId as templateId,  templateId.root = '1.3.6.1.4.1.19376.1.9.1.2.2' &quot;IHE-PHARM-PADV&quot;;\n  section where text.exists() = false -&gt; cdasection.text = '&lt;div xmlns=\\&quot;http://www.w3.org/1999/xhtml\\&quot;&gt;&lt;span id=\\&quot;refpdf\\&quot;&gt;see pdf&lt;/span&gt;&lt;/div&gt;' &quot;Section&quot;;\n  bundle.entry as entry then {\n    entry.fullUrl where ($this in %section.entry.reference) and $this.startsWith('urn:uuid') then {\n      entry.resource as fhirobservation where $this.ofType(FHIR.Observation) -&gt;  cdasection.entry as entry,  entry.observation as cdaobservation then PharmaceuticalAdviceItemEntryContentModule(bundle, fhirobservation, cdaobservation) &quot;Observation&quot;;\n    } &quot;fullUrlAsUuid&quot;;\n    entry.resource as fhirobservation where $this.ofType(FHIR.Observation) and (('Observation' + '/' + $this.id) in %section.entry.reference) -&gt;  cdasection.entry as entry,  entry.observation as cdaobservation then PharmaceuticalAdviceItemEntryContentModule(bundle, fhirobservation, cdaobservation) &quot;Observation&quot;;\n  };\n}\n\n// _________________________ Header Level Templates _________________________\n// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\n// target: 2.16.756.5.30.1.1.10.9.42\ngroup BundleToClinicalDocumentEmedPharmaceuticalAdviceDocument(source bundle : Bundle, target recordTarget : RecordTarget, target author : Author, target cda : ClinicalDocument) extends BundleToClinicalDocumentCh {\n  bundle -&gt;  cda.templateId as templateId,  templateId.root = '2.16.756.5.30.1.127.1.4' &quot;exchangeFormatAccordingToTheSwissEPR&quot;;\n  bundle -&gt;  cda.templateId as templateId,  templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.1.1' &quot;IHE-PCC&quot;;\n  bundle -&gt;  cda.templateId as templateId,  templateId.root = '1.3.6.1.4.1.19376.1.9.1.1.2' &quot;IHE-PHARM-PADV&quot;;\n  bundle -&gt;  cda.templateId as templateId,  templateId.root = '2.16.756.5.30.1.1.10.1.6' &quot;CDA-PHARM-PharmaceuticalAdvice&quot;;\n  bundle.entry as entry then {\n    entry.resource as resource where $this.ofType(FHIR.Composition) then CompositionClinicalDocumentChEmedPharmaceuticalAdviceDocument(bundle, resource, cda);\n  };\n}\n\n</pre>\n      </div>"
  },
  "url" : "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaChEmedPharmaceuticalAdviceDocument",
  "version" : "0.3.0",
  "name" : "BundleToCdaChEmedPharmaceuticalAdviceDocument",
  "status" : "draft",
  "date" : "2022-02-11T11:14:39+01:00",
  "publisher" : "ahdis",
  "contact" : [
    {
      "name" : "ahdis",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://www.ahdis.ch/"
        }
      ]
    }
  ],
  "description" : "Pharmaceutical Advice document, 2.16.756.5.30.1.1.10.1.6\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/Observation",
      "mode" : "source",
      "alias" : "Observation"
    },
    {
      "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" : "BundleToCdaChEmedPharmaceuticalAdviceDocument",
      "typeMode" : "none",
      "documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.1.6",
      "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" : "BundleToClinicalDocumentEmedPharmaceuticalAdviceDocument",
              "variable" : [
                "bundle",
                "recordTarget",
                "author",
                "cda"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "CompositionClinicalDocumentChEmedPharmaceuticalAdviceDocument",
      "typeMode" : "none",
      "documentation" : "source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.1.6",
      "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" : "61356-2"
                }
              ]
            },
            {
              "context" : "code",
              "contextType" : "variable",
              "element" : "displayName",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Medication pharmaceutical advice.extended"
                }
              ]
            }
          ]
        },
        {
          "name" : "SectionPharmaceuticalAdviceSectionContentModule",
          "source" : [
            {
              "context" : "composition",
              "element" : "section",
              "variable" : "section",
              "condition" : "$this.code.coding.where((system = 'http://loinc.org') and (code = '61357-0'))"
            }
          ],
          "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" : "SectionPharmaceuticalAdviceSectionContentModule",
                  "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" : "SectionPharmaceuticalAdviceSectionContentModule",
      "extends" : "SectionCdaSection",
      "typeMode" : "none",
      "documentation" : "_________________________ Section Level Templates _________________________\r\nsource: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\r\ntarget: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.3.12",
      "input" : [
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "source"
        },
        {
          "name" : "section",
          "type" : "Section",
          "mode" : "source"
        },
        {
          "name" : "cdasection",
          "type" : "CdaSection",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "CH-PHARM-PharmaceuticalAdviceSectionContentModule",
          "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.12"
                }
              ]
            }
          ]
        },
        {
          "name" : "IHE-PHARM-PADV",
          "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.2"
                }
              ]
            }
          ]
        },
        {
          "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" : "Observation",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "resource",
                      "variable" : "fhirobservation",
                      "condition" : "$this.ofType(FHIR.Observation)"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "cdasection",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "entry"
                    },
                    {
                      "context" : "entry",
                      "contextType" : "variable",
                      "element" : "observation",
                      "variable" : "cdaobservation"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "PharmaceuticalAdviceItemEntryContentModule",
                      "variable" : [
                        "bundle",
                        "fhirobservation",
                        "cdaobservation"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "Observation",
              "source" : [
                {
                  "context" : "entry",
                  "element" : "resource",
                  "variable" : "fhirobservation",
                  "condition" : "$this.ofType(FHIR.Observation) and (('Observation' + '/' + $this.id) in %section.entry.reference)"
                }
              ],
              "target" : [
                {
                  "context" : "cdasection",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "entry"
                },
                {
                  "context" : "entry",
                  "contextType" : "variable",
                  "element" : "observation",
                  "variable" : "cdaobservation"
                }
              ],
              "dependent" : [
                {
                  "name" : "PharmaceuticalAdviceItemEntryContentModule",
                  "variable" : [
                    "bundle",
                    "fhirobservation",
                    "cdaobservation"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "BundleToClinicalDocumentEmedPharmaceuticalAdviceDocument",
      "extends" : "BundleToClinicalDocumentCh",
      "typeMode" : "none",
      "documentation" : "_________________________ Header Level Templates _________________________\r\nsource: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-pharmaceuticaladvice.html\r\ntarget: 2.16.756.5.30.1.1.10.9.42",
      "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-PADV",
          "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.2"
                }
              ]
            }
          ]
        },
        {
          "name" : "CDA-PHARM-PharmaceuticalAdvice",
          "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.6"
                }
              ]
            }
          ]
        },
        {
          "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" : "CompositionClinicalDocumentChEmedPharmaceuticalAdviceDocument",
                  "variable" : [
                    "bundle",
                    "resource",
                    "cda"
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}