POC - Mapping CDA to FHIR
0.1.0 - ci-build

POC - Mapping CDA to FHIR - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

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

Draft as of 2025-11-07

Raw json | Download

    {
      "resourceType" : "StructureMap",
      "id" : "CdaToBundle",
      "text" : {
        "status" : "generated",
        "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Narratif généré : StructureMap CdaToBundle</b></p><a name=\"CdaToBundle\"> </a><a name=\"hcCdaToBundle\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToBundle<span style=\"color: navy\">&quot; = &quot;</span>CdaToBundle<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Mapping de CDA 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-AssignedAuthor.html\" title=\"AssignedAuthor (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/AssignedAuthor</a><span style=\"color: navy\">&quot; </span><b>alias </b>AssignedAuthor <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-AssignedEntity.html\" title=\"AssignedEntity (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/AssignedEntity</a><span style=\"color: navy\">&quot; </span><b>alias </b>AssignedEntity <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-CustodianOrganization.html\" title=\"CustodianOrganization (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/CustodianOrganization</a><span style=\"color: navy\">&quot; </span><b>alias </b>CustodianOrganization <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/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/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>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">_________________________ Document Level Template  _________________________</span>\r\n<b>group </b>CdaToBundle<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><span style=\"color: navy\"> {\r\n</span>    cda<b> then </b>ClinicalDocumentToBundle<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;cdatobundle&quot;</i><span style=\"color: navy\">;</span>\r\n  <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><b>group </b>ClinicalDocumentToBundle<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\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <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.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;id&quot;</i><span style=\"color: navy\">;</span>\r\n  cda.id<b> as </b><span style=\"color: maroon\">cdaId</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.identifier<b> as </b><span style=\"color: maroon\">identifier</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    cdaId.root<b> as </b><span style=\"color: maroon\">root</span><b> where </b>cdaId.extension.exists()<span style=\"color: navy\"><b> -&gt; </b></span>identifier.system = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">root</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'#oid2uri'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'uri'</span><span style=\"color: navy\">)</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n    cdaId.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\"><b> -&gt; </b></span>identifier.value = <span style=\"color: maroon\">extension</span> <i>&quot;value&quot;</i><span style=\"color: navy\">;</span>\r\n    cdaId.root<b> as </b><span style=\"color: maroon\">root</span><b> where </b>cdaId.extension.empty()<span style=\"color: navy\"><b> -&gt; </b></span>identifier.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span> <i>&quot;systemOid&quot;</i><span style=\"color: navy\">;</span>\r\n    cdaId.root<b> as </b><span style=\"color: maroon\">root</span><b> where </b>cdaId.extension.empty()<span style=\"color: navy\"><b> -&gt; </b></span>identifier.value = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:oid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">root</span><span style=\"color: navy\">)</span> <i>&quot;valueOid&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;identifier&quot;</i><span style=\"color: navy\">;</span>\r\n  cda<span style=\"color: navy\"><b> -&gt; </b></span>bundle.type = <span style=\"color: blue\">'document'</span> <i>&quot;type&quot;</i><span style=\"color: navy\">;</span>\r\n  cda.effectiveTime<b> as </b><span style=\"color: maroon\">effectiveTime</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.timestamp = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'instant'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">timestamp</span><b> then </b>TSInstant<span style=\"color: navy\">(</span><span style=\"color: maroon\">effectiveTime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">)</span> <i>&quot;timestamp&quot;</i><span style=\"color: navy\">;</span>\r\n  cda<b> then </b>ClinicalDocumentComposition<span style=\"color: navy\">(</span><span style=\"color: maroon\">cda</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;composition&quot;</i><span style=\"color: navy\">;</span>\r\n  cda.component<b> as </b><span style=\"color: maroon\">cdaComponent</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    cdaComponent.structuredBody<b> as </b><span style=\"color: maroon\">body</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      body.component<b> as </b><span style=\"color: maroon\">bodyComponent</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        bodyComponent.section<b> as </b><span style=\"color: maroon\">srcSection</span><b> where </b>$this.code.empty()<span style=\"color: navy\"><b> -&gt; </b></span>composition.section<b> as </b><span style=\"color: maroon\">tgtSection</span><b> then </b>ClinicalDocumentSection<span style=\"color: navy\">(</span><span style=\"color: maroon\">cda</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">srcSection</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtSection</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;bodyComponent&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;body&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;cdaComponent&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\">// _________________________ Section Level Templates _________________________</span>\r\n<b>group </b>ClinicalDocumentSection<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><span style=\"color: navy\"> {\r\n</span>  src.title<b> as </b><span style=\"color: maroon\">t</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.title = <span style=\"color: navy\">(</span>t.xmlText<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.code<b> as </b><span style=\"color: maroon\">srcCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.code = <span style=\"color: maroon\">srcCode</span><span style=\"color: navy\">;</span>\r\n  src.text<b> as </b><span style=\"color: maroon\">cdaText</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.text<b> as </b><span style=\"color: maroon\">fhirText</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    cdaText<span style=\"color: navy\"><b> -&gt; </b></span>fhirText.status = <span style=\"color: blue\">'generated'</span> <i>&quot;narrativeStatus&quot;</i><span style=\"color: navy\">;</span>\r\n    cdaText<b> as </b><span style=\"color: maroon\">t</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirText.div = <span style=\"color: maroon\">t</span> <i>&quot;narrativeText&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;cdaText&quot;</i><span style=\"color: navy\">;</span>\r\n  src.section<b> as </b><span style=\"color: maroon\">srcSection</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.section<b> as </b><span style=\"color: maroon\">tgtSection</span><b> then </b>ClinicalDocumentSection<span style=\"color: navy\">(</span><span style=\"color: maroon\">cda</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">srcSection</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtSection</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><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\">_________________________ Entry Level Templates   ________________________</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">_________________________ Header Level Templates _________________________</span>\r\n<b>group </b>ClinicalDocumentComposition<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.languageCode<b> as </b><span style=\"color: maroon\">languageCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.language = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">code</span><b> then </b>CSCode<span style=\"color: navy\">(</span><span style=\"color: maroon\">languageCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">code</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.id<b> as </b><span style=\"color: maroon\">id</span><b> where </b>src.setId.exists().not()<span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">id</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span> <i>&quot;identifier&quot;</i><span style=\"color: navy\">;</span>\r\n  src.setId<b> as </b><span style=\"color: maroon\">setId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">setId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span> <i>&quot;setIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = <span style=\"color: blue\">'final'</span> <i>&quot;status&quot;</i><span style=\"color: navy\">;</span>\r\n  src.code<b> as </b><span style=\"color: maroon\">srcCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.type = <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\">cc</span><b> then </b>CDCodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.title<b> as </b><span style=\"color: maroon\">t</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.title = <span style=\"color: navy\">(</span>t.xmlText<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.recordTarget<b> as </b><span style=\"color: maroon\">recordTarget</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    recordTarget.patientRole<b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.subject = <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:' + %patientResource.id<span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentPatientRole<span style=\"color: navy\">(</span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patientResource</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;subject&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;patientRole&quot;</i><span style=\"color: navy\">;</span>\r\n  src.componentOf<b> as </b><span style=\"color: maroon\">comp</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\">'Encounter'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">encounter</span><span style=\"color: navy\">, </span> encounter.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> then</b><span style=\"color: navy\"> {\r\n</span>    comp.encompassingEncounter<b> as </b><span style=\"color: maroon\">srcEnc</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.encounter = <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:' + %encounter.id<span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentEncounter<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcEnc</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">encounter</span><span style=\"color: navy\">)</span> <i>&quot;srcEncounter&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;encompassingEncounter&quot;</i><span style=\"color: navy\">;</span>\r\n  src.effectiveTime<b> as </b><span style=\"color: maroon\">effectiveTime</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.date = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'dateTime'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">date</span><b> then </b>TSDateTime<span style=\"color: navy\">(</span><span style=\"color: maroon\">effectiveTime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">date</span><span style=\"color: navy\">)</span> <i>&quot;compositionDate&quot;</i><span style=\"color: navy\">;</span>\r\n  src.author<b> as </b><span style=\"color: maroon\">srcAuthor</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\">'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\">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> bundle.entry<b> as </b><span style=\"color: maroon\">eRole</span><span style=\"color: navy\">, </span> eRole.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\">uuidRole</span><span style=\"color: navy\">, </span> eRole.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\">uuidRole</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgt.author = <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><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcAuthor<span style=\"color: navy\"><b> -&gt; </b></span>practitioner.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcAuthor<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-practitioner'</span> <i>&quot;practitionerProfile&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;practitionerMeta&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAuthor<span style=\"color: navy\"><b> -&gt; </b></span>practitionerRole.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">metaRole</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcAuthor<span style=\"color: navy\"><b> -&gt; </b></span>metaRole.profile = <span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-practitionerrole'</span> <i>&quot;practitionerRoleProfile&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;practitionerRoleMeta&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAuthor<span style=\"color: navy\"><b> -&gt; </b></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\">refPract</span><span style=\"color: navy\">, </span> refPract.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitioner.id<span style=\"color: navy\">)</span> <i>&quot;practitionerRef&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAuthor.assignedAuthor<b> as </b><span style=\"color: maroon\">assignedAuthor</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      assignedAuthor.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -&gt; </b></span>practitioner.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        id<span style=\"color: navy\"><b> -&gt; </b></span>identifier<b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">id</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span> <i>&quot;baseIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n        id<b> where </b>root = '1.2.250.1.71.4.2.1'<span style=\"color: navy\"><b> -&gt; </b></span>identifier.type = <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\">type</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          id<span style=\"color: navy\"><b> -&gt; </b></span>type.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            id<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203'</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n            id<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: blue\">'IDNPS'</span> <i>&quot;code&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;coding&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;idNatPs&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;identifier&quot;</i><span style=\"color: navy\">;</span>\r\n      assignedAuthor.addr<b> as </b><span style=\"color: maroon\">addr</span><span style=\"color: navy\"><b> -&gt; </b></span>practitioner.address = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Address'</span><span style=\"color: navy\">)</span><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><span style=\"color: navy\">;</span>\r\n      assignedAuthor.telecom<b> as </b><span style=\"color: maroon\">tlc</span><span style=\"color: navy\"><b> -&gt; </b></span>practitioner.telecom = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ContactPoint'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">contactPoint</span><b> then </b>TELContactPoint<span style=\"color: navy\">(</span><span style=\"color: maroon\">tlc</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">contactPoint</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n      assignedAuthor.assignedPerson<b> as </b><span style=\"color: maroon\">assPerson</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        assPerson.name<b> as </b><span style=\"color: maroon\">pName</span><span style=\"color: navy\"><b> -&gt; </b></span>practitioner.name = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'HumanName'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">humanName</span><b> then </b>ENHumanName<span style=\"color: navy\">(</span><span style=\"color: maroon\">pName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">humanName</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;name&quot;</i><span style=\"color: navy\">;</span>\r\n      assignedAuthor.code<b> as </b><span style=\"color: maroon\">roleCode</span><span style=\"color: navy\"><b> -&gt; </b></span>practitionerRole.code = <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\">cc</span><b> then </b>CDCodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">roleCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span> <i>&quot;roleCode&quot;</i><span style=\"color: navy\">;</span>\r\n      assignedAuthor.code<b> as </b><span style=\"color: maroon\">roleCode</span><b> where </b>code.contains('/')<span style=\"color: navy\"><b> -&gt; </b></span>practitioner.qualification<b> as </b><span style=\"color: maroon\">qualification</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        roleCode<span style=\"color: navy\"><b> -&gt; </b></span>qualification.code = <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\">qualCode</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          roleCode.code<b> as </b><span style=\"color: maroon\">fullCode</span><span style=\"color: navy\"><b> -&gt; </b></span>qualCode.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            fullCode<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: navy\">(</span>%fullCode.substring(%fullCode.indexOf('/') + 1)<span style=\"color: navy\">)</span> <i>&quot;savoirFaireCode&quot;</i><span style=\"color: navy\">;</span>\r\n            fullCode<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'https://mos.esante.gouv.fr/NOS/TRE_R38-SpecialiteOrdinale/FHIR/TRE-R38-SpecialiteOrdinale'</span> <i>&quot;systemSavoirFaire&quot;</i><span style=\"color: navy\">;</span>\r\n            roleCode.displayName<b> as </b><span style=\"color: maroon\">display</span><span style=\"color: navy\"><b> -&gt; </b></span>coding.display = <span style=\"color: maroon\">display</span> <i>&quot;display&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;coding&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;qualCode&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;savoirFaire&quot;</i><span style=\"color: navy\">;</span>\r\n      assignedAuthor.code<b> as </b><span style=\"color: maroon\">roleCode</span><b> where </b>code.contains('/') and code.contains('_')<span style=\"color: navy\"><b> -&gt; </b></span>practitioner.qualification<b> as </b><span style=\"color: maroon\">qualification</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        roleCode<span style=\"color: navy\"><b> -&gt; </b></span>qualification.code = <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\">qualCode</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          roleCode.code<b> as </b><span style=\"color: maroon\">fullCode</span><span style=\"color: navy\"><b> -&gt; </b></span>qualCode.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            fullCode<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: navy\">(</span>%fullCode.substring(%fullCode.indexOf('_') + 1).substring(0, %fullCode.substring(%fullCode.indexOf('_') + 1).indexOf('/'))<span style=\"color: navy\">)</span> <i>&quot;professionCode&quot;</i><span style=\"color: navy\">;</span>\r\n            fullCode<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'https://mos.esante.gouv.fr/NOS/TRE_G15-ProfessionSante/FHIR/TRE-G15-ProfessionSante'</span> <i>&quot;systemProfession&quot;</i><span style=\"color: navy\">;</span>\r\n            fullCode<b> where </b>%fullCode.substring(%fullCode.indexOf('_') + 1).substring(0, %fullCode.substring(%fullCode.indexOf('_') + 1).indexOf('/')) = '10'<span style=\"color: navy\"><b> -&gt; </b></span>coding.display = <span style=\"color: blue\">'Médecin'</span> <i>&quot;displayMedecin&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;coding&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;qualCode&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;profession&quot;</i><span style=\"color: navy\">;</span>\r\n      assignedAuthor.representedOrganization<b> as </b><span style=\"color: maroon\">srcOrg</span><span style=\"color: navy\"><b> -&gt; </b></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\">'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\">uuid3</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\">uuid3</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\">refOrg</span><span style=\"color: navy\">, </span> refOrg.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %organization.id<span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentOrganization<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcOrg</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;author&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;srcAuthor&quot;</i><span style=\"color: navy\">;</span>\r\n  src.informant<b> as </b><span style=\"color: maroon\">srcInformant</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\">'RelatedPerson'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span> relatedPerson.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuidRelated</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\">uuidRelated</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcInformant.relatedEntity<b> as </b><span style=\"color: maroon\">relatedEntity</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      relatedEntity<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.patient = <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\">patientRef</span><span style=\"color: navy\">, </span> patientRef.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patientResource.id<span style=\"color: navy\">)</span> <i>&quot;patientRef&quot;</i><span style=\"color: navy\">;</span>\r\n      relatedEntity.code<b> as </b><span style=\"color: maroon\">relationCode</span><span style=\"color: navy\"><b> -&gt; </b></span>relatedPerson.relationship = <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\">cc</span><b> then </b>CDCodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">relationCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span> <i>&quot;relationship&quot;</i><span style=\"color: navy\">;</span>\r\n      relatedEntity.addr<b> as </b><span style=\"color: maroon\">addr</span><span style=\"color: navy\"><b> -&gt; </b></span>relatedPerson.address = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Address'</span><span style=\"color: navy\">)</span><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      relatedEntity.telecom<b> as </b><span style=\"color: maroon\">tlc</span><span style=\"color: navy\"><b> -&gt; </b></span>relatedPerson.telecom = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ContactPoint'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">contactPoint</span><b> then </b>TELContactPoint<span style=\"color: navy\">(</span><span style=\"color: maroon\">tlc</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">contactPoint</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n      relatedEntity.relatedPerson<b> as </b><span style=\"color: maroon\">relPerson</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        relPerson.name<b> as </b><span style=\"color: maroon\">pName</span><span style=\"color: navy\"><b> -&gt; </b></span>relatedPerson.name = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'HumanName'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">humanName</span><b> then </b>ENHumanName<span style=\"color: navy\">(</span><span style=\"color: maroon\">pName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">humanName</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;relatedPersonName&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><span style=\"color: navy\">;</span>\r\n  src.confidentialityCode<b> as </b><span style=\"color: maroon\">confCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.confidentiality = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">code</span><b> then </b>CSCode<span style=\"color: navy\">(</span><span style=\"color: maroon\">confCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">code</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.legalAuthenticator<b> as </b><span style=\"color: maroon\">legalAuth</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\">'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\">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><b> then</b><span style=\"color: navy\"> {\r\n</span>    legalAuth<span style=\"color: navy\"><b> -&gt; </b></span>tgt.attester<b> as </b><span style=\"color: maroon\">attester</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      legalAuth<span style=\"color: navy\"><b> -&gt; </b></span>attester.mode = <span style=\"color: blue\">'legal'</span> <i>&quot;mode&quot;</i><span style=\"color: navy\">;</span>\r\n      legalAuth.time<b> as </b><span style=\"color: maroon\">time</span><span style=\"color: navy\"><b> -&gt; </b></span>attester.time = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'dateTime'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">dt</span><b> then </b>TSDateTime<span style=\"color: navy\">(</span><span style=\"color: maroon\">time</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">dt</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n      legalAuth.assignedEntity<b> as </b><span style=\"color: maroon\">entity</span><span style=\"color: navy\"><b> -&gt; </b></span> attester.party = <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:' + %practitioner.id<span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentEntityPractitioner<span style=\"color: navy\">(</span><span style=\"color: maroon\">entity</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span> <i>&quot;entity&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;attester&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;legalAuth&quot;</i><span style=\"color: navy\">;</span>\r\n  src.authenticator<b> as </b><span style=\"color: maroon\">auth</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\">'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\">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><b> then</b><span style=\"color: navy\"> {\r\n</span>    auth<span style=\"color: navy\"><b> -&gt; </b></span>tgt.attester<b> as </b><span style=\"color: maroon\">attester</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      auth<span style=\"color: navy\"><b> -&gt; </b></span>attester.mode = <span style=\"color: blue\">'official'</span> <i>&quot;mode&quot;</i><span style=\"color: navy\">;</span>\r\n      auth.time<b> as </b><span style=\"color: maroon\">time</span><span style=\"color: navy\"><b> -&gt; </b></span>attester.time = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'dateTime'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">dt</span><b> then </b>TSDateTime<span style=\"color: navy\">(</span><span style=\"color: maroon\">time</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">dt</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n      auth.assignedEntity<b> as </b><span style=\"color: maroon\">entity</span><span style=\"color: navy\"><b> -&gt; </b></span> attester.party = <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:' + %practitioner.id<span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentEntityPractitioner<span style=\"color: navy\">(</span><span style=\"color: maroon\">entity</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span> <i>&quot;entity&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;attester&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;auth&quot;</i><span style=\"color: navy\">;</span>\r\n  src.custodian<b> as </b><span style=\"color: maroon\">custodian</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>    custodian.assignedCustodian<b> as </b><span style=\"color: maroon\">assignedCustodian</span><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\">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\">uuid3</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\">uuid3</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      assignedCustodian.representedCustodianOrganization<b> as </b><span style=\"color: maroon\">srcOrg</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.custodian = <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><b> then </b>ClinicalDocumentOrganization<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcOrg</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>&quot;assignedCustodian&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;custodian&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;cust&quot;</i><span style=\"color: navy\">;</span>\r\n  src.documentationOf<b> as </b><span style=\"color: maroon\">docOf</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    docOf.serviceEvent<b> as </b><span style=\"color: maroon\">serviceEvent</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.event<b> as </b><span style=\"color: maroon\">event</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      serviceEvent.code<b> as </b><span style=\"color: maroon\">eventCode</span><span style=\"color: navy\"><b> -&gt; </b></span>event.code = <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\">cc</span><b> then </b>CDCodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">eventCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span> <i>&quot;eventCode&quot;</i><span style=\"color: navy\">;</span>\r\n      serviceEvent.effectiveTime<b> as </b><span style=\"color: maroon\">effectivetime</span><span style=\"color: navy\"><b> -&gt; </b></span>event.period = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Period'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">period</span><b> then </b>IVLTSPeriod<span style=\"color: navy\">(</span><span style=\"color: maroon\">effectivetime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">period</span><span style=\"color: navy\">)</span> <i>&quot;eventTime&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">performerType: for src.performer.typeCode ...</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;docOf&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  src.relatedDocument<b> as </b><span style=\"color: maroon\">relatedDoc</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.relatesTo<b> as </b><span style=\"color: maroon\">relates</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    relatedDoc.typeCode<b> as </b><span style=\"color: maroon\">typeCode</span><span style=\"color: navy\"><b> -&gt; </b></span>relates.code = <span style=\"color: maroon\">typeCode</span><span style=\"color: navy\">;</span>\r\n    relatedDoc.parentDocument<b> as </b><span style=\"color: maroon\">parentDoc</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      parentDoc.setId<b> as </b><span style=\"color: maroon\">sid</span><span style=\"color: navy\"><b> -&gt; </b></span>relates.targetIdentifier = <span style=\"color: maroon\">sid</span><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;parentDoc&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;relatedDoc&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ClinicalDocumentEntityPractitioner<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>AssignedEntity, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-practitioner'</span> <i>&quot;profile&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;meta&quot;</i><span style=\"color: navy\">;</span>\r\n  src.id<b> as </b><span style=\"color: maroon\">srcId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcId<span style=\"color: navy\"><b> -&gt; </b></span>identifier<b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span> <i>&quot;baseIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n    srcId<b> where </b>root = '1.2.250.1.71.4.2.1'<span style=\"color: navy\"><b> -&gt; </b></span>identifier.type = <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\">type</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcId<span style=\"color: navy\"><b> -&gt; </b></span>type.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        srcId<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203'</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n        srcId<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: blue\">'IDNPS'</span> <i>&quot;code&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;coding&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;idNatPs&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;identifier&quot;</i><span style=\"color: navy\">;</span>\r\n  src.addr<b> as </b><span style=\"color: maroon\">srcAddr</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.address = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Address'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">address</span><b> then </b>ADAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcAddr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">address</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.telecom<b> as </b><span style=\"color: maroon\">srcTelecom</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.telecom = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ContactPoint'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">contactPoint</span><b> then </b>TELContactPoint<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcTelecom</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">contactPoint</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.assignedPerson<b> as </b><span style=\"color: maroon\">person</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    person.name<b> as </b><span style=\"color: maroon\">pName</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.name = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'HumanName'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">humanName</span><b> then </b>ENHumanName<span style=\"color: navy\">(</span><span style=\"color: maroon\">pName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">humanName</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;name&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ClinicalDocumentOrganization<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>CustodianOrganization, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-organization'</span> <i>&quot;profile&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;meta&quot;</i><span style=\"color: navy\">;</span>\r\n  src.id<b> as </b><span style=\"color: maroon\">srcId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.name<b> as </b><span style=\"color: maroon\">v</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.name = <span style=\"color: navy\">(</span>v.other<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.telecom<b> as </b><span style=\"color: maroon\">srcTelecom</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.telecom = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ContactPoint'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">contactPoint</span><b> then </b>TELContactPoint<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcTelecom</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">contactPoint</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.addr<b> as </b><span style=\"color: maroon\">srcAddr</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.address = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Address'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">address</span><b> then </b>ADAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcAddr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">address</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ClinicalDocumentPatientRole<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>PatientRole, <b>target</b> <span style=\"color: maroon\">tgt</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>  <span style=\"color: #b36b00\" title=\"Cet élément nétait pas défini avant R5\">// src.id -&gt; tgt.identifier;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Patient.identifier.type for EPR context, because there is only the identifier &quot;LocalPid&quot; allowed, LocalPid requires an type -&gt; http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-patient-epr.html</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Modification NR</span>\r\n  src.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then </b>setFrPatientIdentifier<span style=\"color: navy\">(</span><span style=\"color: maroon\">id</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.addr<b> as </b><span style=\"color: maroon\">srcAddr</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.address = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Address'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">address</span><b> then </b>ADAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcAddr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">address</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.telecom<b> as </b><span style=\"color: maroon\">srcTelecom</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.telecom = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ContactPoint'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">contactPoint</span><b> then </b>TELContactPoint<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcTelecom</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">contactPoint</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.patient<b> as </b><span style=\"color: maroon\">patient</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    patient.name<b> as </b><span style=\"color: maroon\">patientName</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.name = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'HumanName'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">humanName</span><b> then </b>ENHumanName<span style=\"color: navy\">(</span><span style=\"color: maroon\">patientName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">humanName</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    patient.administrativeGenderCode<b> as </b><span style=\"color: maroon\">gender</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      gender.code<b> as </b><span style=\"color: maroon\">v</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.gender = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">v</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/ConceptMap/cm-v3-administrative-gender'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span> <i>&quot;gender&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;gender&quot;</i><span style=\"color: navy\">;</span>\r\n    patient.birthTime<b> as </b><span style=\"color: maroon\">birthTime</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.birthDate = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'date'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">date</span><b> then </b>TSDate<span style=\"color: navy\">(</span><span style=\"color: maroon\">birthTime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">date</span><span style=\"color: navy\">)</span> <i>&quot;birthDate&quot;</i><span style=\"color: navy\">;</span>\r\n    patient.deceasedInd<b> as </b><span style=\"color: maroon\">indicator</span><b> where </b>patient.deceasedTime.empty()<span style=\"color: navy\"><b> -&gt; </b></span>tgt.deceased = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'boolean'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">bool</span><b> then </b>boolean<span style=\"color: navy\">(</span><span style=\"color: maroon\">indicator</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bool</span><span style=\"color: navy\">)</span> <i>&quot;deceasedBL&quot;</i><span style=\"color: navy\">;</span>\r\n    patient.deceasedTime<b> as </b><span style=\"color: maroon\">dTime</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.deceased = <span style=\"color: maroon\">dTime</span><span style=\"color: navy\">;</span>\r\n    patient.maritalStatusCode<b> as </b><span style=\"color: maroon\">mStatus</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.maritalStatus = <span style=\"color: maroon\">mStatus</span> <i>&quot;maritalStatus&quot;</i><span style=\"color: navy\">;</span>\r\n    patient.languageCommunication<b> as </b><span style=\"color: maroon\">language</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.communication<b> as </b><span style=\"color: maroon\">communication</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      language.languageCode<b> as </b><span style=\"color: maroon\">lCode</span><span style=\"color: navy\"><b> -&gt; </b></span>communication.language = <span style=\"color: maroon\">lCode</span> <i>&quot;communication&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">preference: for language.preferenceInd make communication.preferred</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;language&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;patientrole&quot;</i><span style=\"color: navy\">;</span>\r\n  src.providerOrganization<b> as </b><span style=\"color: maroon\">org</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\">uuid3</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\">uuid3</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    org<span style=\"color: navy\"><b> -&gt; </b></span> tgt.managingOrganization = <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;reference&quot;</i><span style=\"color: navy\">;</span>\r\n    org.id<b> as </b><span style=\"color: maroon\">orgId</span><span style=\"color: navy\"><b> -&gt; </b></span>organization.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">orgId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    org.name<b> as </b><span style=\"color: maroon\">v</span><span style=\"color: navy\"><b> -&gt; </b></span>organization.name = <span style=\"color: navy\">(</span>v.other<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    org.telecom<b> as </b><span style=\"color: maroon\">orgTel</span><span style=\"color: navy\"><b> -&gt; </b></span>organization.telecom = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ContactPoint'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">contactPoint</span><b> then </b>TELContactPoint<span style=\"color: navy\">(</span><span style=\"color: maroon\">orgTel</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">contactPoint</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    org.addr<b> as </b><span style=\"color: maroon\">orgAddr</span><span style=\"color: navy\"><b> -&gt; </b></span>organization.address = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Address'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">address</span><b> then </b>ADAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">orgAddr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">address</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  <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><b>group </b>setFrPatientIdentifier<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">id</span><span style=\"color: navy\"> : </span>II, <b>target</b> <span style=\"color: maroon\">identifier</span><span style=\"color: navy\"> : </span>Identifier<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  id<span style=\"color: navy\"><b> -&gt; </b></span> identifier<span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system<b> as </b><span style=\"color: maroon\">system</span><span style=\"color: navy\">, </span> coding.code<b> as </b><span style=\"color: maroon\">code</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    <span style=\"color: navy\">// </span><span style=\"color: green\">src -&gt; system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203' &quot;system&quot;;</span>\r\n    <span style=\"color: navy\">// </span><span style=\"color: green\">INS-NIR - 1.2.250.1.213.1.4.8</span>\r\n    id<b> where </b>(id.root = '1.2.250.1.213.1.4.8')<span style=\"color: navy\"><b> -&gt; </b></span>system.value = <span style=\"color: blue\">'https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203'</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n    id<b> where </b>(id.root = '1.2.250.1.213.1.4.8')<span style=\"color: navy\"><b> -&gt; </b></span>code.value = <span style=\"color: blue\">'INS-NIR'</span> <i>&quot;code&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">// </span><span style=\"color: green\">IPP - 1.2.3.4.5.6.7.8.9.10</span>\r\n    id<b> where </b>(id.root = '1.2.3.4.5.6.7.8.9.10')<span style=\"color: navy\"><b> -&gt; </b></span>system.value = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n    id<b> where </b>(id.root = '1.2.3.4.5.6.7.8.9.10')<span style=\"color: navy\"><b> -&gt; </b></span>code.value = <span style=\"color: blue\">'PI'</span> <i>&quot;code&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;identifierType&quot;</i><span style=\"color: navy\">;</span>\r\n  id.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\"><b> -&gt; </b></span> identifier.value<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: maroon\">extension</span><span style=\"color: navy\">;</span>\r\n  id.root<b> as </b><span style=\"color: maroon\">root</span><span style=\"color: navy\"><b> -&gt; </b></span> identifier.system<b> as </b><span style=\"color: maroon\">system</span><span style=\"color: navy\">, </span> system.value = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:oid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">root</span><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\">Fin modification NR</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Etat initial</span>\r\n<span style=\"color: #b36b00\" title=\"Cet élément nétait pas défini avant R5\">// src -&gt; tgt.identifier as identifier then {</span>\r\n<span style=\"color: #b36b00\" title=\"Cet élément nétait pas défini avant R5\">// src.id as id -&gt; identifier.type as type, type.coding as coding, coding.system as system, coding.code as code then {</span>\r\n<span style=\"color: #b36b00\" title=\"Cet élément nétait pas défini avant R5\">// src -&gt; system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203' &quot;system&quot;;</span>\r\n<span style=\"color: #b36b00\" title=\"Cet élément nétait pas défini avant R5\">// src -&gt; code.value = 'MR' &quot;code&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">id.extension as extension -&gt; identifier.value as value, value.value = extension &quot;extension&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">id.root as root -&gt; identifier.system as system, system.value = append('urn:oid:', root) &quot;root&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">} &quot;id&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">} &quot;identifier&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Fin état initial</span>\r\n<b>group </b>ClinicalDocumentEncounter<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>EncompassingEncounter, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Encounter<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.id<b> as </b><span style=\"color: maroon\">Id</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">Id</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = <span style=\"color: blue\">'finished'</span> <i>&quot;status&quot;</i><span style=\"color: navy\">;</span>\r\n  src.code<b> as </b><span style=\"color: maroon\">srcCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.class = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcCode.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'string'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    srcCode.codeSystem<b> as </b><span style=\"color: maroon\">system</span><span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">system</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'http://hl7.org/fhir/ConceptMap/special-oid2uri'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'uri'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    srcCode.displayName<b> as </b><span style=\"color: maroon\">display</span><span style=\"color: navy\"><b> -&gt; </b></span>coding.display = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">display</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'string'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;class&quot;</i><span style=\"color: navy\">;</span>\r\n  src.code<b> as </b><span style=\"color: maroon\">srcCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.type = <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\">cc</span><b> then </b>CDCodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.effectiveTime<b> as </b><span style=\"color: maroon\">effTime</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.period = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Period'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">period</span><b> then </b>IVLTSPeriod<span style=\"color: navy\">(</span><span style=\"color: maroon\">effTime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">period</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src<b> where </b>admissionReferralSourceCode.exists() or dischargeDispositionCode.exists()<span style=\"color: navy\"><b> -&gt; </b></span>tgt.hospitalization<b> as </b><span style=\"color: maroon\">hosp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src.admissionReferralSourceCode<b> as </b><span style=\"color: maroon\">admRef</span><span style=\"color: navy\"><b> -&gt; </b></span>hosp.admitSource = <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\">cc</span><b> then </b>CDCodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">admRef</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span> <i>&quot;adminReferral&quot;</i><span style=\"color: navy\">;</span>\r\n    src.dischargeDispositionCode<b> as </b><span style=\"color: maroon\">discDispo</span><span style=\"color: navy\"><b> -&gt; </b></span>hosp.dischargeDisposition = <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\">cc</span><b> then </b>CDCodeableConcept<span style=\"color: navy\">(</span><span style=\"color: maroon\">discDispo</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span> <i>&quot;discDisposition&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;hospitalization&quot;</i><span style=\"color: navy\">;</span>\r\n  src.encounterParticipant<b> as </b><span style=\"color: maroon\">srcPart</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.participant<b> as </b><span style=\"color: maroon\">tgtPart</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcPart.typeCode<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtPart.type = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v3-ParticipationType'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">code</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    srcPart.time<b> as </b><span style=\"color: maroon\">srcTime</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtPart.period = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Period'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">period</span><b> then </b>IVLTSPeriod<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcTime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">period</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    srcPart.assignedEntity<b> as </b><span style=\"color: maroon\">entity</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\">'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\">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><b> then</b><span style=\"color: navy\"> {\r\n</span>      entity<span style=\"color: navy\"><b> -&gt; </b></span> tgtPart.individual = <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:' + %practitioner.id<span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentEntityPractitioner<span style=\"color: navy\">(</span><span style=\"color: maroon\">entity</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span> <i>&quot;entry&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;entity&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;participant&quot;</i><span style=\"color: navy\">;</span>\r\n  src.location<b> as </b><span style=\"color: maroon\">srcLocation</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcLocation.healthCareFacility<b> as </b><span style=\"color: maroon\">facility</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\">'Location'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">location</span><span style=\"color: navy\">, </span> location.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><b> then</b><span style=\"color: navy\"> {\r\n</span>      facility<span style=\"color: navy\"><b> -&gt; </b></span> tgt.location<b> as </b><span style=\"color: maroon\">tgtLocation</span><span style=\"color: navy\">, </span> tgtLocation.location = <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:' + %location.id<span style=\"color: navy\">)</span><b> then </b>ClinicalDocumentLocation<span style=\"color: navy\">(</span><span style=\"color: maroon\">facility</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">location</span><span style=\"color: navy\">)</span> <i>&quot;facLocation&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;facility&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><b>group </b>ClinicalDocumentLocation<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>HealthCareFacility, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Location<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.id<b> as </b><span style=\"color: maroon\">srcIdentifier</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then </b>II<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcIdentifier</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.code<b> as </b><span style=\"color: maroon\">srcCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.type = <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\">cc</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcCode.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\"><b> -&gt; </b></span>cc.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      code<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: maroon\">code</span> <i>&quot;code&quot;</i><span style=\"color: navy\">;</span>\r\n      code<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'https://mos.esante.gouv.fr/NOS/TRE_R02-SecteurActivite/FHIR/TRE-R02-SecteurActivite'</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n      srcCode.displayName<b> as </b><span style=\"color: maroon\">display</span><span style=\"color: navy\"><b> -&gt; </b></span>coding.display = <span style=\"color: maroon\">display</span> <i>&quot;display&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;coding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;locationType&quot;</i><span style=\"color: navy\">;</span>\r\n  src.location<b> as </b><span style=\"color: maroon\">location</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    <span style=\"color: navy\">// </span><span style=\"color: green\">place names are usually stored with no parts    location.name as srcName -&gt; tgt.name = cast(srcName, 'string');</span>\r\n    location.addr<b> as </b><span style=\"color: maroon\">locAddr</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.address = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Address'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">address</span><b> then </b>ADAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">locAddr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">address</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    location.serviceProviderOrganization<b> as </b><span style=\"color: maroon\">srcOrg</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\">uuid3</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\">uuid3</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcOrg<span style=\"color: navy\"><b> -&gt; </b></span> tgt.managingOrganization = <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><b> then </b>ClinicalDocumentOrganization<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcOrg</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> <i>&quot;org&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">place names are usually stored with no parts</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<b>group </b>NarrativeLink<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">url</span>, <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>  url<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/narrativeLink'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  url<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'url'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: maroon\">url</span> <i>&quot;value&quot;</i><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/CdaToBundle",
      "version" : "0.1.0",
      "name" : "CdaToBundle",
      "title" : "Mapping de CDA vers FHIR Bundle (A partir des sources de Oliver Egger)",
      "status" : "draft",
      "date" : "2025-11-07T10:30:30+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 CDA 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/AssignedAuthor",
          "mode" : "source",
          "alias" : "AssignedAuthor"
        },
        {
          "url" : "http://hl7.org/cda/stds/core/StructureDefinition/AssignedEntity",
          "mode" : "source",
          "alias" : "AssignedEntity"
        },
        {
          "url" : "http://hl7.org/cda/stds/core/StructureDefinition/CustodianOrganization",
          "mode" : "source",
          "alias" : "CustodianOrganization"
        },
        {
          "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/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/Organization",
          "mode" : "target",
          "alias" : "Organization"
        }
      ],
      "import" : [
        🔗 "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToFHIRTypes"
      ],
      "group" : [
        {
          "name" : "CdaToBundle",
          "typeMode" : "none",
          "documentation" : "_________________________ Document Level Template  _________________________",
          "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"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "cdatobundle",
                  "source" : [
                    {
                      "context" : "cda"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ClinicalDocumentToBundle",
                      "variable" : [
                        "cda",
                        "patient",
                        "composition",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentToBundle",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "cda",
              "type" : "ClinicalDocument",
              "mode" : "source"
            },
            {
              "name" : "patient",
              "type" : "Patient",
              "mode" : "target"
            },
            {
              "name" : "composition",
              "type" : "Composition",
              "mode" : "target"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "id",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "identifier",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "id",
                  "variable" : "cdaId"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                }
              ],
              "rule" : [
                {
                  "name" : "system",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "root",
                      "variable" : "root",
                      "condition" : "cdaId.extension.exists()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "root"
                        },
                        {
                          "valueString" : "#oid2uri"
                        },
                        {
                          "valueString" : "uri"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "value",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "extension",
                      "variable" : "extension"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "extension"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "systemOid",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "root",
                      "variable" : "root",
                      "condition" : "cdaId.extension.empty()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "urn:ietf:rfc:3986"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "valueOid",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "root",
                      "variable" : "root",
                      "condition" : "cdaId.extension.empty()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:oid:"
                        },
                        {
                          "valueId" : "root"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "type",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "type",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "document"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "timestamp",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "timestamp",
                  "variable" : "timestamp",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "instant"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TSInstant",
                  "variable" : [
                    "effectiveTime",
                    "timestamp"
                  ]
                }
              ]
            },
            {
              "name" : "composition",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "dependent" : [
                {
                  "name" : "ClinicalDocumentComposition",
                  "variable" : [
                    "cda",
                    "composition",
                    "patient",
                    "bundle"
                  ]
                }
              ]
            },
            {
              "name" : "cdaComponent",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "component",
                  "variable" : "cdaComponent"
                }
              ],
              "rule" : [
                {
                  "name" : "body",
                  "source" : [
                    {
                      "context" : "cdaComponent",
                      "element" : "structuredBody",
                      "variable" : "body"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "bodyComponent",
                      "source" : [
                        {
                          "context" : "body",
                          "element" : "component",
                          "variable" : "bodyComponent"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "section",
                          "source" : [
                            {
                              "context" : "bodyComponent",
                              "element" : "section",
                              "variable" : "srcSection",
                              "condition" : "$this.code.empty()"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "composition",
                              "contextType" : "variable",
                              "element" : "section",
                              "variable" : "tgtSection"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "ClinicalDocumentSection",
                              "variable" : [
                                "cda",
                                "srcSection",
                                "patient",
                                "tgtSection",
                                "bundle"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentSection",
          "typeMode" : "none",
          "documentation" : "// _________________________ Section Level Templates _________________________",
          "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" : "title",
              "source" : [
                {
                  "context" : "src",
                  "element" : "title",
                  "variable" : "t"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "title",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "t.xmlText"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "srcCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "srcCode"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "cdaText",
              "source" : [
                {
                  "context" : "src",
                  "element" : "text",
                  "variable" : "cdaText"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "text",
                  "variable" : "fhirText"
                }
              ],
              "rule" : [
                {
                  "name" : "narrativeStatus",
                  "source" : [
                    {
                      "context" : "cdaText"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "fhirText",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "generated"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "narrativeText",
                  "source" : [
                    {
                      "context" : "cdaText",
                      "variable" : "t"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "fhirText",
                      "contextType" : "variable",
                      "element" : "div",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "t"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "section",
              "source" : [
                {
                  "context" : "src",
                  "element" : "section",
                  "variable" : "srcSection"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "section",
                  "variable" : "tgtSection"
                }
              ],
              "dependent" : [
                {
                  "name" : "ClinicalDocumentSection",
                  "variable" : [
                    "cda",
                    "srcSection",
                    "patient",
                    "tgtSection",
                    "bundle"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentComposition",
          "typeMode" : "none",
          "documentation" : "_________________________ Entry Level Templates   ________________________\r\n_________________________ Header Level Templates _________________________",
          "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" : "languageCode",
              "source" : [
                {
                  "context" : "src",
                  "element" : "languageCode",
                  "variable" : "languageCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "language",
                  "variable" : "code",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CSCode",
                  "variable" : [
                    "languageCode",
                    "code"
                  ]
                }
              ]
            },
            {
              "name" : "identifier",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "id",
                  "condition" : "src.setId.exists().not()"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Identifier"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "II",
                  "variable" : [
                    "id",
                    "identifier"
                  ]
                }
              ]
            },
            {
              "name" : "setIdentifier",
              "source" : [
                {
                  "context" : "src",
                  "element" : "setId",
                  "variable" : "setId"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Identifier"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "II",
                  "variable" : [
                    "setId",
                    "identifier"
                  ]
                }
              ]
            },
            {
              "name" : "status",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "final"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "srcCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "cc",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CDCodeableConcept",
                  "variable" : [
                    "srcCode",
                    "cc"
                  ]
                }
              ]
            },
            {
              "name" : "title",
              "source" : [
                {
                  "context" : "src",
                  "element" : "title",
                  "variable" : "t"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "title",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "t.xmlText"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "patientRole",
              "source" : [
                {
                  "context" : "src",
                  "element" : "recordTarget",
                  "variable" : "recordTarget"
                }
              ],
              "rule" : [
                {
                  "name" : "subject",
                  "source" : [
                    {
                      "context" : "recordTarget",
                      "element" : "patientRole",
                      "variable" : "patient"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "subject",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %patientResource.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ClinicalDocumentPatientRole",
                      "variable" : [
                        "patient",
                        "patientResource",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "encompassingEncounter",
              "source" : [
                {
                  "context" : "src",
                  "element" : "componentOf",
                  "variable" : "comp"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "encounter",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Encounter"
                    }
                  ]
                },
                {
                  "context" : "encounter",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "srcEncounter",
                  "source" : [
                    {
                      "context" : "comp",
                      "element" : "encompassingEncounter",
                      "variable" : "srcEnc"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "encounter",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %encounter.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ClinicalDocumentEncounter",
                      "variable" : [
                        "srcEnc",
                        "bundle",
                        "encounter"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "compositionDate",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "date",
                  "variable" : "date",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "dateTime"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TSDateTime",
                  "variable" : [
                    "effectiveTime",
                    "date"
                  ]
                }
              ]
            },
            {
              "name" : "srcAuthor",
              "source" : [
                {
                  "context" : "src",
                  "element" : "author",
                  "variable" : "srcAuthor"
                }
              ],
              "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" : "uuid2",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid2"
                    }
                  ]
                },
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "eRole"
                },
                {
                  "context" : "eRole",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitionerRole",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "PractitionerRole"
                    }
                  ]
                },
                {
                  "context" : "practitionerRole",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuidRole",
                  "transform" : "uuid"
                },
                {
                  "context" : "eRole",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuidRole"
                    }
                  ]
                },
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "author",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %practitionerRole.id"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "practitionerMeta",
                  "source" : [
                    {
                      "context" : "srcAuthor"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitioner",
                      "contextType" : "variable",
                      "element" : "meta",
                      "variable" : "meta",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Meta"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "practitionerProfile",
                      "source" : [
                        {
                          "context" : "srcAuthor"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "meta",
                          "contextType" : "variable",
                          "element" : "profile",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-practitioner"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "practitionerRoleMeta",
                  "source" : [
                    {
                      "context" : "srcAuthor"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitionerRole",
                      "contextType" : "variable",
                      "element" : "meta",
                      "variable" : "metaRole",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Meta"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "practitionerRoleProfile",
                      "source" : [
                        {
                          "context" : "srcAuthor"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "metaRole",
                          "contextType" : "variable",
                          "element" : "profile",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-practitionerrole"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "practitionerRef",
                  "source" : [
                    {
                      "context" : "srcAuthor"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitionerRole",
                      "contextType" : "variable",
                      "element" : "practitioner",
                      "variable" : "refPract",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "refPract",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %practitioner.id"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "author",
                  "source" : [
                    {
                      "context" : "srcAuthor",
                      "element" : "assignedAuthor",
                      "variable" : "assignedAuthor"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "identifier",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "id",
                          "variable" : "id"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "identifier",
                          "variable" : "identifier",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Identifier"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "baseIdentifier",
                          "source" : [
                            {
                              "context" : "id"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "II",
                              "variable" : [
                                "id",
                                "identifier"
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "idNatPs",
                          "source" : [
                            {
                              "context" : "id",
                              "condition" : "root = '1.2.250.1.71.4.2.1'"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "type",
                              "variable" : "type",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "CodeableConcept"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "coding",
                              "source" : [
                                {
                                  "context" : "id"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "type",
                                  "contextType" : "variable",
                                  "element" : "coding",
                                  "variable" : "coding",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Coding"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "system",
                                  "source" : [
                                    {
                                      "context" : "id"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "system",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "code",
                                  "source" : [
                                    {
                                      "context" : "id"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "code",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "IDNPS"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "addr",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "addr",
                          "variable" : "addr"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "address",
                          "variable" : "address",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Address"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ADAddress",
                          "variable" : [
                            "addr",
                            "address"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "telecom",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "telecom",
                          "variable" : "tlc"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "telecom",
                          "variable" : "contactPoint",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "ContactPoint"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "TELContactPoint",
                          "variable" : [
                            "tlc",
                            "contactPoint"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "name",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "assignedPerson",
                          "variable" : "assPerson"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "name",
                          "source" : [
                            {
                              "context" : "assPerson",
                              "element" : "name",
                              "variable" : "pName"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "practitioner",
                              "contextType" : "variable",
                              "element" : "name",
                              "variable" : "humanName",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "HumanName"
                                }
                              ]
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "ENHumanName",
                              "variable" : [
                                "pName",
                                "humanName"
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "roleCode",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "code",
                          "variable" : "roleCode"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitionerRole",
                          "contextType" : "variable",
                          "element" : "code",
                          "variable" : "cc",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "CDCodeableConcept",
                          "variable" : [
                            "roleCode",
                            "cc"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "savoirFaire",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "code",
                          "variable" : "roleCode",
                          "condition" : "code.contains('/')"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "qualification",
                          "variable" : "qualification"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "qualCode",
                          "source" : [
                            {
                              "context" : "roleCode"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "qualification",
                              "contextType" : "variable",
                              "element" : "code",
                              "variable" : "qualCode",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "CodeableConcept"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "coding",
                              "source" : [
                                {
                                  "context" : "roleCode",
                                  "element" : "code",
                                  "variable" : "fullCode"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "qualCode",
                                  "contextType" : "variable",
                                  "element" : "coding",
                                  "variable" : "coding",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Coding"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "savoirFaireCode",
                                  "source" : [
                                    {
                                      "context" : "fullCode"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "code",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "%fullCode.substring(%fullCode.indexOf('/') + 1)"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "systemSavoirFaire",
                                  "source" : [
                                    {
                                      "context" : "fullCode"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "system",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "https://mos.esante.gouv.fr/NOS/TRE_R38-SpecialiteOrdinale/FHIR/TRE-R38-SpecialiteOrdinale"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "display",
                                  "source" : [
                                    {
                                      "context" : "roleCode",
                                      "element" : "displayName",
                                      "variable" : "display"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "display",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "display"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "profession",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "code",
                          "variable" : "roleCode",
                          "condition" : "code.contains('/') and code.contains('_')"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "qualification",
                          "variable" : "qualification"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "qualCode",
                          "source" : [
                            {
                              "context" : "roleCode"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "qualification",
                              "contextType" : "variable",
                              "element" : "code",
                              "variable" : "qualCode",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "CodeableConcept"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "coding",
                              "source" : [
                                {
                                  "context" : "roleCode",
                                  "element" : "code",
                                  "variable" : "fullCode"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "qualCode",
                                  "contextType" : "variable",
                                  "element" : "coding",
                                  "variable" : "coding",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Coding"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "professionCode",
                                  "source" : [
                                    {
                                      "context" : "fullCode"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "code",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "%fullCode.substring(%fullCode.indexOf('_') + 1).substring(0, %fullCode.substring(%fullCode.indexOf('_') + 1).indexOf('/'))"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "systemProfession",
                                  "source" : [
                                    {
                                      "context" : "fullCode"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "system",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "https://mos.esante.gouv.fr/NOS/TRE_G15-ProfessionSante/FHIR/TRE-G15-ProfessionSante"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "displayMedecin",
                                  "source" : [
                                    {
                                      "context" : "fullCode",
                                      "condition" : "%fullCode.substring(%fullCode.indexOf('_') + 1).substring(0, %fullCode.substring(%fullCode.indexOf('_') + 1).indexOf('/')) = '10'"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "coding",
                                      "contextType" : "variable",
                                      "element" : "display",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "Médecin"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "representedOrganization",
                      "source" : [
                        {
                          "context" : "assignedAuthor",
                          "element" : "representedOrganization",
                          "variable" : "srcOrg"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "bundle",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "e2"
                        },
                        {
                          "context" : "e2",
                          "contextType" : "variable",
                          "element" : "resource",
                          "variable" : "organization",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Organization"
                            }
                          ]
                        },
                        {
                          "context" : "organization",
                          "contextType" : "variable",
                          "element" : "id",
                          "variable" : "uuid3",
                          "transform" : "uuid"
                        },
                        {
                          "context" : "e2",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "urn:uuid:"
                            },
                            {
                              "valueId" : "uuid3"
                            }
                          ]
                        },
                        {
                          "context" : "practitionerRole",
                          "contextType" : "variable",
                          "element" : "organization",
                          "variable" : "refOrg",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "refOrg",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %organization.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ClinicalDocumentOrganization",
                          "variable" : [
                            "srcOrg",
                            "organization"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "informant",
              "source" : [
                {
                  "context" : "src",
                  "element" : "informant",
                  "variable" : "srcInformant"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "relatedPerson",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "RelatedPerson"
                    }
                  ]
                },
                {
                  "context" : "relatedPerson",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuidRelated",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuidRelated"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "relatedEntity",
                  "source" : [
                    {
                      "context" : "srcInformant",
                      "element" : "relatedEntity",
                      "variable" : "relatedEntity"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "patientRef",
                      "source" : [
                        {
                          "context" : "relatedEntity"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "relatedPerson",
                          "contextType" : "variable",
                          "element" : "patient",
                          "variable" : "patientRef",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "patientRef",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %patientResource.id"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "relationship",
                      "source" : [
                        {
                          "context" : "relatedEntity",
                          "element" : "code",
                          "variable" : "relationCode"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "relatedPerson",
                          "contextType" : "variable",
                          "element" : "relationship",
                          "variable" : "cc",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "CDCodeableConcept",
                          "variable" : [
                            "relationCode",
                            "cc"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "address",
                      "source" : [
                        {
                          "context" : "relatedEntity",
                          "element" : "addr",
                          "variable" : "addr"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "relatedPerson",
                          "contextType" : "variable",
                          "element" : "address",
                          "variable" : "address",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Address"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ADAddress",
                          "variable" : [
                            "addr",
                            "address"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "telecom",
                      "source" : [
                        {
                          "context" : "relatedEntity",
                          "element" : "telecom",
                          "variable" : "tlc"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "relatedPerson",
                          "contextType" : "variable",
                          "element" : "telecom",
                          "variable" : "contactPoint",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "ContactPoint"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "TELContactPoint",
                          "variable" : [
                            "tlc",
                            "contactPoint"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "relatedPersonName",
                      "source" : [
                        {
                          "context" : "relatedEntity",
                          "element" : "relatedPerson",
                          "variable" : "relPerson"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "name",
                          "source" : [
                            {
                              "context" : "relPerson",
                              "element" : "name",
                              "variable" : "pName"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "relatedPerson",
                              "contextType" : "variable",
                              "element" : "name",
                              "variable" : "humanName",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "HumanName"
                                }
                              ]
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "ENHumanName",
                              "variable" : [
                                "pName",
                                "humanName"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "confidentialityCode",
              "source" : [
                {
                  "context" : "src",
                  "element" : "confidentialityCode",
                  "variable" : "confCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "confidentiality",
                  "variable" : "code",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CSCode",
                  "variable" : [
                    "confCode",
                    "code"
                  ]
                }
              ]
            },
            {
              "name" : "legalAuth",
              "source" : [
                {
                  "context" : "src",
                  "element" : "legalAuthenticator",
                  "variable" : "legalAuth"
                }
              ],
              "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" : "uuid2",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid2"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "attester",
                  "source" : [
                    {
                      "context" : "legalAuth"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "attester",
                      "variable" : "attester"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "mode",
                      "source" : [
                        {
                          "context" : "legalAuth"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "attester",
                          "contextType" : "variable",
                          "element" : "mode",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "legal"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "time",
                      "source" : [
                        {
                          "context" : "legalAuth",
                          "element" : "time",
                          "variable" : "time"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "attester",
                          "contextType" : "variable",
                          "element" : "time",
                          "variable" : "dt",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "dateTime"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "TSDateTime",
                          "variable" : [
                            "time",
                            "dt"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "entity",
                      "source" : [
                        {
                          "context" : "legalAuth",
                          "element" : "assignedEntity",
                          "variable" : "entity"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "attester",
                          "contextType" : "variable",
                          "element" : "party",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %practitioner.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ClinicalDocumentEntityPractitioner",
                          "variable" : [
                            "entity",
                            "practitioner"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "auth",
              "source" : [
                {
                  "context" : "src",
                  "element" : "authenticator",
                  "variable" : "auth"
                }
              ],
              "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" : "uuid2",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid2"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "attester",
                  "source" : [
                    {
                      "context" : "auth"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "attester",
                      "variable" : "attester"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "mode",
                      "source" : [
                        {
                          "context" : "auth"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "attester",
                          "contextType" : "variable",
                          "element" : "mode",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "official"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "time",
                      "source" : [
                        {
                          "context" : "auth",
                          "element" : "time",
                          "variable" : "time"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "attester",
                          "contextType" : "variable",
                          "element" : "time",
                          "variable" : "dt",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "dateTime"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "TSDateTime",
                          "variable" : [
                            "time",
                            "dt"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "entity",
                      "source" : [
                        {
                          "context" : "auth",
                          "element" : "assignedEntity",
                          "variable" : "entity"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "attester",
                          "contextType" : "variable",
                          "element" : "party",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %practitioner.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ClinicalDocumentEntityPractitioner",
                          "variable" : [
                            "entity",
                            "practitioner"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "cust",
              "source" : [
                {
                  "context" : "src",
                  "element" : "custodian",
                  "variable" : "custodian"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                }
              ],
              "rule" : [
                {
                  "name" : "custodian",
                  "source" : [
                    {
                      "context" : "custodian",
                      "element" : "assignedCustodian",
                      "variable" : "assignedCustodian"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "organization",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Organization"
                        }
                      ]
                    },
                    {
                      "context" : "organization",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid3",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid3"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "assignedCustodian",
                      "source" : [
                        {
                          "context" : "assignedCustodian",
                          "element" : "representedCustodianOrganization",
                          "variable" : "srcOrg"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "custodian",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %organization.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ClinicalDocumentOrganization",
                          "variable" : [
                            "srcOrg",
                            "organization"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "documentationOf",
              "source" : [
                {
                  "context" : "src",
                  "element" : "documentationOf",
                  "variable" : "docOf"
                }
              ],
              "rule" : [
                {
                  "name" : "docOf",
                  "source" : [
                    {
                      "context" : "docOf",
                      "element" : "serviceEvent",
                      "variable" : "serviceEvent"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "event",
                      "variable" : "event"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "eventCode",
                      "source" : [
                        {
                          "context" : "serviceEvent",
                          "element" : "code",
                          "variable" : "eventCode"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "event",
                          "contextType" : "variable",
                          "element" : "code",
                          "variable" : "cc",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "CDCodeableConcept",
                          "variable" : [
                            "eventCode",
                            "cc"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "eventTime",
                      "source" : [
                        {
                          "context" : "serviceEvent",
                          "element" : "effectiveTime",
                          "variable" : "effectivetime"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "event",
                          "contextType" : "variable",
                          "element" : "period",
                          "variable" : "period",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Period"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "IVLTSPeriod",
                          "variable" : [
                            "effectivetime",
                            "period"
                          ]
                        }
                      ],
                      "documentation" : "performerType: for src.performer.typeCode ..."
                    }
                  ]
                }
              ]
            },
            {
              "name" : "relatedDoc",
              "source" : [
                {
                  "context" : "src",
                  "element" : "relatedDocument",
                  "variable" : "relatedDoc"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "relatesTo",
                  "variable" : "relates"
                }
              ],
              "rule" : [
                {
                  "name" : "typeCode",
                  "source" : [
                    {
                      "context" : "relatedDoc",
                      "element" : "typeCode",
                      "variable" : "typeCode"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "relates",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "typeCode"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "parentDoc",
                  "source" : [
                    {
                      "context" : "relatedDoc",
                      "element" : "parentDocument",
                      "variable" : "parentDoc"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "setId",
                      "source" : [
                        {
                          "context" : "parentDoc",
                          "element" : "setId",
                          "variable" : "sid"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "relates",
                          "contextType" : "variable",
                          "element" : "targetIdentifier",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "sid"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentEntityPractitioner",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "src",
              "type" : "AssignedEntity",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "type" : "Practitioner",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "meta",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "meta",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Meta"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "profile",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "meta",
                      "contextType" : "variable",
                      "element" : "profile",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-practitioner"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "identifier",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "srcId"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Identifier"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "baseIdentifier",
                  "source" : [
                    {
                      "context" : "srcId"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "II",
                      "variable" : [
                        "srcId",
                        "identifier"
                      ]
                    }
                  ]
                },
                {
                  "name" : "idNatPs",
                  "source" : [
                    {
                      "context" : "srcId",
                      "condition" : "root = '1.2.250.1.71.4.2.1'"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "type",
                      "variable" : "type",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "CodeableConcept"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "coding",
                      "source" : [
                        {
                          "context" : "srcId"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "type",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "coding",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Coding"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "system",
                          "source" : [
                            {
                              "context" : "srcId"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "code",
                          "source" : [
                            {
                              "context" : "srcId"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "code",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "IDNPS"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "addr",
              "source" : [
                {
                  "context" : "src",
                  "element" : "addr",
                  "variable" : "srcAddr"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "address",
                  "variable" : "address",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Address"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "ADAddress",
                  "variable" : [
                    "srcAddr",
                    "address"
                  ]
                }
              ]
            },
            {
              "name" : "telecom",
              "source" : [
                {
                  "context" : "src",
                  "element" : "telecom",
                  "variable" : "srcTelecom"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "contactPoint",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "ContactPoint"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TELContactPoint",
                  "variable" : [
                    "srcTelecom",
                    "contactPoint"
                  ]
                }
              ]
            },
            {
              "name" : "name",
              "source" : [
                {
                  "context" : "src",
                  "element" : "assignedPerson",
                  "variable" : "person"
                }
              ],
              "rule" : [
                {
                  "name" : "name",
                  "source" : [
                    {
                      "context" : "person",
                      "element" : "name",
                      "variable" : "pName"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "name",
                      "variable" : "humanName",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "HumanName"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ENHumanName",
                      "variable" : [
                        "pName",
                        "humanName"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentOrganization",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "src",
              "type" : "CustodianOrganization",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "type" : "Organization",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "meta",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "meta",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Meta"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "profile",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "meta",
                      "contextType" : "variable",
                      "element" : "profile",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://interop.esante.gouv.fr/ig/fhir/annuaire/StructureDefinition/as-organization"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "id",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "srcId"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Identifier"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "II",
                  "variable" : [
                    "srcId",
                    "identifier"
                  ]
                }
              ]
            },
            {
              "name" : "name",
              "source" : [
                {
                  "context" : "src",
                  "element" : "name",
                  "variable" : "v"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "v.other"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "telecom",
              "source" : [
                {
                  "context" : "src",
                  "element" : "telecom",
                  "variable" : "srcTelecom"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "contactPoint",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "ContactPoint"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TELContactPoint",
                  "variable" : [
                    "srcTelecom",
                    "contactPoint"
                  ]
                }
              ]
            },
            {
              "name" : "addr",
              "source" : [
                {
                  "context" : "src",
                  "element" : "addr",
                  "variable" : "srcAddr"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "address",
                  "variable" : "address",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Address"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "ADAddress",
                  "variable" : [
                    "srcAddr",
                    "address"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentPatientRole",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "src",
              "type" : "PatientRole",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "type" : "Patient",
              "mode" : "target"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "id",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "id"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Identifier"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setFrPatientIdentifier",
                  "variable" : [
                    "id",
                    "identifier"
                  ]
                }
              ]
            },
            {
              "name" : "addr",
              "source" : [
                {
                  "context" : "src",
                  "element" : "addr",
                  "variable" : "srcAddr"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "address",
                  "variable" : "address",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Address"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "ADAddress",
                  "variable" : [
                    "srcAddr",
                    "address"
                  ]
                }
              ]
            },
            {
              "name" : "telecom",
              "source" : [
                {
                  "context" : "src",
                  "element" : "telecom",
                  "variable" : "srcTelecom"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "contactPoint",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "ContactPoint"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TELContactPoint",
                  "variable" : [
                    "srcTelecom",
                    "contactPoint"
                  ]
                }
              ]
            },
            {
              "name" : "patientrole",
              "source" : [
                {
                  "context" : "src",
                  "element" : "patient",
                  "variable" : "patient"
                }
              ],
              "rule" : [
                {
                  "name" : "name",
                  "source" : [
                    {
                      "context" : "patient",
                      "element" : "name",
                      "variable" : "patientName"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "name",
                      "variable" : "humanName",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "HumanName"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ENHumanName",
                      "variable" : [
                        "patientName",
                        "humanName"
                      ]
                    }
                  ]
                },
                {
                  "name" : "gender",
                  "source" : [
                    {
                      "context" : "patient",
                      "element" : "administrativeGenderCode",
                      "variable" : "gender"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "gender",
                      "source" : [
                        {
                          "context" : "gender",
                          "element" : "code",
                          "variable" : "v"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "gender",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "v"
                            },
                            {
                              "valueString" : "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/ConceptMap/cm-v3-administrative-gender"
                            },
                            {
                              "valueString" : "code"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "birthDate",
                  "source" : [
                    {
                      "context" : "patient",
                      "element" : "birthTime",
                      "variable" : "birthTime"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "birthDate",
                      "variable" : "date",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "date"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "TSDate",
                      "variable" : [
                        "birthTime",
                        "date"
                      ]
                    }
                  ]
                },
                {
                  "name" : "deceasedBL",
                  "source" : [
                    {
                      "context" : "patient",
                      "element" : "deceasedInd",
                      "variable" : "indicator",
                      "condition" : "patient.deceasedTime.empty()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "deceased",
                      "variable" : "bool",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "boolean"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "boolean",
                      "variable" : [
                        "indicator",
                        "bool"
                      ]
                    }
                  ]
                },
                {
                  "name" : "deceasedTime",
                  "source" : [
                    {
                      "context" : "patient",
                      "element" : "deceasedTime",
                      "variable" : "dTime"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "deceased",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "dTime"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "maritalStatus",
                  "source" : [
                    {
                      "context" : "patient",
                      "element" : "maritalStatusCode",
                      "variable" : "mStatus"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "maritalStatus",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "mStatus"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "language",
                  "source" : [
                    {
                      "context" : "patient",
                      "element" : "languageCommunication",
                      "variable" : "language"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "communication",
                      "variable" : "communication"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "communication",
                      "source" : [
                        {
                          "context" : "language",
                          "element" : "languageCode",
                          "variable" : "lCode"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "communication",
                          "contextType" : "variable",
                          "element" : "language",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "lCode"
                            }
                          ]
                        }
                      ],
                      "documentation" : "preference: for language.preferenceInd make communication.preferred"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "organization",
              "source" : [
                {
                  "context" : "src",
                  "element" : "providerOrganization",
                  "variable" : "org"
                }
              ],
              "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" : "uuid3",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid3"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "reference",
                  "source" : [
                    {
                      "context" : "org"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "managingOrganization",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %organization.id"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "id",
                  "source" : [
                    {
                      "context" : "org",
                      "element" : "id",
                      "variable" : "orgId"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "organization",
                      "contextType" : "variable",
                      "element" : "identifier",
                      "variable" : "identifier",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Identifier"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "II",
                      "variable" : [
                        "orgId",
                        "identifier"
                      ]
                    }
                  ]
                },
                {
                  "name" : "name",
                  "source" : [
                    {
                      "context" : "org",
                      "element" : "name",
                      "variable" : "v"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "organization",
                      "contextType" : "variable",
                      "element" : "name",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "v.other"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "telecom",
                  "source" : [
                    {
                      "context" : "org",
                      "element" : "telecom",
                      "variable" : "orgTel"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "organization",
                      "contextType" : "variable",
                      "element" : "telecom",
                      "variable" : "contactPoint",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "ContactPoint"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "TELContactPoint",
                      "variable" : [
                        "orgTel",
                        "contactPoint"
                      ]
                    }
                  ]
                },
                {
                  "name" : "addr",
                  "source" : [
                    {
                      "context" : "org",
                      "element" : "addr",
                      "variable" : "orgAddr"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "organization",
                      "contextType" : "variable",
                      "element" : "address",
                      "variable" : "address",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Address"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ADAddress",
                      "variable" : [
                        "orgAddr",
                        "address"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setFrPatientIdentifier",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "id",
              "type" : "II",
              "mode" : "source"
            },
            {
              "name" : "identifier",
              "type" : "Identifier",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "identifierType",
              "source" : [
                {
                  "context" : "id"
                }
              ],
              "target" : [
                {
                  "context" : "identifier",
                  "contextType" : "variable"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "type"
                },
                {
                  "context" : "type",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "variable" : "system"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "variable" : "code"
                }
              ],
              "rule" : [
                {
                  "name" : "system",
                  "source" : [
                    {
                      "context" : "id",
                      "condition" : "(id.root = '1.2.250.1.213.1.4.8')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "system",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "id",
                      "condition" : "(id.root = '1.2.250.1.213.1.4.8')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "code",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "INS-NIR"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "system",
                  "source" : [
                    {
                      "context" : "id",
                      "condition" : "(id.root = '1.2.3.4.5.6.7.8.9.10')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "system",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://terminology.hl7.org/CodeSystem/v2-0203"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "id",
                      "condition" : "(id.root = '1.2.3.4.5.6.7.8.9.10')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "code",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "PI"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "extension",
              "source" : [
                {
                  "context" : "id",
                  "element" : "extension",
                  "variable" : "extension"
                }
              ],
              "target" : [
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "value"
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "extension"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "root",
              "source" : [
                {
                  "context" : "id",
                  "element" : "root",
                  "variable" : "root"
                }
              ],
              "target" : [
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "system",
                  "variable" : "system"
                },
                {
                  "context" : "system",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:oid:"
                    },
                    {
                      "valueId" : "root"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentEncounter",
          "typeMode" : "none",
          "documentation" : "Fin modification NR\r\nEtat initial\r\nsrc -> tgt.identifier as identifier then {\r\nsrc.id as id -> identifier.type as type, type.coding as coding, coding.system as system, coding.code as code then {\r\nsrc -> system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203' \"system\";\r\nsrc -> code.value = 'MR' \"code\";\r\nid.extension as extension -> identifier.value as value, value.value = extension \"extension\";\r\nid.root as root -> identifier.system as system, system.value = append('urn:oid:', root) \"root\";\r\n} \"id\";\r\n} \"identifier\";\r\nFin état initial",
          "input" : [
            {
              "name" : "src",
              "type" : "EncompassingEncounter",
              "mode" : "source"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            },
            {
              "name" : "tgt",
              "type" : "Encounter",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "id",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "Id"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Identifier"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "II",
                  "variable" : [
                    "Id",
                    "identifier"
                  ]
                }
              ]
            },
            {
              "name" : "status",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "finished"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "class",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "srcCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "class",
                  "variable" : "coding",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Coding"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "srcCode",
                      "element" : "code",
                      "variable" : "code"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "cast",
                      "parameter" : [
                        {
                          "valueId" : "code"
                        },
                        {
                          "valueString" : "string"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "codeSystem",
                  "source" : [
                    {
                      "context" : "srcCode",
                      "element" : "codeSystem",
                      "variable" : "system"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "system"
                        },
                        {
                          "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                        },
                        {
                          "valueString" : "uri"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "displayName",
                  "source" : [
                    {
                      "context" : "srcCode",
                      "element" : "displayName",
                      "variable" : "display"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "cast",
                      "parameter" : [
                        {
                          "valueId" : "display"
                        },
                        {
                          "valueString" : "string"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "srcCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "cc",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CDCodeableConcept",
                  "variable" : [
                    "srcCode",
                    "cc"
                  ]
                }
              ]
            },
            {
              "name" : "effectiveTime",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effTime"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "period",
                  "variable" : "period",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "IVLTSPeriod",
                  "variable" : [
                    "effTime",
                    "period"
                  ]
                }
              ]
            },
            {
              "name" : "hospitalization",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "admissionReferralSourceCode.exists() or dischargeDispositionCode.exists()"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "hospitalization",
                  "variable" : "hosp"
                }
              ],
              "rule" : [
                {
                  "name" : "adminReferral",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "admissionReferralSourceCode",
                      "variable" : "admRef"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "hosp",
                      "contextType" : "variable",
                      "element" : "admitSource",
                      "variable" : "cc",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "CodeableConcept"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "CDCodeableConcept",
                      "variable" : [
                        "admRef",
                        "cc"
                      ]
                    }
                  ]
                },
                {
                  "name" : "discDisposition",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "dischargeDispositionCode",
                      "variable" : "discDispo"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "hosp",
                      "contextType" : "variable",
                      "element" : "dischargeDisposition",
                      "variable" : "cc",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "CodeableConcept"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "CDCodeableConcept",
                      "variable" : [
                        "discDispo",
                        "cc"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "participant",
              "source" : [
                {
                  "context" : "src",
                  "element" : "encounterParticipant",
                  "variable" : "srcPart"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "participant",
                  "variable" : "tgtPart"
                }
              ],
              "rule" : [
                {
                  "name" : "typeCode",
                  "source" : [
                    {
                      "context" : "srcPart",
                      "element" : "typeCode",
                      "variable" : "code"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtPart",
                      "contextType" : "variable",
                      "element" : "type",
                      "transform" : "cc",
                      "parameter" : [
                        {
                          "valueString" : "http://terminology.hl7.org/CodeSystem/v3-ParticipationType"
                        },
                        {
                          "valueId" : "code"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "time",
                  "source" : [
                    {
                      "context" : "srcPart",
                      "element" : "time",
                      "variable" : "srcTime"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtPart",
                      "contextType" : "variable",
                      "element" : "period",
                      "variable" : "period",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Period"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "IVLTSPeriod",
                      "variable" : [
                        "srcTime",
                        "period"
                      ]
                    }
                  ]
                },
                {
                  "name" : "entity",
                  "source" : [
                    {
                      "context" : "srcPart",
                      "element" : "assignedEntity",
                      "variable" : "entity"
                    }
                  ],
                  "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" : "uuid2",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid2"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "entry",
                      "source" : [
                        {
                          "context" : "entity"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgtPart",
                          "contextType" : "variable",
                          "element" : "individual",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %practitioner.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ClinicalDocumentEntityPractitioner",
                          "variable" : [
                            "entity",
                            "practitioner"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "location",
              "source" : [
                {
                  "context" : "src",
                  "element" : "location",
                  "variable" : "srcLocation"
                }
              ],
              "rule" : [
                {
                  "name" : "facility",
                  "source" : [
                    {
                      "context" : "srcLocation",
                      "element" : "healthCareFacility",
                      "variable" : "facility"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "location",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Location"
                        }
                      ]
                    },
                    {
                      "context" : "location",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid2",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid2"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "facLocation",
                      "source" : [
                        {
                          "context" : "facility"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "location",
                          "variable" : "tgtLocation"
                        },
                        {
                          "context" : "tgtLocation",
                          "contextType" : "variable",
                          "element" : "location",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %location.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ClinicalDocumentLocation",
                          "variable" : [
                            "facility",
                            "bundle",
                            "location"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ClinicalDocumentLocation",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "src",
              "type" : "HealthCareFacility",
              "mode" : "source"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            },
            {
              "name" : "tgt",
              "type" : "Location",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "id",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "srcIdentifier"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Identifier"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "II",
                  "variable" : [
                    "srcIdentifier",
                    "identifier"
                  ]
                }
              ]
            },
            {
              "name" : "locationType",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "srcCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "cc",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "coding",
                  "source" : [
                    {
                      "context" : "srcCode",
                      "element" : "code",
                      "variable" : "code"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "cc",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "code"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "system",
                      "source" : [
                        {
                          "context" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "https://mos.esante.gouv.fr/NOS/TRE_R02-SecteurActivite/FHIR/TRE-R02-SecteurActivite"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "display",
                      "source" : [
                        {
                          "context" : "srcCode",
                          "element" : "displayName",
                          "variable" : "display"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "display"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "location",
              "source" : [
                {
                  "context" : "src",
                  "element" : "location",
                  "variable" : "location"
                }
              ],
              "rule" : [
                {
                  "name" : "addr",
                  "source" : [
                    {
                      "context" : "location",
                      "element" : "addr",
                      "variable" : "locAddr"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "address",
                      "variable" : "address",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Address"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ADAddress",
                      "variable" : [
                        "locAddr",
                        "address"
                      ]
                    }
                  ]
                },
                {
                  "name" : "org",
                  "source" : [
                    {
                      "context" : "location",
                      "element" : "serviceProviderOrganization",
                      "variable" : "srcOrg"
                    }
                  ],
                  "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" : "uuid3",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid3"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "organization",
                      "source" : [
                        {
                          "context" : "srcOrg"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "managingOrganization",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %organization.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ClinicalDocumentOrganization",
                          "variable" : [
                            "srcOrg",
                            "organization"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ],
              "documentation" : "place names are usually stored with no parts"
            }
          ]
        },
        {
          "name" : "NarrativeLink",
          "typeMode" : "none",
          "documentation" : "_________________________ Template Type not specified  ___________________",
          "input" : [
            {
              "name" : "url",
              "mode" : "source"
            },
            {
              "name" : "ext",
              "type" : "Extension",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "url",
              "source" : [
                {
                  "context" : "url"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://hl7.org/fhir/StructureDefinition/narrativeLink"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "value",
              "source" : [
                {
                  "context" : "url"
                }
              ],
              "target" : [
                {
                  "context" : "ext",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "url"
                    }
                  ]
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "url"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }