POC - Mapping CDA to FHIR
0.1.0 - ci-build

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

## : Mapping CSE-MDE vers FHIR Bundle - Contexte Français - JSON Representation

Draft as of 2026-02-09

Raw json | Download

    {
      "resourceType" : "StructureMap",
      "id" : "CdaFrMDEToBundle",
      "text" : {
        "status" : "generated",
        "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Narratif généré : StructureMap CdaFrMDEToBundle</b></p><a name=\"CdaFrMDEToBundle\"> </a><a name=\"hcCdaFrMDEToBundle\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaFrMDEToBundle<span style=\"color: navy\">&quot; = &quot;</span>CdaFrMDEToBundle<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Mapping CSE-MDE vers FHIR Bundle - Contexte Français</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/cda/stds/core/2.0.0-sd/StructureDefinition-ClinicalDocument.html\" title=\"ClinicalDocument (CDA Class)\">http://hl7.org/cda/stds/core/StructureDefinition/ClinicalDocument</a><span style=\"color: navy\">&quot; </span><b>alias </b>ClinicalDocument <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/composition.html\" title=\"Composition\">http://hl7.org/fhir/StructureDefinition/Composition</a><span style=\"color: navy\">&quot; </span><b>alias </b>Composition <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">&quot; </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/observation.html\" title=\"Observation\">http://hl7.org/fhir/StructureDefinition/Observation</a><span style=\"color: navy\">&quot; </span><b>alias </b>Observation <b>as </b><b>target</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-CdaToFHIRTypes.html\" title=\"Mapping de CDA vers les FHIR Types (A partir des sources de Oliver Egger)\">https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToFHIRTypes</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-CdaToBundle.html\" title=\"Mapping de CDA vers FHIR Bundle (A partir des sources de Oliver Egger)\">https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToBundle</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-CdaFrToBundle.html\" title=\"Mapping de CDAFr vers FHIR Bundle (A partir des sources de Oliver Egger)\">https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaFrToBundle</a><span style=\"color: navy\">&quot;\r\n</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Entry point</span>\r\n<b>group </b>CdaFrMDEToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">cda</span><span style=\"color: navy\"> : </span>ClinicalDocument, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  cda<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span> composition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span> patient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>CdaFrMDEMapping<span style=\"color: navy\">(</span><span style=\"color: maroon\">cda</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;main&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Main mapping group</span>\r\n<b>group </b>CdaFrMDEMapping<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">cda</span><span style=\"color: navy\"> : </span>ClinicalDocument, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Bundle metadata</span>\r\n  cda<span style=\"color: navy\"><b> -&gt; </b></span>bundle.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;bundleId&quot;</i><span style=\"color: navy\">;</span>\r\n  cda.id<b> as </b><span style=\"color: maroon\">cdaId</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.identifier<b> as </b><span style=\"color: maroon\">identifier</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    cdaId.root<b> as </b><span style=\"color: maroon\">root</span><b> where </b>cdaId.extension.exists()<span style=\"color: navy\"><b> -&gt; </b></span>identifier.system = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">root</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'#oid2uri'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'uri'</span><span style=\"color: navy\">)</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n    cdaId.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\"><b> -&gt; </b></span>identifier.value = <span style=\"color: maroon\">extension</span> <i>&quot;value&quot;</i><span style=\"color: navy\">;</span>\r\n    cdaId.root<b> as </b><span style=\"color: maroon\">root</span><b> where </b>cdaId.extension.empty()<span style=\"color: navy\"><b> -&gt; </b></span>identifier.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span> <i>&quot;systemOid&quot;</i><span style=\"color: navy\">;</span>\r\n    cdaId.root<b> as </b><span style=\"color: maroon\">root</span><b> where </b>cdaId.extension.empty()<span style=\"color: navy\"><b> -&gt; </b></span>identifier.value = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:oid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">root</span><span style=\"color: navy\">)</span> <i>&quot;valueOid&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;bundleIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n  cda<span style=\"color: navy\"><b> -&gt; </b></span>bundle.type = <span style=\"color: blue\">'document'</span> <i>&quot;bundleType&quot;</i><span style=\"color: navy\">;</span>\r\n  cda.effectiveTime<b> as </b><span style=\"color: maroon\">effectiveTime</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.timestamp = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'instant'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">timestamp</span><b> then </b>TSInstant<span style=\"color: navy\">(</span><span style=\"color: maroon\">effectiveTime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">)</span> <i>&quot;bundleTimestamp&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Composition using CdaToBundle function (includes patient mapping)</span>\r\n  cda<span style=\"color: navy\"><b> -&gt; </b></span>composition<b> then </b>ClinicalDocumentComposition<span style=\"color: navy\">(</span><span style=\"color: maroon\">cda</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;composition&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Add gender mapping after ClinicalDocumentComposition (which calls ClinicalDocumentPatientRole)</span>\r\n  cda.recordTarget<b> as </b><span style=\"color: maroon\">recordTarget</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    recordTarget.patientRole<b> as </b><span style=\"color: maroon\">patientRole</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      patientRole.patient<b> as </b><span style=\"color: maroon\">cdaPatient</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        cdaPatient.administrativeGenderCode<b> as </b><span style=\"color: maroon\">gender</span><b> then </b>MapGender<span style=\"color: navy\">(</span><span style=\"color: maroon\">gender</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;patientGender&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;cdaPatient&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;recordTargetGender&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Process sections with observations</span>\r\n  cda.component<b> as </b><span style=\"color: maroon\">cdaComp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    cdaComp.structuredBody<b> as </b><span style=\"color: maroon\">body</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      body.component<b> as </b><span style=\"color: maroon\">bodyComp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        bodyComp.section<b> as </b><span style=\"color: maroon\">section</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          <span style=\"color: navy\">// </span><span style=\"color: green\">Create composition section</span>\r\n          section<span style=\"color: navy\"><b> -&gt; </b></span>composition.section<b> as </b><span style=\"color: maroon\">compSection</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            section.title<b> as </b><span style=\"color: maroon\">sectionTitle</span><span style=\"color: navy\"><b> -&gt; </b></span>compSection.title = <span style=\"color: navy\">(</span>sectionTitle.xmlText<span style=\"color: navy\">)</span> <i>&quot;sectionTitle&quot;</i><span style=\"color: navy\">;</span>\r\n            section.code<b> as </b><span style=\"color: maroon\">sectionCode</span><span style=\"color: navy\"><b> -&gt; </b></span>compSection.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\">sectionCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span> <i>&quot;sectionCode&quot;</i><span style=\"color: navy\">;</span>\r\n            section.text<b> as </b><span style=\"color: maroon\">sectionText</span><span style=\"color: navy\"><b> -&gt; </b></span>compSection.text = <span style=\"color: maroon\">sectionText</span> <i>&quot;sectionText&quot;</i><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Process observations in organizers</span>\r\n            section.entry<b> as </b><span style=\"color: maroon\">entry</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              entry.organizer<b> as </b><span style=\"color: maroon\">organizer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>                organizer.component<b> as </b><span style=\"color: maroon\">orgComp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>                  orgComp.observation<b> as </b><span style=\"color: maroon\">obs</span><b> then</b><span style=\"color: navy\"> {\r\n</span>                    obs<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">obsEntry</span><span style=\"color: navy\">, </span> obsEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">obsUuid</span><span style=\"color: navy\">, </span> obsEntry.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\">obsUuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> compSection.entry = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">obsRef</span><span style=\"color: navy\">, </span> obsRef.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">obsUuid</span><span style=\"color: navy\">)</span><b> then </b>ProcessObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">cda</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">obs</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">observation</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> <i>&quot;processObs&quot;</i><span style=\"color: navy\">;</span>\r\n                  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n                <span style=\"color: navy\">}</span> <i>&quot;orgComponent&quot;</i><span style=\"color: navy\">;</span>\r\n              <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;compSection&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;bodyComponent&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;cdaComponent&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Process individual observation using CdaToFHIRTypes functions</span>\r\n<b>group </b>ProcessObservation<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\">obs</span>, <b>target</b> <span style=\"color: maroon\">observation</span><span style=\"color: navy\"> : </span>Observation, <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<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Meta profile - ANS profiles based on LOINC code</span>\r\n  obs.code<b> as </b><span style=\"color: maroon\">obsCode</span><b> where </b>code = '29463-7'<span style=\"color: navy\"><b> -&gt; </b></span>observation.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    obsCode<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/mesures/StructureDefinition/mesures-fr-observation-body-weight'</span> <i>&quot;profileWeight&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;metaWeight&quot;</i><span style=\"color: navy\">;</span>\r\n  obs.code<b> as </b><span style=\"color: maroon\">obsCode</span><b> where </b>code = '8302-2'<span style=\"color: navy\"><b> -&gt; </b></span>observation.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    obsCode<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/mesures/StructureDefinition/mesures-fr-observation-bodyheight'</span> <i>&quot;profileHeight&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;metaHeight&quot;</i><span style=\"color: navy\">;</span>\r\n  obs.code<b> as </b><span style=\"color: maroon\">obsCode</span><b> where </b>code = '8287-5'<span style=\"color: navy\"><b> -&gt; </b></span>observation.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    obsCode<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://interop.esante.gouv.fr/ig/fhir/mesures/StructureDefinition/mesures-observation-head-circumference'</span> <i>&quot;profileHeadCirc&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;metaHeadCirc&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Status - map CDA &quot;completed&quot; to FHIR &quot;final&quot;</span>\r\n  obs.statusCode<b> as </b><span style=\"color: maroon\">statusCode</span><b> where </b>code = 'completed'<span style=\"color: navy\"><b> -&gt; </b></span>observation.status = <span style=\"color: blue\">'final'</span> <i>&quot;statusCompleted&quot;</i><span style=\"color: navy\">;</span>\r\n  obs.statusCode<b> as </b><span style=\"color: maroon\">statusCode</span><b> where </b>code != 'completed'<span style=\"color: navy\"><b> -&gt; </b></span>observation.status = <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\">status</span><b> then </b>CSCode<span style=\"color: navy\">(</span><span style=\"color: maroon\">statusCode</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">status</span><span style=\"color: navy\">)</span> <i>&quot;statusOther&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Category - vital-signs for all observations in CSE-MDE</span>\r\n  obs<span style=\"color: navy\"><b> -&gt; </b></span>observation.category = <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\">category</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    obs<span style=\"color: navy\"><b> -&gt; </b></span>category.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      obs<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;system&quot;</i><span style=\"color: navy\">;</span>\r\n      obs<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: blue\">'vital-signs'</span> <i>&quot;code&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;coding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;category&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Code using CDCodeableConcept from CdaToFHIRTypes</span>\r\n  obs.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.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\">code</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">cc</span><span style=\"color: navy\">)</span> <i>&quot;obsCode&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">EffectiveDateTime - use effectiveTime from observation</span>\r\n  obs.effectiveTime<b> as </b><span style=\"color: maroon\">effectiveTime</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.effective = <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\">effectiveTime</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">dt</span><span style=\"color: navy\">)</span> <i>&quot;effectiveDateTime&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Value as Quantity using PQQuantity from CdaToFHIRTypes</span>\r\n  obs.value<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Quantity'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">qty</span><b> then </b>PQQuantity<span style=\"color: navy\">(</span><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">qty</span><span style=\"color: navy\">)</span> <i>&quot;obsValue&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Subject reference</span>\r\n  obs<span style=\"color: navy\"><b> -&gt; </b></span> observation.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\">ref</span><span style=\"color: navy\">, </span> ref.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;obsSubject&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Map CDA v3 administrative gender to FHIR gender</span>\r\n<b>group </b>MapGender<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<b> where </b>code = 'M'<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'male'</span> <i>&quot;genderMale&quot;</i><span style=\"color: navy\">;</span>\r\n  src<b> where </b>code = 'F'<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'female'</span> <i>&quot;genderFemale&quot;</i><span style=\"color: navy\">;</span>\r\n  src<b> where </b>code = 'UN'<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'other'</span> <i>&quot;genderOther&quot;</i><span style=\"color: navy\">;</span>\r\n  src<b> where </b>code = 'UNK'<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'unknown'</span> <i>&quot;genderUnknown&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
      },
      "url" : "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaFrMDEToBundle",
      "version" : "0.1.0",
      "name" : "CdaFrMDEToBundle",
      "title" : "Mapping CSE-MDE vers FHIR Bundle - Contexte Français",
      "status" : "draft",
      "date" : "2026-02-09T11:09:38+00:00",
      "publisher" : "Agence du Numérique en Santé (ANS) - 2-10 Rue d'Oradour-sur-Glane, 75015 Paris",
      "contact" : [
        {
          "name" : "Agence du Numérique en Santé (ANS) - 2-10 Rue d'Oradour-sur-Glane, 75015 Paris",
          "telecom" : [
            {
              "system" : "url",
              "value" : "https://esante.gouv.fr"
            }
          ]
        }
      ],
      "description" : "Mapping CSE-MDE vers FHIR Bundle - Contexte Français",
      "jurisdiction" : [
        {
          "coding" : [
            {
              "system" : "urn:iso:std:iso:3166",
              "code" : "FR",
              "display" : "FRANCE"
            }
          ]
        }
      ],
      "structure" : [
        {
          "url" : "http://hl7.org/cda/stds/core/StructureDefinition/ClinicalDocument",
          "mode" : "source",
          "alias" : "ClinicalDocument"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
          "mode" : "target",
          "alias" : "Bundle"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Composition",
          "mode" : "target",
          "alias" : "Composition"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Patient",
          "mode" : "target",
          "alias" : "Patient"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Observation",
          "mode" : "target",
          "alias" : "Observation"
        }
      ],
      "import" : [
        🔗 "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToFHIRTypes"🔗 ,
        "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaToBundle"🔗 ,
        "https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaFrToBundle"
      ],
      "group" : [
        {
          "name" : "CdaFrMDEToBundle",
          "typeMode" : "none",
          "documentation" : "Entry point",
          "input" : [
            {
              "name" : "cda",
              "type" : "ClinicalDocument",
              "mode" : "source"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "main",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "composition",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Composition"
                    }
                  ]
                },
                {
                  "context" : "composition",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid",
                  "transform" : "uuid"
                },
                {
                  "context" : "e",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid"
                    }
                  ]
                },
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e2"
                },
                {
                  "context" : "e2",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "patient",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Patient"
                    }
                  ]
                },
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid2",
                  "transform" : "uuid"
                },
                {
                  "context" : "e2",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid2"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CdaFrMDEMapping",
                  "variable" : [
                    "cda",
                    "patient",
                    "composition",
                    "bundle"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "CdaFrMDEMapping",
          "typeMode" : "none",
          "documentation" : "Main mapping group",
          "input" : [
            {
              "name" : "cda",
              "type" : "ClinicalDocument",
              "mode" : "source"
            },
            {
              "name" : "patient",
              "type" : "Patient",
              "mode" : "target"
            },
            {
              "name" : "composition",
              "type" : "Composition",
              "mode" : "target"
            },
            {
              "name" : "bundle",
              "type" : "Bundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "bundleId",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "bundleIdentifier",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "id",
                  "variable" : "cdaId"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                }
              ],
              "rule" : [
                {
                  "name" : "system",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "root",
                      "variable" : "root",
                      "condition" : "cdaId.extension.exists()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "root"
                        },
                        {
                          "valueString" : "#oid2uri"
                        },
                        {
                          "valueString" : "uri"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "value",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "extension",
                      "variable" : "extension"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "extension"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "systemOid",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "root",
                      "variable" : "root",
                      "condition" : "cdaId.extension.empty()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "urn:ietf:rfc:3986"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "valueOid",
                  "source" : [
                    {
                      "context" : "cdaId",
                      "element" : "root",
                      "variable" : "root",
                      "condition" : "cdaId.extension.empty()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "identifier",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:oid:"
                        },
                        {
                          "valueId" : "root"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "bundleType",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "type",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "document"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "bundleTimestamp",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "timestamp",
                  "variable" : "timestamp",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "instant"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TSInstant",
                  "variable" : [
                    "effectiveTime",
                    "timestamp"
                  ]
                }
              ]
            },
            {
              "name" : "composition",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "composition",
                  "contextType" : "variable"
                }
              ],
              "dependent" : [
                {
                  "name" : "ClinicalDocumentComposition",
                  "variable" : [
                    "cda",
                    "composition",
                    "patient",
                    "bundle"
                  ]
                }
              ]
            },
            {
              "name" : "recordTargetGender",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "recordTarget",
                  "variable" : "recordTarget"
                }
              ],
              "rule" : [
                {
                  "name" : "patientRole",
                  "source" : [
                    {
                      "context" : "recordTarget",
                      "element" : "patientRole",
                      "variable" : "patientRole"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "cdaPatient",
                      "source" : [
                        {
                          "context" : "patientRole",
                          "element" : "patient",
                          "variable" : "cdaPatient"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "patientGender",
                          "source" : [
                            {
                              "context" : "cdaPatient",
                              "element" : "administrativeGenderCode",
                              "variable" : "gender"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "MapGender",
                              "variable" : [
                                "gender",
                                "patient"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "cdaComponent",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "component",
                  "variable" : "cdaComp"
                }
              ],
              "rule" : [
                {
                  "name" : "structuredBody",
                  "source" : [
                    {
                      "context" : "cdaComp",
                      "element" : "structuredBody",
                      "variable" : "body"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "bodyComponent",
                      "source" : [
                        {
                          "context" : "body",
                          "element" : "component",
                          "variable" : "bodyComp"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "section",
                          "source" : [
                            {
                              "context" : "bodyComp",
                              "element" : "section",
                              "variable" : "section"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "compSection",
                              "source" : [
                                {
                                  "context" : "section"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "composition",
                                  "contextType" : "variable",
                                  "element" : "section",
                                  "variable" : "compSection"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "sectionTitle",
                                  "source" : [
                                    {
                                      "context" : "section",
                                      "element" : "title",
                                      "variable" : "sectionTitle"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "compSection",
                                      "contextType" : "variable",
                                      "element" : "title",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "sectionTitle.xmlText"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "sectionCode",
                                  "source" : [
                                    {
                                      "context" : "section",
                                      "element" : "code",
                                      "variable" : "sectionCode"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "compSection",
                                      "contextType" : "variable",
                                      "element" : "code",
                                      "variable" : "cc",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "CodeableConcept"
                                        }
                                      ]
                                    }
                                  ],
                                  "dependent" : [
                                    {
                                      "name" : "CDCodeableConcept",
                                      "variable" : [
                                        "sectionCode",
                                        "cc"
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "sectionText",
                                  "source" : [
                                    {
                                      "context" : "section",
                                      "element" : "text",
                                      "variable" : "sectionText"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "compSection",
                                      "contextType" : "variable",
                                      "element" : "text",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "sectionText"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "entry",
                                  "source" : [
                                    {
                                      "context" : "section",
                                      "element" : "entry",
                                      "variable" : "entry"
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "organizer",
                                      "source" : [
                                        {
                                          "context" : "entry",
                                          "element" : "organizer",
                                          "variable" : "organizer"
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "orgComponent",
                                          "source" : [
                                            {
                                              "context" : "organizer",
                                              "element" : "component",
                                              "variable" : "orgComp"
                                            }
                                          ],
                                          "rule" : [
                                            {
                                              "name" : "observation",
                                              "source" : [
                                                {
                                                  "context" : "orgComp",
                                                  "element" : "observation",
                                                  "variable" : "obs"
                                                }
                                              ],
                                              "rule" : [
                                                {
                                                  "name" : "processObs",
                                                  "source" : [
                                                    {
                                                      "context" : "obs"
                                                    }
                                                  ],
                                                  "target" : [
                                                    {
                                                      "context" : "bundle",
                                                      "contextType" : "variable",
                                                      "element" : "entry",
                                                      "variable" : "obsEntry"
                                                    },
                                                    {
                                                      "context" : "obsEntry",
                                                      "contextType" : "variable",
                                                      "element" : "resource",
                                                      "variable" : "observation",
                                                      "transform" : "create",
                                                      "parameter" : [
                                                        {
                                                          "valueString" : "Observation"
                                                        }
                                                      ]
                                                    },
                                                    {
                                                      "context" : "observation",
                                                      "contextType" : "variable",
                                                      "element" : "id",
                                                      "variable" : "obsUuid",
                                                      "transform" : "uuid"
                                                    },
                                                    {
                                                      "context" : "obsEntry",
                                                      "contextType" : "variable",
                                                      "element" : "fullUrl",
                                                      "transform" : "append",
                                                      "parameter" : [
                                                        {
                                                          "valueString" : "urn:uuid:"
                                                        },
                                                        {
                                                          "valueId" : "obsUuid"
                                                        }
                                                      ]
                                                    },
                                                    {
                                                      "context" : "compSection",
                                                      "contextType" : "variable",
                                                      "element" : "entry",
                                                      "variable" : "obsRef",
                                                      "transform" : "create",
                                                      "parameter" : [
                                                        {
                                                          "valueString" : "Reference"
                                                        }
                                                      ]
                                                    },
                                                    {
                                                      "context" : "obsRef",
                                                      "contextType" : "variable",
                                                      "element" : "reference",
                                                      "transform" : "append",
                                                      "parameter" : [
                                                        {
                                                          "valueString" : "urn:uuid:"
                                                        },
                                                        {
                                                          "valueId" : "obsUuid"
                                                        }
                                                      ]
                                                    }
                                                  ],
                                                  "dependent" : [
                                                    {
                                                      "name" : "ProcessObservation",
                                                      "variable" : [
                                                        "cda",
                                                        "obs",
                                                        "observation",
                                                        "patient",
                                                        "composition"
                                                      ]
                                                    }
                                                  ]
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ProcessObservation",
          "typeMode" : "none",
          "documentation" : "Process individual observation using CdaToFHIRTypes functions",
          "input" : [
            {
              "name" : "cda",
              "type" : "ClinicalDocument",
              "mode" : "source"
            },
            {
              "name" : "obs",
              "mode" : "source"
            },
            {
              "name" : "observation",
              "type" : "Observation",
              "mode" : "target"
            },
            {
              "name" : "patient",
              "type" : "Patient",
              "mode" : "target"
            },
            {
              "name" : "composition",
              "type" : "Composition",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "metaWeight",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "code",
                  "variable" : "obsCode",
                  "condition" : "code = '29463-7'"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "meta",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Meta"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "profileWeight",
                  "source" : [
                    {
                      "context" : "obsCode"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "meta",
                      "contextType" : "variable",
                      "element" : "profile",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://interop.esante.gouv.fr/ig/fhir/mesures/StructureDefinition/mesures-fr-observation-body-weight"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "metaHeight",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "code",
                  "variable" : "obsCode",
                  "condition" : "code = '8302-2'"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "meta",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Meta"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "profileHeight",
                  "source" : [
                    {
                      "context" : "obsCode"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "meta",
                      "contextType" : "variable",
                      "element" : "profile",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://interop.esante.gouv.fr/ig/fhir/mesures/StructureDefinition/mesures-fr-observation-bodyheight"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "metaHeadCirc",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "code",
                  "variable" : "obsCode",
                  "condition" : "code = '8287-5'"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "meta",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Meta"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "profileHeadCirc",
                  "source" : [
                    {
                      "context" : "obsCode"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "meta",
                      "contextType" : "variable",
                      "element" : "profile",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://interop.esante.gouv.fr/ig/fhir/mesures/StructureDefinition/mesures-observation-head-circumference"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "statusCompleted",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "statusCode",
                  "variable" : "statusCode",
                  "condition" : "code = 'completed'"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "final"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "statusOther",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "statusCode",
                  "variable" : "statusCode",
                  "condition" : "code != 'completed'"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "status",
                  "variable" : "status",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CSCode",
                  "variable" : [
                    "statusCode",
                    "status"
                  ]
                }
              ]
            },
            {
              "name" : "category",
              "source" : [
                {
                  "context" : "obs"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "category",
                  "variable" : "category",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "coding",
                  "source" : [
                    {
                      "context" : "obs"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "category",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "system",
                      "source" : [
                        {
                          "context" : "obs"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "http://terminology.hl7.org/CodeSystem/observation-category"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "obs"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "vital-signs"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "obsCode",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "code",
                  "variable" : "code"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "code",
                  "variable" : "cc",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "CDCodeableConcept",
                  "variable" : [
                    "code",
                    "cc"
                  ]
                }
              ]
            },
            {
              "name" : "effectiveDateTime",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "effective",
                  "variable" : "dt",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "dateTime"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TSDateTime",
                  "variable" : [
                    "effectiveTime",
                    "dt"
                  ]
                }
              ]
            },
            {
              "name" : "obsValue",
              "source" : [
                {
                  "context" : "obs",
                  "element" : "value",
                  "variable" : "value"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "qty",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Quantity"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "PQQuantity",
                  "variable" : [
                    "value",
                    "qty"
                  ]
                }
              ]
            },
            {
              "name" : "obsSubject",
              "source" : [
                {
                  "context" : "obs"
                }
              ],
              "target" : [
                {
                  "context" : "observation",
                  "contextType" : "variable",
                  "element" : "subject",
                  "variable" : "ref",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "ref",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %patient.id"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "MapGender",
          "typeMode" : "none",
          "documentation" : "Map CDA v3 administrative gender to FHIR gender",
          "input" : [
            {
              "name" : "src",
              "mode" : "source"
            },
            {
              "name" : "patient",
              "type" : "Patient",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "genderMale",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "code = 'M'"
                }
              ],
              "target" : [
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "gender",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "male"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "genderFemale",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "code = 'F'"
                }
              ],
              "target" : [
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "gender",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "female"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "genderOther",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "code = 'UN'"
                }
              ],
              "target" : [
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "gender",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "other"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "genderUnknown",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "code = 'UNK'"
                }
              ],
              "target" : [
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "gender",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "unknown"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }