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) - TTL Representation

Draft as of 2025-11-07

Raw ttl | Download

    @prefix fhir: <http://hl7.org/fhir/> .
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

    # - resource -------------------------------------------------------------------

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