POC - Mapping CDA to FHIR
0.1.0 - ci-build

POC - Mapping CDA to FHIR - version de développement local (intégration continue v0.1.0) construite par les outils de publication FHIR (HL7® FHIR® Standard). Voir le répertoire des versions publiées

## : Mapping de CDAFr vers FHIR Bundle (A partir des sources de Oliver Egger) - JSON Representation

Draft as of 2026-02-09

Raw json | Download

    {
      "resourceType" : "StructureMap",
      "id" : "CdaFrToBundle",
      "text" : {
        "status" : "generated",
        "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Narratif généré : StructureMap CdaFrToBundle</b></p><a name=\"CdaFrToBundle\"> </a><a name=\"hcCdaFrToBundle\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaFrToBundle<span style=\"color: navy\">&quot; = &quot;</span>CdaFrToBundle<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Mapping de CDAFr vers FHIR Bundle (A partir des sources de Oliver Egger)</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/cda/stds/core/2.0.0-sd/StructureDefinition-ClinicalDocument.html\" title=\"ClinicalDocument (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/ClinicalDocument</a><span style=\"color: navy\">&quot; </span><b>alias </b>ClinicalDocument <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/cda/stds/core/2.0.0-sd/StructureDefinition-Section.html\" title=\"Section (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/Section</a><span style=\"color: navy\">&quot; </span><b>alias </b>Section <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/cda/stds/core/2.0.0-sd/StructureDefinition-PatientRole.html\" title=\"PatientRole (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/PatientRole</a><span style=\"color: navy\">&quot; </span><b>alias </b>PatientRole <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/cda/stds/core/2.0.0-sd/StructureDefinition-DataEnterer.html\" title=\"DataEnterer (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/DataEnterer</a><span style=\"color: navy\">&quot; </span><b>alias </b>DataEnterer <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/composition.html\" title=\"Composition\">http://hl7.org/fhir/StructureDefinition/Composition</a><span style=\"color: navy\">&quot; </span><b>alias </b>Composition <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">&quot; </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/person.html\" title=\"Person\">http://hl7.org/fhir/StructureDefinition/Person</a><span style=\"color: navy\">&quot; </span><b>alias </b>Person <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitioner.html\" title=\"Practitioner\">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style=\"color: navy\">&quot; </span><b>alias </b>Practitioner <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitionerrole.html\" title=\"PractitionerRole\">http://hl7.org/fhir/StructureDefinition/PractitionerRole</a><span style=\"color: navy\">&quot; </span><b>alias </b>PractitionerRole <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/organization.html\" title=\"Organization\">http://hl7.org/fhir/StructureDefinition/Organization</a><span style=\"color: navy\">&quot; </span><b>alias </b>Organization <b>as </b><b>target</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-CdaToFHIRTypes.html\" title=\"Mapping de CDA vers les FHIR Types (A partir des sources de Oliver Egger)\">https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToFHIRTypes</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-CdaToBundle.html\" title=\"Mapping de CDA vers FHIR Bundle (A partir des sources de Oliver Egger)\">https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToBundle</a><span style=\"color: navy\">&quot;\r\n</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">_________________________ Document Level Template  _________________________</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html</span>\r\n<b>group </b>CdaFrToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">cda</span><span style=\"color: navy\"> : </span>ClinicalDocument, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  cda<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span> composition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span> patient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentFrToBundle<span style=\"color: navy\">(</span><span style=\"color: maroon\">cda</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;ClinicalDocumentToBody&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">group ClinicalDocumentFrToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target bundle : Bundle)</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">extends ClinicalDocumentToBundle {</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">cda then ClinicalDocumentCompositionFr(cda, composition, patient, bundle) &quot;composition&quot;;</span>\r\n<span style=\"color: #b36b00\" title=\"Cet élément n'était pas défini avant R5\">// cda.component as component then {</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">component.structuredBody as body then {</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">body.component as component then {</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">component.section as srcSection where (templateId.where(root='2.16.756.5.30.1.1.10.3.2')) -&gt; composition.section as tgtSection</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle);</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">component.section as srcSection where (templateId.where(root='2.16.756.5.30.1.1.10.3.45')) -&gt; composition.section as tgtSection</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">then SectionOriginalRepresentation(cda, srcSection, patient, tgtSection, bundle);</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">} &quot;component&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">} &quot;body&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">} &quot;component&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">}</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">_________________________ Section Level Templates _________________________</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-definitions.html#Composition.section</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">TODO: not excplicitly modeled in CH-Core</span>\r\n<b>group </b>SectionOriginalRepresentation<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">cda</span><span style=\"color: navy\"> : </span>ClinicalDocument, <b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>Section, <b>source</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">tgt</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><b> extends </b>ClinicalDocumentSection<span style=\"color: navy\"> {\r\n</span>  src.entry<b> as </b><span style=\"color: maroon\">cdaEntry</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Binary'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">binary</span><span style=\"color: navy\">, </span> binary.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">urnuuid</span><span style=\"color: navy\">, </span> tgt.entry = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: maroon\">urnuuid</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    cdaEntry.observationMedia<b> as </b><span style=\"color: maroon\">observationMedia</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      observationMedia<b> then </b>ObservationMedia<span style=\"color: navy\">(</span><span style=\"color: maroon\">observationMedia</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">binary</span><span style=\"color: navy\">)</span> <i>&quot;observationMedia&quot;</i><span style=\"color: navy\">;</span>\r\n      observationMedia.ID<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>reference.extension<b> as </b><span style=\"color: maroon\">ext</span><b> then </b>NarrativeLink<span style=\"color: navy\">(</span><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ext</span><span style=\"color: navy\">)</span> <i>&quot;narrativeLink&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;cdaEntry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">_________________________ Entry Level Templates   ________________________</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.4.83</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">TODO: not excplicitly modeled in CH-Core</span>\r\n<b>group </b>ObservationMedia<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">observationMedia</span>, <b>target</b> <span style=\"color: maroon\">binary</span><span style=\"color: navy\"> : </span>Binary<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  observationMedia.value<b> as </b><span style=\"color: maroon\">value</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    value.mediaType<b> as </b><span style=\"color: maroon\">mediaType</span><span style=\"color: navy\"><b> -&gt; </b></span>binary.contentType = <span style=\"color: maroon\">mediaType</span> <i>&quot;contentType&quot;</i><span style=\"color: navy\">;</span>\r\n    value<span style=\"color: navy\"><b> -&gt; </b></span>binary.data = <span style=\"color: navy\">(</span>value.dataBase64Binary<span style=\"color: navy\">)</span> <i>&quot;dataString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  observationMedia.languageCode<b> as </b><span style=\"color: maroon\">languageCode</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    languageCode.code<b> as </b><span style=\"color: maroon\">lang</span><span style=\"color: navy\"><b> -&gt; </b></span>binary.language = <span style=\"color: maroon\">lang</span> <i>&quot;lang&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">_________________________ Header Level Templates _________________________</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-confidentialitycode.html</span>\r\n<b>group </b>ChExtEprConfidentialityCode<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>CE, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-confidentialitycode'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><b> then </b>CECodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">value</span><span style=\"color: navy\">)</span> <i>&quot;code&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-informationrecipient.html</span>\r\n<b>group </b>ChExtEprInformationRecipient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>IntendedRecipient, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-informationrecipient'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;value&quot;</i><span style=\"color: navy\">;</span>\r\n  src.addr<b> as </b><span style=\"color: maroon\">addr</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.address<b> as </b><span style=\"color: maroon\">address</span><b> then </b>ADAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">addr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">address</span><span style=\"color: navy\">)</span> <i>&quot;address&quot;</i><span style=\"color: navy\">;</span>\r\n  src.informationRecipient<b> as </b><span style=\"color: maroon\">informationRecipient</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    informationRecipient.name<b> as </b><span style=\"color: maroon\">cdaname</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.name<b> as </b><span style=\"color: maroon\">fhirname</span><b> then </b>ENHumanName<span style=\"color: navy\">(</span><span style=\"color: maroon\">cdaname</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">fhirname</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-informationrecipient.html</span>\r\n<b>group </b>ChExtEprInformationRecipientOrganization<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>IntendedRecipient, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-informationrecipient'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %organization.id<span style=\"color: navy\">)</span> <i>&quot;value&quot;</i><span style=\"color: navy\">;</span>\r\n  src.receivedOrganization<b> as </b><span style=\"color: maroon\">receivedOrganization</span><b> then </b>ClinicalDocumentOrganization<span style=\"color: navy\">(</span><span style=\"color: maroon\">receivedOrganization</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>&quot;organization&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?section=templates&amp;id=2.16.756.5.30.1.1.10.2.7</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">target: http://build.fhir.org/ig/hl7ch/ch-core/StructureDefinition-ch-ext-epr-dataenterer.html</span>\r\n<b>group </b>ChExtEprDataEnterer<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>DataEnterer, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src.assignedEntity<b> as </b><span style=\"color: maroon\">assignedEntity</span><span style=\"color: navy\"><b> -&gt; </b></span> ext.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'enterer'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitionerRole.id<span style=\"color: navy\">)</span> <i>&quot;PractitionerRole&quot;</i><span style=\"color: navy\">;</span>\r\n  src.time<b> as </b><span style=\"color: maroon\">time</span><span style=\"color: navy\"><b> -&gt; </b></span>ext.extension<b> as </b><span style=\"color: maroon\">exttime</span><b> then </b>ChExtEprTime<span style=\"color: navy\">(</span><span style=\"color: maroon\">time</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">exttime</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.assignedEntity<b> as </b><span style=\"color: maroon\">assignedEntity</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    assignedEntity<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentEntityPractitioner<span style=\"color: navy\">(</span><span style=\"color: maroon\">assignedEntity</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span> <i>&quot;Practitioner&quot;</i><span style=\"color: navy\">;</span>\r\n    assignedEntity.representedOrganization<b> as </b><span style=\"color: maroon\">representedOrganization</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">referenceOrg</span><span style=\"color: navy\">, </span> referenceOrg.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentOrganization<span style=\"color: navy\">(</span><span style=\"color: maroon\">representedOrganization</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>&quot;Organization&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">// _________________________ Template Type not specified  ___________________</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">// source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">// target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-epr.html</span>\r\n<b>group </b>ClinicalDocumentCompositionFr<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>ClinicalDocument, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">patientResource</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.confidentialityCode<b> as </b><span style=\"color: maroon\">confidentialityCode</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    confidentialityCode.code<b> as </b><span style=\"color: maroon\">v</span><b> where </b>('http://fhir.ch/ig/ch-epr-term/ValueSet/DocumentEntry.confidentialityCode'.resolve().compose.include.concept.where($this.code = src.confidentialityCode.code).exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.confidentiality = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">v</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'http://fhir.ch/ig/ch-core/ConceptMap/documententry-confidentialitycode-to-fhir'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">fhirconf</span><span style=\"color: navy\">, </span> fhirconf.extension<b> as </b><span style=\"color: maroon\">ext</span><b> then </b>ChExtEprConfidentialityCode<span style=\"color: navy\">(</span><span style=\"color: maroon\">confidentialityCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ext</span><span style=\"color: navy\">)</span> <i>&quot;confCode&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  src.informationRecipient<b> as </b><span style=\"color: maroon\">informationRecipient</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">e</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    informationRecipient.intendedRecipient<b> as </b><span style=\"color: maroon\">intendedRecipient</span><b> where </b>$this.receivedOrganization.exists() = false<span style=\"color: navy\"><b> -&gt; </b></span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">recipient</span><span style=\"color: navy\">, </span> recipient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgt.extension<b> as </b><span style=\"color: maroon\">ext</span><b> then </b>ChExtEprInformationRecipient<span style=\"color: navy\">(</span><span style=\"color: maroon\">intendedRecipient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">recipient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ext</span><span style=\"color: navy\">)</span> <i>&quot;informationRecipient&quot;</i><span style=\"color: navy\">;</span>\r\n    informationRecipient.intendedRecipient<b> as </b><span style=\"color: maroon\">intendedRecipient</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      intendedRecipient.receivedOrganization<span style=\"color: navy\"><b> -&gt; </b></span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">recipient</span><span style=\"color: navy\">, </span> recipient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgt.extension<b> as </b><span style=\"color: maroon\">ext</span><b> then </b>ChExtEprInformationRecipientOrganization<span style=\"color: navy\">(</span><span style=\"color: maroon\">intendedRecipient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">recipient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ext</span><span style=\"color: navy\">)</span> <i>&quot;informationRecipientOrganization&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;intendedRecipientAsOrganization&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;entry&quot;</i><span style=\"color: navy\">;</span>\r\n  src.dataEnterer<b> as </b><span style=\"color: maroon\">dataEnterer</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span> practitionerRole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgt.extension<b> as </b><span style=\"color: maroon\">ext</span><b> then </b>ChExtEprDataEnterer<span style=\"color: navy\">(</span><span style=\"color: maroon\">dataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ext</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
      },
      "url" : "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaFrToBundle",
      "version" : "0.1.0",
      "name" : "CdaFrToBundle",
      "title" : "Mapping de CDAFr vers FHIR Bundle (A partir des sources de Oliver Egger)",
      "status" : "draft",
      "date" : "2026-02-09T11:09:38+00:00",
      "publisher" : "Agence du Numérique en Santé (ANS) - 2-10 Rue d'Oradour-sur-Glane, 75015 Paris",
      "contact" : [
        {
          "name" : "Agence du Numérique en Santé (ANS) - 2-10 Rue d'Oradour-sur-Glane, 75015 Paris",
          "telecom" : [
            {
              "system" : "url",
              "value" : "https://esante.gouv.fr"
            }
          ]
        }
      ],
      "description" : "Mapping de CDAFr vers FHIR Bundle (A partir des sources de Oliver Egger)",
      "jurisdiction" : [
        {
          "coding" : [
            {
              "system" : "urn:iso:std:iso:3166",
              "code" : "FR",
              "display" : "FRANCE"
            }
          ]
        }
      ],
      "structure" : [
        {
          "url" : "http://hl7.org/cda/stds/core/StructureDefinition/ClinicalDocument",
          "mode" : "source",
          "alias" : "ClinicalDocument"
        },
        {
          "url" : "http://hl7.org/cda/stds/core/StructureDefinition/Section",
          "mode" : "source",
          "alias" : "Section"
        },
        {
          "url" : "http://hl7.org/cda/stds/core/StructureDefinition/PatientRole",
          "mode" : "source",
          "alias" : "PatientRole"
        },
        {
          "url" : "http://hl7.org/cda/stds/core/StructureDefinition/DataEnterer",
          "mode" : "source",
          "alias" : "DataEnterer"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
          "mode" : "target",
          "alias" : "Bundle"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Composition",
          "mode" : "target",
          "alias" : "Composition"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Patient",
          "mode" : "target",
          "alias" : "Patient"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Person",
          "mode" : "target",
          "alias" : "Person"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
          "mode" : "target",
          "alias" : "Practitioner"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
          "mode" : "target",
          "alias" : "PractitionerRole"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Organization",
          "mode" : "target",
          "alias" : "Organization"
        }
      ],
      "import" : [
        🔗 "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToFHIRTypes"🔗 ,
        "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToBundle"
      ],
      "group" : [
        {
          "name" : "CdaFrToBundle",
          "typeMode" : "none",
          "documentation" : "_________________________ Document Level Template  _________________________\r\nsource: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14\r\ntarget: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html",
          "input" : [
            {
              "name" : "cda",
              "type" : "ClinicalDocument",
              "mode" : "source"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "ClinicalDocumentToBody",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "composition",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Composition"
                    }
                  ]
                },
                {
                  "context" : "composition",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid"
                    }
                  ]
                },
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e2"
                },
                {
                  "context" : "e2",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "patient",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Patient"
                    }
                  ]
                },
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid2",
                  "transform" : "uuid"
                },
                {
                  "context" : "e2",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid2"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "ClinicalDocumentFrToBundle",
                  "variable" : [
                    "cda",
                    "patient",
                    "composition",
                    "bundle"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "SectionOriginalRepresentation",
          "extends" : "ClinicalDocumentSection",
          "typeMode" : "none",
          "documentation" : "source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14\r\ntarget: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html\r\ngroup ClinicalDocumentFrToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target bundle : Bundle)\r\nextends ClinicalDocumentToBundle {\r\ncda then ClinicalDocumentCompositionFr(cda, composition, patient, bundle) \"composition\";\r\ncda.component as component then {\r\ncomponent.structuredBody as body then {\r\nbody.component as component then {\r\ncomponent.section as srcSection where (templateId.where(root='2.16.756.5.30.1.1.10.3.2')) -> composition.section as tgtSection\r\nthen ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle);\r\ncomponent.section as srcSection where (templateId.where(root='2.16.756.5.30.1.1.10.3.45')) -> composition.section as tgtSection\r\nthen SectionOriginalRepresentation(cda, srcSection, patient, tgtSection, bundle);\r\n} \"component\";\r\n} \"body\";\r\n} \"component\";\r\n}\r\n_________________________ Section Level Templates _________________________\r\nsource: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14\r\ntarget: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-definitions.html#Composition.section\r\nTODO: not excplicitly modeled in CH-Core",
          "input" : [
            {
              "name" : "cda",
              "type" : "ClinicalDocument",
              "mode" : "source"
            },
            {
              "name" : "src",
              "type" : "Section",
              "mode" : "source"
            },
            {
              "name" : "patient",
              "type" : "Patient",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "mode" : "target"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "cdaEntry",
              "source" : [
                {
                  "context" : "src",
                  "element" : "entry",
                  "variable" : "cdaEntry"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "binary",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Binary"
                    }
                  ]
                },
                {
                  "context" : "binary",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "variable" : "urnuuid",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid"
                    }
                  ]
                },
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "urnuuid"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "observationMedia",
                  "source" : [
                    {
                      "context" : "cdaEntry",
                      "element" : "observationMedia",
                      "variable" : "observationMedia"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "observationMedia",
                      "source" : [
                        {
                          "context" : "observationMedia"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ObservationMedia",
                          "variable" : [
                            "observationMedia",
                            "binary"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "narrativeLink",
                      "source" : [
                        {
                          "context" : "observationMedia",
                          "element" : "ID",
                          "variable" : "value"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "extension",
                          "variable" : "ext"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "NarrativeLink",
                          "variable" : [
                            "value",
                            "ext"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ObservationMedia",
          "typeMode" : "none",
          "documentation" : "_________________________ Entry Level Templates   ________________________\r\nsource: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.4.83\r\nTODO: not excplicitly modeled in CH-Core",
          "input" : [
            {
              "name" : "observationMedia",
              "mode" : "source"
            },
            {
              "name" : "binary",
              "type" : "Binary",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "value",
              "source" : [
                {
                  "context" : "observationMedia",
                  "element" : "value",
                  "variable" : "value"
                }
              ],
              "rule" : [
                {
                  "name" : "contentType",
                  "source" : [
                    {
                      "context" : "value",
                      "element" : "mediaType",
                      "variable" : "mediaType"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "binary",
                      "contextType" : "variable",
                      "element" : "contentType",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "mediaType"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "dataString",
                  "source" : [
                    {
                      "context" : "value"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "binary",
                      "contextType" : "variable",
                      "element" : "data",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "value.dataBase64Binary"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "languageCode",
              "source" : [
                {
                  "context" : "observationMedia",
                  "element" : "languageCode",
                  "variable" : "languageCode"
                }
              ],
              "rule" : [
                {
                  "name" : "lang",
                  "source" : [
                    {
                      "context" : "languageCode",
                      "element" : "code",
                      "variable" : "lang"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "binary",
                      "contextType" : "variable",
                      "element" : "language",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "lang"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ChExtEprConfidentialityCode",
          "typeMode" : "none",
          "documentation" : "_________________________ Header Level Templates _________________________\r\nsource: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36\r\ntarget: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-confidentialitycode.html",
          "input" : [
            {
              "name" : "src",
              "type" : "CE",
              "mode" : "source"
            },
            {
              "name" : "ext",
              "type" : "Extension",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "url",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-confidentialitycode"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CECodeableConcept",
                  "variable" : [
                    "src",
                    "value"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ChExtEprInformationRecipient",
          "typeMode" : "none",
          "documentation" : "source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36\r\ntarget: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-informationrecipient.html",
          "input" : [
            {
              "name" : "src",
              "type" : "IntendedRecipient",
              "mode" : "source"
            },
            {
              "name" : "patient",
              "type" : "Patient",
              "mode" : "target"
            },
            {
              "name" : "ext",
              "type" : "Extension",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "url",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-informationrecipient"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "value",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %patient.id"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "address",
              "source" : [
                {
                  "context" : "src",
                  "element" : "addr",
                  "variable" : "addr"
                }
              ],
              "target" : [
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "address",
                  "variable" : "address"
                }
              ],
              "dependent" : [
                {
                  "name" : "ADAddress",
                  "variable" : [
                    "addr",
                    "address"
                  ]
                }
              ]
            },
            {
              "name" : "informationRecipient",
              "source" : [
                {
                  "context" : "src",
                  "element" : "informationRecipient",
                  "variable" : "informationRecipient"
                }
              ],
              "rule" : [
                {
                  "name" : "name",
                  "source" : [
                    {
                      "context" : "informationRecipient",
                      "element" : "name",
                      "variable" : "cdaname"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "patient",
                      "contextType" : "variable",
                      "element" : "name",
                      "variable" : "fhirname"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ENHumanName",
                      "variable" : [
                        "cdaname",
                        "fhirname"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ChExtEprInformationRecipientOrganization",
          "typeMode" : "none",
          "documentation" : "source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36\r\ntarget: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-informationrecipient.html",
          "input" : [
            {
              "name" : "src",
              "type" : "IntendedRecipient",
              "mode" : "source"
            },
            {
              "name" : "organization",
              "type" : "Organization",
              "mode" : "target"
            },
            {
              "name" : "ext",
              "type" : "Extension",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "url",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-informationrecipient"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "value",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %organization.id"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "organization",
              "source" : [
                {
                  "context" : "src",
                  "element" : "receivedOrganization",
                  "variable" : "receivedOrganization"
                }
              ],
              "dependent" : [
                {
                  "name" : "ClinicalDocumentOrganization",
                  "variable" : [
                    "receivedOrganization",
                    "organization"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ChExtEprDataEnterer",
          "typeMode" : "none",
          "documentation" : "source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?section=templates&id=2.16.756.5.30.1.1.10.2.7\r\ntarget: http://build.fhir.org/ig/hl7ch/ch-core/StructureDefinition-ch-ext-epr-dataenterer.html",
          "input" : [
            {
              "name" : "src",
              "type" : "DataEnterer",
              "mode" : "source"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            },
            {
              "name" : "practitionerRole",
              "type" : "PractitionerRole",
              "mode" : "target"
            },
            {
              "name" : "ext",
              "type" : "Extension",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "url",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "PractitionerRole",
              "source" : [
                {
                  "context" : "src",
                  "element" : "assignedEntity",
                  "variable" : "assignedEntity"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "extension",
                  "variable" : "ext"
                },
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "enterer"
                    }
                  ]
                },
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %practitionerRole.id"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "time",
              "source" : [
                {
                  "context" : "src",
                  "element" : "time",
                  "variable" : "time"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "extension",
                  "variable" : "exttime"
                }
              ],
              "dependent" : [
                {
                  "name" : "ChExtEprTime",
                  "variable" : [
                    "time",
                    "exttime"
                  ]
                }
              ]
            },
            {
              "name" : "assignedEntity",
              "source" : [
                {
                  "context" : "src",
                  "element" : "assignedEntity",
                  "variable" : "assignedEntity"
                }
              ],
              "rule" : [
                {
                  "name" : "Practitioner",
                  "source" : [
                    {
                      "context" : "assignedEntity"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "practitioner",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Practitioner"
                        }
                      ]
                    },
                    {
                      "context" : "practitioner",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid"
                        }
                      ]
                    },
                    {
                      "context" : "practitionerRole",
                      "contextType" : "variable",
                      "element" : "practitioner",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ClinicalDocumentEntityPractitioner",
                      "variable" : [
                        "assignedEntity",
                        "practitioner"
                      ]
                    }
                  ]
                },
                {
                  "name" : "Organization",
                  "source" : [
                    {
                      "context" : "assignedEntity",
                      "element" : "representedOrganization",
                      "variable" : "representedOrganization"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "organization",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Organization"
                        }
                      ]
                    },
                    {
                      "context" : "organization",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid2",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid2"
                        }
                      ]
                    },
                    {
                      "context" : "practitionerRole",
                      "contextType" : "variable",
                      "element" : "organization",
                      "variable" : "referenceOrg",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "referenceOrg",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid2"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ClinicalDocumentOrganization",
                      "variable" : [
                        "representedOrganization",
                        "organization"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentCompositionFr",
          "typeMode" : "none",
          "documentation" : "// _________________________ Template Type not specified  ___________________\r\n// source: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36\r\n// target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-epr.html",
          "input" : [
            {
              "name" : "src",
              "type" : "ClinicalDocument",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "type" : "Composition",
              "mode" : "target"
            },
            {
              "name" : "patientResource",
              "type" : "Patient",
              "mode" : "target"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "confidentialityCode",
              "source" : [
                {
                  "context" : "src",
                  "element" : "confidentialityCode",
                  "variable" : "confidentialityCode"
                }
              ],
              "rule" : [
                {
                  "name" : "confCode",
                  "source" : [
                    {
                      "context" : "confidentialityCode",
                      "element" : "code",
                      "variable" : "v",
                      "condition" : "('http://fhir.ch/ig/ch-epr-term/ValueSet/DocumentEntry.confidentialityCode'.resolve().compose.include.concept.where($this.code = src.confidentialityCode.code).exists())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "confidentiality",
                      "variable" : "fhirconf",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "v"
                        },
                        {
                          "valueString" : "http://fhir.ch/ig/ch-core/ConceptMap/documententry-confidentialitycode-to-fhir"
                        },
                        {
                          "valueString" : "code"
                        }
                      ]
                    },
                    {
                      "context" : "fhirconf",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ChExtEprConfidentialityCode",
                      "variable" : [
                        "confidentialityCode",
                        "ext"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "entry",
              "source" : [
                {
                  "context" : "src",
                  "element" : "informationRecipient",
                  "variable" : "informationRecipient"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                }
              ],
              "rule" : [
                {
                  "name" : "informationRecipient",
                  "source" : [
                    {
                      "context" : "informationRecipient",
                      "element" : "intendedRecipient",
                      "variable" : "intendedRecipient",
                      "condition" : "$this.receivedOrganization.exists() = false"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "recipient",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Patient"
                        }
                      ]
                    },
                    {
                      "context" : "recipient",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ChExtEprInformationRecipient",
                      "variable" : [
                        "intendedRecipient",
                        "recipient",
                        "ext"
                      ]
                    }
                  ]
                },
                {
                  "name" : "intendedRecipientAsOrganization",
                  "source" : [
                    {
                      "context" : "informationRecipient",
                      "element" : "intendedRecipient",
                      "variable" : "intendedRecipient"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "informationRecipientOrganization",
                      "source" : [
                        {
                          "context" : "intendedRecipient",
                          "element" : "receivedOrganization"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "e",
                          "contextType" : "variable",
                          "element" : "resource",
                          "variable" : "recipient",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Organization"
                            }
                          ]
                        },
                        {
                          "context" : "recipient",
                          "contextType" : "variable",
                          "element" : "id",
                          "variable" : "uuid2",
                          "transform" : "uuid"
                        },
                        {
                          "context" : "e",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "urn:uuid:"
                            },
                            {
                              "valueId" : "uuid2"
                            }
                          ]
                        },
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "extension",
                          "variable" : "ext"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ChExtEprInformationRecipientOrganization",
                          "variable" : [
                            "intendedRecipient",
                            "recipient",
                            "ext"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "dataEnterer",
              "source" : [
                {
                  "context" : "src",
                  "element" : "dataEnterer",
                  "variable" : "dataEnterer"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitionerRole",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "PractitionerRole"
                    }
                  ]
                },
                {
                  "context" : "practitionerRole",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid"
                    }
                  ]
                },
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "extension",
                  "variable" : "ext"
                }
              ],
              "dependent" : [
                {
                  "name" : "ChExtEprDataEnterer",
                  "variable" : [
                    "dataEnterer",
                    "bundle",
                    "practitionerRole",
                    "ext"
                  ]
                }
              ]
            }
          ]
        }
      ]
    }