Data Management with FHIR 0.1.0 - ci-build

Data Management with 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

## : Alignement de l''usage Core du modèle physique du DPI vers les ressources FHIR - JSON Representation

Draft as of 2026-04-16

Raw json | Download

    {
      "resourceType" : "StructureMap",
      "id" : "CorePhysical2FHIR",
      "text" : {
        "status" : "generated",
        "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Narratif généré : StructureMap CorePhysical2FHIR</b></p><a name=\"CorePhysical2FHIR\"> </a><a name=\"hcCorePhysical2FHIR\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureMap/CorePhysical2FHIR<span style=\"color: navy\">&quot; = &quot;</span>CorePhysical2FHIR<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Alignement de l''usage Core du modèle physique du DPI vers les ressources FHIR</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDataSet<span style=\"color: navy\">&quot; </span><b>alias </b>DataSet <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CorePatient<span style=\"color: navy\">&quot; </span><b>alias </b>PatientTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreSejour<span style=\"color: navy\">&quot; </span><b>alias </b>SejourTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreBiology<span style=\"color: navy\">&quot; </span><b>alias </b>BiologyTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreClinical<span style=\"color: navy\">&quot; </span><b>alias </b>ClinicalTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDiag<span style=\"color: navy\">&quot; </span><b>alias </b>DiagTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreActe<span style=\"color: navy\">&quot; </span><b>alias </b>ActeTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreAddress<span style=\"color: navy\">&quot; </span><b>alias </b>AddressTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationAdm<span style=\"color: navy\">&quot; </span><b>alias </b>MedicationAdmTable <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationPre<span style=\"color: navy\">&quot; </span><b>alias </b>MedicationPreTable <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>FHIRBundle <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>FHIRPatient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/encounter.html\" title=\"Encounter\">http://hl7.org/fhir/StructureDefinition/Encounter</a><span style=\"color: navy\">&quot; </span><b>alias </b>FHIREncounter <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>FHIRObservation <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/datatypes.html#Meta\" title=\"Meta\">http://hl7.org/fhir/StructureDefinition/Meta</a><span style=\"color: navy\">&quot; </span><b>alias </b>FHIRMeta <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/procedure.html\" title=\"Procedure\">http://hl7.org/fhir/StructureDefinition/Procedure</a><span style=\"color: navy\">&quot; </span><b>alias </b>FHIRProcedure <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/condition.html\" title=\"Condition\">http://hl7.org/fhir/StructureDefinition/Condition</a><span style=\"color: navy\">&quot; </span><b>alias </b>FHIRCondition <b>as </b><b>target</b>\r\n\r\n<b>group </b>dataSet<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcDataSet</span><span style=\"color: navy\"> : </span>DataSet, <b>target</b> <span style=\"color: maroon\">tgtBundle</span><span style=\"color: navy\"> : </span>FHIRBundle<span style=\"color: navy\">)</span><b> &lt;&lt;types&gt;&gt;</b><span style=\"color: navy\"> {\r\n</span>  srcDataSet<span style=\"color: navy\"><b> -&gt; </b></span>tgtBundle.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;setId&quot;</i><span style=\"color: navy\">;</span>\r\n  srcDataSet<span style=\"color: navy\"><b> -&gt; </b></span>tgtBundle.type = <span style=\"color: blue\">'transaction'</span> <i>&quot;setType&quot;</i><span style=\"color: navy\">;</span>\r\n  srcDataSet.patient<b> as </b><span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtBundle.entry<b> as </b><span style=\"color: maroon\">tgtPatientEntry</span><span style=\"color: navy\">, </span> tgtPatientEntry.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\">newPatient</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcPatient<b> then </b>patient<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newPatient</span><span style=\"color: navy\">)</span> <i>&quot;setPatient&quot;</i><span style=\"color: navy\">;</span>\r\n    srcPatient<b> then </b>setEntryRequestAndFullUrl<span style=\"color: navy\">(</span><span style=\"color: maroon\">newPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtPatientEntry</span><span style=\"color: navy\">)</span> <i>&quot;setRequestAndFullUrl&quot;</i><span style=\"color: navy\">;</span>\r\n    srcDataSet.address<b> as </b><span style=\"color: maroon\">srcAddress</span><b> where </b>patientNi.reference = ('PatientCore/' + %srcPatient.patientNi.toString())<b> then </b>patientAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcAddress</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newPatient</span><span style=\"color: navy\">)</span> <i>&quot;addPatientAddress&quot;</i><span style=\"color: navy\">;</span>\r\n    srcDataSet.sejour<b> as </b><span style=\"color: maroon\">srcSejour</span><b> where </b>patientNi.reference = ('PatientCore/' + %srcPatient.patientNi.toString())<span style=\"color: navy\"><b> -&gt; </b></span> tgtBundle.entry<b> as </b><span style=\"color: maroon\">tgtEncounterEntry</span><span style=\"color: navy\">, </span> tgtEncounterEntry.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\">newEncounter</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcSejour<b> then </b>encounter<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcSejour</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">)</span> <i>&quot;setEncounter&quot;</i><span style=\"color: navy\">;</span>\r\n      srcSejour<b> then </b>setEntryRequestAndFullUrl<span style=\"color: navy\">(</span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtEncounterEntry</span><span style=\"color: navy\">)</span> <i>&quot;setRequestAndFullUrl&quot;</i><span style=\"color: navy\">;</span>\r\n      srcDataSet.acte<b> as </b><span style=\"color: maroon\">srcActe</span><b> where </b>sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())<span style=\"color: navy\"><b> -&gt; </b></span> tgtBundle.entry<b> as </b><span style=\"color: maroon\">tgtProcedureEntry</span><span style=\"color: navy\">, </span> tgtProcedureEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Procedure'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newProcedure</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        srcActe<b> then </b>procedure<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcActe</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newProcedure</span><span style=\"color: navy\">)</span> <i>&quot;setProcedure&quot;</i><span style=\"color: navy\">;</span>\r\n        srcActe<b> then </b>setEntryRequestAndFullUrl<span style=\"color: navy\">(</span><span style=\"color: maroon\">newProcedure</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtProcedureEntry</span><span style=\"color: navy\">)</span> <i>&quot;setRequestAndFullUrl&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;createProcedure&quot;</i><span style=\"color: navy\">;</span>\r\n      srcDataSet.diag<b> as </b><span style=\"color: maroon\">srcDiag</span><b> where </b>sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())<span style=\"color: navy\"><b> -&gt; </b></span> tgtBundle.entry<b> as </b><span style=\"color: maroon\">tgtConditionEntry</span><span style=\"color: navy\">, </span> tgtConditionEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newCondition</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        srcDiag<b> then </b>condition<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcDiag</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newCondition</span><span style=\"color: navy\">)</span> <i>&quot;setCondition&quot;</i><span style=\"color: navy\">;</span>\r\n        srcDiag<b> then </b>setEntryRequestAndFullUrl<span style=\"color: navy\">(</span><span style=\"color: maroon\">newCondition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtConditionEntry</span><span style=\"color: navy\">)</span> <i>&quot;setRequestAndFullUrl&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;createProcedure&quot;</i><span style=\"color: navy\">;</span>\r\n      srcDataSet.biology<b> as </b><span style=\"color: maroon\">srcBiology</span><b> where </b>sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())<span style=\"color: navy\"><b> -&gt; </b></span> tgtBundle.entry<b> as </b><span style=\"color: maroon\">tgtBiologyEntry</span><span style=\"color: navy\">, </span> tgtBiologyEntry.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\">newObservation</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        srcBiology<b> then </b>observationBiol<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcBiology</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newObservation</span><span style=\"color: navy\">)</span> <i>&quot;setBiology&quot;</i><span style=\"color: navy\">;</span>\r\n        srcBiology<b> then </b>setEntryRequestAndFullUrl<span style=\"color: navy\">(</span><span style=\"color: maroon\">newObservation</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtBiologyEntry</span><span style=\"color: navy\">)</span> <i>&quot;setRequestAndFullUrl&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;createObservation&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;createEncounter&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;createPatient&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>patient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"> : </span>PatientTable, <b>target</b> <span style=\"color: maroon\">tgtPatient</span><span style=\"color: navy\"> : </span>FHIRPatient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcPatient<span style=\"color: navy\"><b> -&gt; </b></span>tgtPatient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;setId&quot;</i><span style=\"color: navy\">;</span>\r\n  srcPatient.patientNi<b> as </b><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtPatient.meta<b> as </b><span style=\"color: maroon\">tgtMeta</span><b> then </b>setPatientMeta<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\">)</span> <i>&quot;setMeta&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient</span>\r\n  srcPatient<span style=\"color: navy\"><b> -&gt; </b></span>tgtPatient.name<b> as </b><span style=\"color: maroon\">tgtPatientName</span><b> then </b>setHumainName<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtPatientName</span><span style=\"color: navy\">)</span> <i>&quot;setHumainName&quot;</i><span style=\"color: navy\">;</span>\r\n  srcPatient<span style=\"color: navy\"><b> -&gt; </b></span>tgtPatient.identifier<b> as </b><span style=\"color: maroon\">tgtPatientIdentifier</span><b> then </b>setHumainNir<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtPatientIdentifier</span><span style=\"color: navy\">)</span> <i>&quot;setHumainNir&quot;</i><span style=\"color: navy\">;</span>\r\n  srcPatient.gender<b> as </b><span style=\"color: maroon\">srcPatientGender</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtPatient.gender = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">srcPatientGender</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'https://interop.aphp.fr/ig/fhir/dm/ConceptMap/DpiGender2Hl7Gender'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span> <i>&quot;setGender&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">traduit la valeur du champ gender de la table Patient dans l'élément gender de la ressource FHIR Patient</span>\r\n  srcPatient.birthDate<b> as </b><span style=\"color: maroon\">srcPatientBirthDate</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtPatient.birthDate = <span style=\"color: maroon\">srcPatientBirthDate</span> <i>&quot;setBirthDate&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">copie la valeur du champ birthDate de la table Patient dans l'élément birthDate de la ressource FHIR Patient</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setPatientMeta<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcNi</span>, <b>target</b> <span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\"> : </span>FHIRMeta<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcNi<span style=\"color: navy\"><b> -&gt; </b></span>tgtMeta.source = <span style=\"color: navy\">(</span>'https://aphp.fr/fhir/Endpoint/dpi/PatientTable' + '/' + %srcNi.toString()<span style=\"color: navy\">)</span> <i>&quot;setSource&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setHumainName<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"> : </span>PatientTable, <b>target</b> <span style=\"color: maroon\">tgtPatientName</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcPatient<span style=\"color: navy\"><b> -&gt; </b></span>tgtPatientName.use = <span style=\"color: blue\">'usual'</span> <i>&quot;setUse&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: #b36b00\" title=\"Cet élément n'était pas défini avant R5\">// srcPatient -&gt; tgtPatientName.text = (%srcPatient.firstName + ' ' + %srcPatient.name) &quot;setText&quot;;</span>\r\n  <span style=\"color: #b36b00\" title=\"Cet élément n'était pas défini avant R5\">// srcPatient.name as srcPatientName -&gt; tgtPatientName.family = srcPatientName &quot;setName&quot;;</span>\r\n  <span style=\"color: #b36b00\" title=\"Cet élément n'était pas défini avant R5\">// srcPatient.firstName as srcPatientFirstName -&gt; tgtPatientName.given = srcPatientFirstName &quot;setFirstName&quot;;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">les trois lignes précédentes marchent dans matchbox mais génèrent une erreur au QA. La solution ci dessous marche dans matchbox et ne génère pas d'erreur au QA.</span>\r\n  srcPatient.name<b> as </b><span style=\"color: maroon\">srcPatientName</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtPatientName.family = <span style=\"color: maroon\">srcPatientName</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcPatient.firstName<b> as </b><span style=\"color: maroon\">srcPatientFirstName</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtPatientName.given = <span style=\"color: maroon\">srcPatientFirstName</span><span style=\"color: navy\">, </span> tgtPatientName.text = <span style=\"color: navy\">(</span>%srcPatientFirstName + ' ' + %srcPatientName<span style=\"color: navy\">)</span> <i>&quot;setFirstNameAndText&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;setName&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setHumainNir<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"> : </span>PatientTable, <b>target</b> <span style=\"color: maroon\">tgtPatientIdentifier</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcPatient.nir<b> as </b><span style=\"color: maroon\">srcPatientNir</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtPatientIdentifier.use = <span style=\"color: blue\">'official'</span><span style=\"color: navy\">, </span> tgtPatientIdentifier.type = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'INS-NIR'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtPatientIdentifier.system = <span style=\"color: blue\">'urn:oid:1.2.250.1.213.1.4.8'</span><span style=\"color: navy\">, </span> tgtPatientIdentifier.value = <span style=\"color: maroon\">srcPatientNir</span> <i>&quot;setNir&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>patientAddress<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcAddress</span><span style=\"color: navy\"> : </span>AddressTable, <b>target</b> <span style=\"color: maroon\">tgtPatient</span><span style=\"color: navy\"> : </span>FHIRPatient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcAddress<span style=\"color: navy\"><b> -&gt; </b></span>tgtPatient.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\">newAddress</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcAddress.zipCode<b> as </b><span style=\"color: maroon\">srczip</span><span style=\"color: navy\"><b> -&gt; </b></span>newAddress.postalCode = <span style=\"color: maroon\">srczip</span> <i>&quot;setZip&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAddress.city<b> as </b><span style=\"color: maroon\">srcCity</span><span style=\"color: navy\"><b> -&gt; </b></span>newAddress.city = <span style=\"color: maroon\">srcCity</span> <i>&quot;setCity&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAddress.country<b> as </b><span style=\"color: maroon\">srcCountry</span><span style=\"color: navy\"><b> -&gt; </b></span>newAddress.country = <span style=\"color: maroon\">srcCountry</span> <i>&quot;setCountry&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAddress.address<b> as </b><span style=\"color: maroon\">srcAddressText</span><span style=\"color: navy\"><b> -&gt; </b></span>newAddress.text = <span style=\"color: maroon\">srcAddressText</span> <i>&quot;setText&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAddress<b> where </b>current = true<span style=\"color: navy\"><b> -&gt; </b></span>newAddress.use = <span style=\"color: blue\">'home'</span> <i>&quot;setUseHome&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAddress<b> where </b>current = false<span style=\"color: navy\"><b> -&gt; </b></span>newAddress.use = <span style=\"color: blue\">'old'</span> <i>&quot;setUseOld&quot;</i><span style=\"color: navy\">;</span>\r\n    srcAddress<b> where </b>latitude.exists() or longitude.exists()<span style=\"color: navy\"><b> -&gt; </b></span>newAddress.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">firstLevelExtension</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcAddress<span style=\"color: navy\"><b> -&gt; </b></span>firstLevelExtension.url = <span style=\"color: navy\">(</span>'http://hl7.org/fhir/StructureDefinition/geolocation'<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        srcAddress.latitude<b> as </b><span style=\"color: maroon\">srcLat</span><span style=\"color: navy\"><b> -&gt; </b></span>firstLevelExtension.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">latExtension</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          srcLat<span style=\"color: navy\"><b> -&gt; </b></span> latExtension.url = <span style=\"color: navy\">(</span>'latitude'<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> latExtension.value = <span style=\"color: maroon\">srcLat</span> <i>&quot;setLat&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;setLatExt&quot;</i><span style=\"color: navy\">;</span>\r\n        srcAddress.longitude<b> as </b><span style=\"color: maroon\">srcLong</span><span style=\"color: navy\"><b> -&gt; </b></span>firstLevelExtension.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">longExtension</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          srcLong<span style=\"color: navy\"><b> -&gt; </b></span> longExtension.url = <span style=\"color: navy\">(</span>'longitude'<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> longExtension.value = <span style=\"color: maroon\">srcLong</span> <i>&quot;setLong&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;setLongExt&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;setflext&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;setCoordinatesExtension&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;setAddress&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>encounter<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcSejour</span><span style=\"color: navy\"> : </span>SejourTable, <b>source</b> <span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"> : </span>FHIRPatient, <b>target</b> <span style=\"color: maroon\">tgtEncounter</span><span style=\"color: navy\"> : </span>FHIREncounter<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcSejour<span style=\"color: navy\"><b> -&gt; </b></span>tgtEncounter.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;setId&quot;</i><span style=\"color: navy\">;</span>\r\n  srcSejour.sejourNi<b> as </b><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtEncounter.meta<b> as </b><span style=\"color: maroon\">tgtMeta</span><b> then </b>setEncounterMeta<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\">)</span> <i>&quot;setMeta&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient</span>\r\n  srcSejour<span style=\"color: navy\"><b> -&gt; </b></span>tgtEncounter.status = <span style=\"color: blue\">'finished'</span> <i>&quot;setStatus&quot;</i><span style=\"color: navy\">;</span>\r\n  srcSejour.sejourType<b> as </b><span style=\"color: maroon\">srcSejourType</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtEncounter.class = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">srcSejourType</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'https://interop.aphp.fr/ig/fhir/dm/ConceptMap/DpiEncounterType2SemanticLayerEncounterClass'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span> <i>&quot;setEncounterClass&quot;</i><span style=\"color: navy\">;</span>\r\n  srcPatient.id<b> as </b><span style=\"color: maroon\">patientId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtEncounter.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\">newSubject</span><b> then </b>setSubjectReference<span style=\"color: navy\">(</span><span style=\"color: maroon\">patientId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newSubject</span><span style=\"color: navy\">)</span> <i>&quot;setSubjectReference&quot;</i><span style=\"color: navy\">;</span>\r\n  srcSejour.patientNi<span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">fk vers le patient à conserver pour la construction auto du périmètre final</span>\r\n  srcSejour<span style=\"color: navy\"><b> -&gt; </b></span>tgtEncounter.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\">newActualPeriod</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcSejour.sejourStart<b> as </b><span style=\"color: maroon\">srcPeriodStart</span><span style=\"color: navy\"><b> -&gt; </b></span>newActualPeriod.start = <span style=\"color: maroon\">srcPeriodStart</span> <i>&quot;setStart&quot;</i><span style=\"color: navy\">;</span>\r\n    srcSejour.sejourEnd<b> as </b><span style=\"color: maroon\">srcPeriodEnd</span><span style=\"color: navy\"><b> -&gt; </b></span>newActualPeriod.end = <span style=\"color: maroon\">srcPeriodEnd</span> <i>&quot;setEnd&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;setPeriod&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setEncounterMeta<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcNi</span>, <b>target</b> <span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\"> : </span>FHIRMeta<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcNi<span style=\"color: navy\"><b> -&gt; </b></span>tgtMeta.source = <span style=\"color: navy\">(</span>'https://aphp.fr/fhir/Endpoint/dpi/SejourTable' + '/' + %srcNi.toString()<span style=\"color: navy\">)</span> <i>&quot;setSource&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setSubjectReference<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcPatientId</span>, <b>target</b> <span style=\"color: maroon\">newSubject</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcPatientId<span style=\"color: navy\"><b> -&gt; </b></span>newSubject.reference = <span style=\"color: navy\">(</span>'Patient/' + %srcPatientId.toString()<span style=\"color: navy\">)</span> <i>&quot;setReference&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>procedure<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcActe</span><span style=\"color: navy\"> : </span>ActeTable, <b>source</b> <span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"> : </span>FHIRPatient, <b>source</b> <span style=\"color: maroon\">srcEncounter</span><span style=\"color: navy\"> : </span>FHIREncounter, <b>target</b> <span style=\"color: maroon\">tgtProcedure</span><span style=\"color: navy\"> : </span>FHIRProcedure<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcActe<span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedure.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;setId&quot;</i><span style=\"color: navy\">;</span>\r\n  srcActe.acteNi<b> as </b><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedure.meta<b> as </b><span style=\"color: maroon\">tgtMeta</span><b> then </b>setProcedureMeta<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\">)</span> <i>&quot;setMeta&quot;</i><span style=\"color: navy\">;</span>\r\n  srcPatient.id<b> as </b><span style=\"color: maroon\">patientId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedure.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\">newSubject</span><b> then </b>setSubjectReference<span style=\"color: navy\">(</span><span style=\"color: maroon\">patientId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newSubject</span><span style=\"color: navy\">)</span> <i>&quot;setSubjectReference&quot;</i><span style=\"color: navy\">;</span>\r\n  srcEncounter.id<b> as </b><span style=\"color: maroon\">encounterId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedure.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\">newEncounter</span><b> then </b>setEncounterReference<span style=\"color: navy\">(</span><span style=\"color: maroon\">encounterId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">)</span> <i>&quot;setEncounterReference&quot;</i><span style=\"color: navy\">;</span>\r\n  srcActe<span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedure.status = <span style=\"color: blue\">'completed'</span> <i>&quot;setStatus&quot;</i><span style=\"color: navy\">;</span>\r\n  srcActe<b> where </b>dateStart.exists() or dateEnd.exists<span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedure.performed = <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\">tgtProcedurePeriod</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcActe.dateStart<b> as </b><span style=\"color: maroon\">srcActeStart</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedurePeriod.start = <span style=\"color: maroon\">srcActeStart</span> <i>&quot;setActeStart&quot;</i><span style=\"color: navy\">;</span>\r\n    srcActe.dateEnd<b> as </b><span style=\"color: maroon\">srcActeEnd</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedurePeriod.end = <span style=\"color: maroon\">srcActeEnd</span> <i>&quot;setActeEnd&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;setDate&quot;</i><span style=\"color: navy\">;</span>\r\n  srcActe.code<b> as </b><span style=\"color: maroon\">acteCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtProcedure.code = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'https://smt.esante.gouv.fr/terminologie-ccam'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">acteCode</span><span style=\"color: navy\">)</span> <i>&quot;setCode&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">C'est le code de la CCAM facturante</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setProcedureMeta<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcNi</span>, <b>target</b> <span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\"> : </span>FHIRMeta<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcNi<span style=\"color: navy\"><b> -&gt; </b></span>tgtMeta.source = <span style=\"color: navy\">(</span>'https://aphp.fr/fhir/Endpoint/dpi/ActeTable' + '/' + %srcNi.toString()<span style=\"color: navy\">)</span> <i>&quot;setSource&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setEncounterReference<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcEncounterId</span>, <b>target</b> <span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcEncounterId<span style=\"color: navy\"><b> -&gt; </b></span>newEncounter.reference = <span style=\"color: navy\">(</span>'Encounter/' + %srcEncounterId.toString()<span style=\"color: navy\">)</span> <i>&quot;setReference&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>condition<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcDiag</span><span style=\"color: navy\"> : </span>DiagTable, <b>source</b> <span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"> : </span>FHIRPatient, <b>source</b> <span style=\"color: maroon\">srcEncounter</span><span style=\"color: navy\"> : </span>FHIREncounter, <b>target</b> <span style=\"color: maroon\">tgtCondition</span><span style=\"color: navy\"> : </span>FHIRCondition<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcDiag<span style=\"color: navy\"><b> -&gt; </b></span>tgtCondition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;setId&quot;</i><span style=\"color: navy\">;</span>\r\n  srcDiag.diagNi<b> as </b><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtCondition.meta<b> as </b><span style=\"color: maroon\">tgtMeta</span><b> then </b>setConditionMeta<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\">)</span> <i>&quot;setMeta&quot;</i><span style=\"color: navy\">;</span>\r\n  srcPatient.id<b> as </b><span style=\"color: maroon\">patientId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtCondition.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\">newSubject</span><b> then </b>setSubjectReference<span style=\"color: navy\">(</span><span style=\"color: maroon\">patientId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newSubject</span><span style=\"color: navy\">)</span> <i>&quot;setSubjectReference&quot;</i><span style=\"color: navy\">;</span>\r\n  srcEncounter.id<b> as </b><span style=\"color: maroon\">encounterId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtCondition.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\">newEncounter</span><b> then </b>setEncounterReference<span style=\"color: navy\">(</span><span style=\"color: maroon\">encounterId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">)</span> <i>&quot;setEncounterReference&quot;</i><span style=\"color: navy\">;</span>\r\n  srcDiag<span style=\"color: navy\"><b> -&gt; </b></span>tgtCondition.verificationStatus = <span style=\"color: blue\">'confirmed'</span> <i>&quot;setVerificationStatus&quot;</i><span style=\"color: navy\">;</span>\r\n  srcDiag<span style=\"color: navy\"><b> -&gt; </b></span>tgtCondition.category = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'encounter-diagnosis'</span><span style=\"color: navy\">)</span> <i>&quot;setCategory&quot;</i><span style=\"color: navy\">;</span>\r\n  srcDiag.code<b> as </b><span style=\"color: maroon\">diagCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtCondition.code = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://hl7.org/fhir/sid/icd-10'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">diagCode</span><span style=\"color: navy\">)</span> <i>&quot;setCode&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setConditionMeta<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcNi</span>, <b>target</b> <span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\"> : </span>FHIRMeta<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcNi<span style=\"color: navy\"><b> -&gt; </b></span>tgtMeta.source = <span style=\"color: navy\">(</span>'https://aphp.fr/fhir/Endpoint/dpi/DiagTable' + '/' + %srcNi.toString()<span style=\"color: navy\">)</span> <i>&quot;setSource&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>observationBiol<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcBiology</span><span style=\"color: navy\"> : </span>BiologyTable, <b>source</b> <span style=\"color: maroon\">srcPatient</span><span style=\"color: navy\"> : </span>FHIRPatient, <b>source</b> <span style=\"color: maroon\">srcEncounter</span><span style=\"color: navy\"> : </span>FHIREncounter, <b>target</b> <span style=\"color: maroon\">tgtObservation</span><span style=\"color: navy\"> : </span>FHIRObservation<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcBiology<span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;setId&quot;</i><span style=\"color: navy\">;</span>\r\n  srcBiology.biologyNi<b> as </b><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.meta<b> as </b><span style=\"color: maroon\">tgtMeta</span><b> then </b>setBiologyMeta<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcNi</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\">)</span> <i>&quot;setMeta&quot;</i><span style=\"color: navy\">;</span>\r\n  srcPatient.id<b> as </b><span style=\"color: maroon\">patientId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.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\">newSubject</span><b> then </b>setSubjectReference<span style=\"color: navy\">(</span><span style=\"color: maroon\">patientId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newSubject</span><span style=\"color: navy\">)</span> <i>&quot;setSubjectReference&quot;</i><span style=\"color: navy\">;</span>\r\n  srcEncounter.id<b> as </b><span style=\"color: maroon\">encounterId</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.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\">newEncounter</span><b> then </b>setEncounterReference<span style=\"color: navy\">(</span><span style=\"color: maroon\">encounterId</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newEncounter</span><span style=\"color: navy\">)</span> <i>&quot;setEncounterReference&quot;</i><span style=\"color: navy\">;</span>\r\n  srcBiology<span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.status = <span style=\"color: blue\">'final'</span> <i>&quot;setStatus&quot;</i><span style=\"color: navy\">;</span>\r\n  srcBiology<span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.category = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'vital-signs'</span><span style=\"color: navy\">)</span> <i>&quot;setCategory&quot;</i><span style=\"color: navy\">;</span>\r\n  srcBiology.biologyDatePrel<b> as </b><span style=\"color: maroon\">biologyDatePrel</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.effective = <span style=\"color: maroon\">biologyDatePrel</span> <i>&quot;setDate&quot;</i><span style=\"color: navy\">;</span>\r\n  srcBiology.biologyCode<b> as </b><span style=\"color: maroon\">biologyCode</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.code = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">biologyCode</span><span style=\"color: navy\">)</span> <i>&quot;setCode&quot;</i><span style=\"color: navy\">;</span>\r\n  srcBiology.biologyValue<span style=\"color: navy\"><b> -&gt; </b></span>tgtObservation.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\">tgtObsQuantity</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    srcBiology.biologyValue<b> as </b><span style=\"color: maroon\">biologyValue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtObsQuantity.value = <span style=\"color: maroon\">biologyValue</span> <i>&quot;setValue&quot;</i><span style=\"color: navy\">;</span>\r\n    srcBiology.biologyUnit<b> as </b><span style=\"color: maroon\">biologyUnit</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtObsQuantity.code = <span style=\"color: maroon\">biologyUnit</span><span style=\"color: navy\">, </span> tgtObsQuantity.unit = <span style=\"color: maroon\">biologyUnit</span><span style=\"color: navy\">, </span> tgtObsQuantity.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>&quot;setUnit&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;setQuantity&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setBiologyMeta<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcNi</span>, <b>target</b> <span style=\"color: maroon\">tgtMeta</span><span style=\"color: navy\"> : </span>FHIRMeta<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcNi<span style=\"color: navy\"><b> -&gt; </b></span>tgtMeta.source = <span style=\"color: navy\">(</span>'https://aphp.fr/fhir/Endpoint/dpi/BiologyTable' + '/' + %srcNi.toString()<span style=\"color: navy\">)</span> <i>&quot;setSource&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>setEntryRequestAndFullUrl<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">newRes</span>, <b>target</b> <span style=\"color: maroon\">tgtEntry</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  newRes.id<b> as </b><span style=\"color: maroon\">newResId</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    newResId<span style=\"color: navy\"><b> -&gt; </b></span>tgtEntry.fullUrl = <span style=\"color: navy\">(</span>'https://aphp.fr/' + %newRes.type().name + '/' + %newResId<span style=\"color: navy\">)</span> <i>&quot;setFullUrl&quot;</i><span style=\"color: navy\">;</span>\r\n    newResId<span style=\"color: navy\"><b> -&gt; </b></span> tgtEntry.request<b> as </b><span style=\"color: maroon\">tgtEntryRequest</span><span style=\"color: navy\">, </span> tgtEntryRequest.method = <span style=\"color: blue\">'POST'</span><span style=\"color: navy\">, </span> tgtEntryRequest.url = <span style=\"color: navy\">(</span>%newRes.type().name + '/' + %newResId<span style=\"color: navy\">)</span> <i>&quot;setRequest&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;setResourceType&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
      },
      "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CorePhysical2FHIR",
      "version" : "0.1.0",
      "name" : "CorePhysical2FHIR",
      "title" : "Alignement de l''usage Core du modèle physique du DPI vers les ressources FHIR",
      "status" : "draft",
      "date" : "2026-04-16T14:35:38+00:00",
      "publisher" : "AP-HP",
      "contact" : [
        {
          "name" : "AP-HP",
          "telecom" : [
            {
              "system" : "url",
              "value" : "https://aphp.fr"
            }
          ]
        }
      ],
      "description" : "Alignement de l''usage Core du modèle physique du DPI vers les ressources FHIR",
      "jurisdiction" : [
        {
          "coding" : [
            {
              "system" : "urn:iso:std:iso:3166",
              "code" : "FR"
            }
          ]
        }
      ],
      "structure" : [
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDataSet",
          "mode" : "source",
          "alias" : "DataSet"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CorePatient",
          "mode" : "source",
          "alias" : "PatientTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreSejour",
          "mode" : "source",
          "alias" : "SejourTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreBiology",
          "mode" : "source",
          "alias" : "BiologyTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreClinical",
          "mode" : "source",
          "alias" : "ClinicalTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDiag",
          "mode" : "source",
          "alias" : "DiagTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreActe",
          "mode" : "source",
          "alias" : "ActeTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreAddress",
          "mode" : "source",
          "alias" : "AddressTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationAdm",
          "mode" : "source",
          "alias" : "MedicationAdmTable"
        },
        {
          "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationPre",
          "mode" : "source",
          "alias" : "MedicationPreTable"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
          "mode" : "target",
          "alias" : "FHIRBundle"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Patient",
          "mode" : "target",
          "alias" : "FHIRPatient"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Encounter",
          "mode" : "target",
          "alias" : "FHIREncounter"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Observation",
          "mode" : "target",
          "alias" : "FHIRObservation"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Meta",
          "mode" : "target",
          "alias" : "FHIRMeta"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Procedure",
          "mode" : "target",
          "alias" : "FHIRProcedure"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Condition",
          "mode" : "target",
          "alias" : "FHIRCondition"
        }
      ],
      "group" : [
        {
          "name" : "dataSet",
          "typeMode" : "types",
          "input" : [
            {
              "name" : "srcDataSet",
              "type" : "DataSet",
              "mode" : "source"
            },
            {
              "name" : "tgtBundle",
              "type" : "FHIRBundle",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setId",
              "source" : [
                {
                  "context" : "srcDataSet"
                }
              ],
              "target" : [
                {
                  "context" : "tgtBundle",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "setType",
              "source" : [
                {
                  "context" : "srcDataSet"
                }
              ],
              "target" : [
                {
                  "context" : "tgtBundle",
                  "contextType" : "variable",
                  "element" : "type",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "transaction"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "createPatient",
              "source" : [
                {
                  "context" : "srcDataSet",
                  "element" : "patient",
                  "variable" : "srcPatient"
                }
              ],
              "target" : [
                {
                  "context" : "tgtBundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "tgtPatientEntry"
                },
                {
                  "context" : "tgtPatientEntry",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "newPatient",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Patient"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "setPatient",
                  "source" : [
                    {
                      "context" : "srcPatient"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "patient",
                      "variable" : [
                        "srcPatient",
                        "newPatient"
                      ]
                    }
                  ]
                },
                {
                  "name" : "setRequestAndFullUrl",
                  "source" : [
                    {
                      "context" : "srcPatient"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "setEntryRequestAndFullUrl",
                      "variable" : [
                        "newPatient",
                        "tgtPatientEntry"
                      ]
                    }
                  ]
                },
                {
                  "name" : "addPatientAddress",
                  "source" : [
                    {
                      "context" : "srcDataSet",
                      "element" : "address",
                      "variable" : "srcAddress",
                      "condition" : "patientNi.reference = ('PatientCore/' + %srcPatient.patientNi.toString())"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "patientAddress",
                      "variable" : [
                        "srcAddress",
                        "newPatient"
                      ]
                    }
                  ]
                },
                {
                  "name" : "createEncounter",
                  "source" : [
                    {
                      "context" : "srcDataSet",
                      "element" : "sejour",
                      "variable" : "srcSejour",
                      "condition" : "patientNi.reference = ('PatientCore/' + %srcPatient.patientNi.toString())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtBundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "tgtEncounterEntry"
                    },
                    {
                      "context" : "tgtEncounterEntry",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "newEncounter",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Encounter"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "setEncounter",
                      "source" : [
                        {
                          "context" : "srcSejour"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "encounter",
                          "variable" : [
                            "srcSejour",
                            "newPatient",
                            "newEncounter"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "setRequestAndFullUrl",
                      "source" : [
                        {
                          "context" : "srcSejour"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "setEntryRequestAndFullUrl",
                          "variable" : [
                            "newEncounter",
                            "tgtEncounterEntry"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "createProcedure",
                      "source" : [
                        {
                          "context" : "srcDataSet",
                          "element" : "acte",
                          "variable" : "srcActe",
                          "condition" : "sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgtBundle",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "tgtProcedureEntry"
                        },
                        {
                          "context" : "tgtProcedureEntry",
                          "contextType" : "variable",
                          "element" : "resource",
                          "variable" : "newProcedure",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Procedure"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "setProcedure",
                          "source" : [
                            {
                              "context" : "srcActe"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "procedure",
                              "variable" : [
                                "srcActe",
                                "newPatient",
                                "newEncounter",
                                "newProcedure"
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "setRequestAndFullUrl",
                          "source" : [
                            {
                              "context" : "srcActe"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "setEntryRequestAndFullUrl",
                              "variable" : [
                                "newProcedure",
                                "tgtProcedureEntry"
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "createProcedure",
                      "source" : [
                        {
                          "context" : "srcDataSet",
                          "element" : "diag",
                          "variable" : "srcDiag",
                          "condition" : "sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgtBundle",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "tgtConditionEntry"
                        },
                        {
                          "context" : "tgtConditionEntry",
                          "contextType" : "variable",
                          "element" : "resource",
                          "variable" : "newCondition",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Condition"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "setCondition",
                          "source" : [
                            {
                              "context" : "srcDiag"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "condition",
                              "variable" : [
                                "srcDiag",
                                "newPatient",
                                "newEncounter",
                                "newCondition"
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "setRequestAndFullUrl",
                          "source" : [
                            {
                              "context" : "srcDiag"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "setEntryRequestAndFullUrl",
                              "variable" : [
                                "newCondition",
                                "tgtConditionEntry"
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "createObservation",
                      "source" : [
                        {
                          "context" : "srcDataSet",
                          "element" : "biology",
                          "variable" : "srcBiology",
                          "condition" : "sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgtBundle",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "tgtBiologyEntry"
                        },
                        {
                          "context" : "tgtBiologyEntry",
                          "contextType" : "variable",
                          "element" : "resource",
                          "variable" : "newObservation",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Observation"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "setBiology",
                          "source" : [
                            {
                              "context" : "srcBiology"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "observationBiol",
                              "variable" : [
                                "srcBiology",
                                "newPatient",
                                "newEncounter",
                                "newObservation"
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "setRequestAndFullUrl",
                          "source" : [
                            {
                              "context" : "srcBiology"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "setEntryRequestAndFullUrl",
                              "variable" : [
                                "newObservation",
                                "tgtBiologyEntry"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "patient",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcPatient",
              "type" : "PatientTable",
              "mode" : "source"
            },
            {
              "name" : "tgtPatient",
              "type" : "FHIRPatient",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setId",
              "source" : [
                {
                  "context" : "srcPatient"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatient",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "setMeta",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "patientNi",
                  "variable" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatient",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "tgtMeta"
                }
              ],
              "dependent" : [
                {
                  "name" : "setPatientMeta",
                  "variable" : [
                    "srcNi",
                    "tgtMeta"
                  ]
                }
              ],
              "documentation" : "copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient"
            },
            {
              "name" : "setHumainName",
              "source" : [
                {
                  "context" : "srcPatient"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatient",
                  "contextType" : "variable",
                  "element" : "name",
                  "variable" : "tgtPatientName"
                }
              ],
              "dependent" : [
                {
                  "name" : "setHumainName",
                  "variable" : [
                    "srcPatient",
                    "tgtPatientName"
                  ]
                }
              ]
            },
            {
              "name" : "setHumainNir",
              "source" : [
                {
                  "context" : "srcPatient"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatient",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "tgtPatientIdentifier"
                }
              ],
              "dependent" : [
                {
                  "name" : "setHumainNir",
                  "variable" : [
                    "srcPatient",
                    "tgtPatientIdentifier"
                  ]
                }
              ]
            },
            {
              "name" : "setGender",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "gender",
                  "variable" : "srcPatientGender"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatient",
                  "contextType" : "variable",
                  "element" : "gender",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "srcPatientGender"
                    },
                    {
                      "valueString" : "https://interop.aphp.fr/ig/fhir/dm/ConceptMap/DpiGender2Hl7Gender"
                    },
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ],
              "documentation" : "traduit la valeur du champ gender de la table Patient dans l'élément gender de la ressource FHIR Patient"
            },
            {
              "name" : "setBirthDate",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "birthDate",
                  "variable" : "srcPatientBirthDate"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatient",
                  "contextType" : "variable",
                  "element" : "birthDate",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "srcPatientBirthDate"
                    }
                  ]
                }
              ],
              "documentation" : "copie la valeur du champ birthDate de la table Patient dans l'élément birthDate de la ressource FHIR Patient"
            }
          ]
        },
        {
          "name" : "setPatientMeta",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcNi",
              "mode" : "source"
            },
            {
              "name" : "tgtMeta",
              "type" : "FHIRMeta",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setSource",
              "source" : [
                {
                  "context" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtMeta",
                  "contextType" : "variable",
                  "element" : "source",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://aphp.fr/fhir/Endpoint/dpi/PatientTable' + '/' + %srcNi.toString()"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setHumainName",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcPatient",
              "type" : "PatientTable",
              "mode" : "source"
            },
            {
              "name" : "tgtPatientName",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setUse",
              "source" : [
                {
                  "context" : "srcPatient"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatientName",
                  "contextType" : "variable",
                  "element" : "use",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "usual"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setName",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "name",
                  "variable" : "srcPatientName"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatientName",
                  "contextType" : "variable",
                  "element" : "family",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "srcPatientName"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "setFirstNameAndText",
                  "source" : [
                    {
                      "context" : "srcPatient",
                      "element" : "firstName",
                      "variable" : "srcPatientFirstName"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtPatientName",
                      "contextType" : "variable",
                      "element" : "given",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcPatientFirstName"
                        }
                      ]
                    },
                    {
                      "context" : "tgtPatientName",
                      "contextType" : "variable",
                      "element" : "text",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "%srcPatientFirstName + ' ' + %srcPatientName"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setHumainNir",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcPatient",
              "type" : "PatientTable",
              "mode" : "source"
            },
            {
              "name" : "tgtPatientIdentifier",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setNir",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "nir",
                  "variable" : "srcPatientNir"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatientIdentifier",
                  "contextType" : "variable",
                  "element" : "use",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "official"
                    }
                  ]
                },
                {
                  "context" : "tgtPatientIdentifier",
                  "contextType" : "variable",
                  "element" : "type",
                  "transform" : "cc",
                  "parameter" : [
                    {
                      "valueString" : "https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203"
                    },
                    {
                      "valueString" : "INS-NIR"
                    }
                  ]
                },
                {
                  "context" : "tgtPatientIdentifier",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "urn:oid:1.2.250.1.213.1.4.8"
                    }
                  ]
                },
                {
                  "context" : "tgtPatientIdentifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "srcPatientNir"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "patientAddress",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcAddress",
              "type" : "AddressTable",
              "mode" : "source"
            },
            {
              "name" : "tgtPatient",
              "type" : "FHIRPatient",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setAddress",
              "source" : [
                {
                  "context" : "srcAddress"
                }
              ],
              "target" : [
                {
                  "context" : "tgtPatient",
                  "contextType" : "variable",
                  "element" : "address",
                  "variable" : "newAddress",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Address"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "setZip",
                  "source" : [
                    {
                      "context" : "srcAddress",
                      "element" : "zipCode",
                      "variable" : "srczip"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newAddress",
                      "contextType" : "variable",
                      "element" : "postalCode",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srczip"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setCity",
                  "source" : [
                    {
                      "context" : "srcAddress",
                      "element" : "city",
                      "variable" : "srcCity"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newAddress",
                      "contextType" : "variable",
                      "element" : "city",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcCity"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setCountry",
                  "source" : [
                    {
                      "context" : "srcAddress",
                      "element" : "country",
                      "variable" : "srcCountry"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newAddress",
                      "contextType" : "variable",
                      "element" : "country",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcCountry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setText",
                  "source" : [
                    {
                      "context" : "srcAddress",
                      "element" : "address",
                      "variable" : "srcAddressText"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newAddress",
                      "contextType" : "variable",
                      "element" : "text",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcAddressText"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setUseHome",
                  "source" : [
                    {
                      "context" : "srcAddress",
                      "condition" : "current = true"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newAddress",
                      "contextType" : "variable",
                      "element" : "use",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "home"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setUseOld",
                  "source" : [
                    {
                      "context" : "srcAddress",
                      "condition" : "current = false"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newAddress",
                      "contextType" : "variable",
                      "element" : "use",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "old"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setCoordinatesExtension",
                  "source" : [
                    {
                      "context" : "srcAddress",
                      "condition" : "latitude.exists() or longitude.exists()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newAddress",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "firstLevelExtension",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Extension"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "setflext",
                      "source" : [
                        {
                          "context" : "srcAddress"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "firstLevelExtension",
                          "contextType" : "variable",
                          "element" : "url",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'http://hl7.org/fhir/StructureDefinition/geolocation'"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "setLatExt",
                          "source" : [
                            {
                              "context" : "srcAddress",
                              "element" : "latitude",
                              "variable" : "srcLat"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "firstLevelExtension",
                              "contextType" : "variable",
                              "element" : "extension",
                              "variable" : "latExtension",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Extension"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "setLat",
                              "source" : [
                                {
                                  "context" : "srcLat"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "latExtension",
                                  "contextType" : "variable",
                                  "element" : "url",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "'latitude'"
                                    }
                                  ]
                                },
                                {
                                  "context" : "latExtension",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueId" : "srcLat"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "setLongExt",
                          "source" : [
                            {
                              "context" : "srcAddress",
                              "element" : "longitude",
                              "variable" : "srcLong"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "firstLevelExtension",
                              "contextType" : "variable",
                              "element" : "extension",
                              "variable" : "longExtension",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Extension"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "setLong",
                              "source" : [
                                {
                                  "context" : "srcLong"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "longExtension",
                                  "contextType" : "variable",
                                  "element" : "url",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "'longitude'"
                                    }
                                  ]
                                },
                                {
                                  "context" : "longExtension",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueId" : "srcLong"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "encounter",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcSejour",
              "type" : "SejourTable",
              "mode" : "source"
            },
            {
              "name" : "srcPatient",
              "type" : "FHIRPatient",
              "mode" : "source"
            },
            {
              "name" : "tgtEncounter",
              "type" : "FHIREncounter",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setId",
              "source" : [
                {
                  "context" : "srcSejour"
                }
              ],
              "target" : [
                {
                  "context" : "tgtEncounter",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "setMeta",
              "source" : [
                {
                  "context" : "srcSejour",
                  "element" : "sejourNi",
                  "variable" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtEncounter",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "tgtMeta"
                }
              ],
              "dependent" : [
                {
                  "name" : "setEncounterMeta",
                  "variable" : [
                    "srcNi",
                    "tgtMeta"
                  ]
                }
              ],
              "documentation" : "copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient"
            },
            {
              "name" : "setStatus",
              "source" : [
                {
                  "context" : "srcSejour"
                }
              ],
              "target" : [
                {
                  "context" : "tgtEncounter",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "finished"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setEncounterClass",
              "source" : [
                {
                  "context" : "srcSejour",
                  "element" : "sejourType",
                  "variable" : "srcSejourType"
                }
              ],
              "target" : [
                {
                  "context" : "tgtEncounter",
                  "contextType" : "variable",
                  "element" : "class",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "srcSejourType"
                    },
                    {
                      "valueString" : "https://interop.aphp.fr/ig/fhir/dm/ConceptMap/DpiEncounterType2SemanticLayerEncounterClass"
                    },
                    {
                      "valueString" : "Coding"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setSubjectReference",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "id",
                  "variable" : "patientId"
                }
              ],
              "target" : [
                {
                  "context" : "tgtEncounter",
                  "contextType" : "variable",
                  "element" : "subject",
                  "variable" : "newSubject",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setSubjectReference",
                  "variable" : [
                    "patientId",
                    "newSubject"
                  ]
                }
              ]
            },
            {
              "name" : "patientNi",
              "source" : [
                {
                  "context" : "srcSejour",
                  "element" : "patientNi"
                }
              ],
              "documentation" : "fk vers le patient à conserver pour la construction auto du périmètre final"
            },
            {
              "name" : "setPeriod",
              "source" : [
                {
                  "context" : "srcSejour"
                }
              ],
              "target" : [
                {
                  "context" : "tgtEncounter",
                  "contextType" : "variable",
                  "element" : "period",
                  "variable" : "newActualPeriod",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "setStart",
                  "source" : [
                    {
                      "context" : "srcSejour",
                      "element" : "sejourStart",
                      "variable" : "srcPeriodStart"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newActualPeriod",
                      "contextType" : "variable",
                      "element" : "start",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcPeriodStart"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setEnd",
                  "source" : [
                    {
                      "context" : "srcSejour",
                      "element" : "sejourEnd",
                      "variable" : "srcPeriodEnd"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "newActualPeriod",
                      "contextType" : "variable",
                      "element" : "end",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcPeriodEnd"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setEncounterMeta",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcNi",
              "mode" : "source"
            },
            {
              "name" : "tgtMeta",
              "type" : "FHIRMeta",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setSource",
              "source" : [
                {
                  "context" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtMeta",
                  "contextType" : "variable",
                  "element" : "source",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://aphp.fr/fhir/Endpoint/dpi/SejourTable' + '/' + %srcNi.toString()"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setSubjectReference",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcPatientId",
              "mode" : "source"
            },
            {
              "name" : "newSubject",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setReference",
              "source" : [
                {
                  "context" : "srcPatientId"
                }
              ],
              "target" : [
                {
                  "context" : "newSubject",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'Patient/' + %srcPatientId.toString()"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "procedure",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcActe",
              "type" : "ActeTable",
              "mode" : "source"
            },
            {
              "name" : "srcPatient",
              "type" : "FHIRPatient",
              "mode" : "source"
            },
            {
              "name" : "srcEncounter",
              "type" : "FHIREncounter",
              "mode" : "source"
            },
            {
              "name" : "tgtProcedure",
              "type" : "FHIRProcedure",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setId",
              "source" : [
                {
                  "context" : "srcActe"
                }
              ],
              "target" : [
                {
                  "context" : "tgtProcedure",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "setMeta",
              "source" : [
                {
                  "context" : "srcActe",
                  "element" : "acteNi",
                  "variable" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtProcedure",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "tgtMeta"
                }
              ],
              "dependent" : [
                {
                  "name" : "setProcedureMeta",
                  "variable" : [
                    "srcNi",
                    "tgtMeta"
                  ]
                }
              ]
            },
            {
              "name" : "setSubjectReference",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "id",
                  "variable" : "patientId"
                }
              ],
              "target" : [
                {
                  "context" : "tgtProcedure",
                  "contextType" : "variable",
                  "element" : "subject",
                  "variable" : "newSubject",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setSubjectReference",
                  "variable" : [
                    "patientId",
                    "newSubject"
                  ]
                }
              ]
            },
            {
              "name" : "setEncounterReference",
              "source" : [
                {
                  "context" : "srcEncounter",
                  "element" : "id",
                  "variable" : "encounterId"
                }
              ],
              "target" : [
                {
                  "context" : "tgtProcedure",
                  "contextType" : "variable",
                  "element" : "encounter",
                  "variable" : "newEncounter",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setEncounterReference",
                  "variable" : [
                    "encounterId",
                    "newEncounter"
                  ]
                }
              ]
            },
            {
              "name" : "setStatus",
              "source" : [
                {
                  "context" : "srcActe"
                }
              ],
              "target" : [
                {
                  "context" : "tgtProcedure",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "completed"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setDate",
              "source" : [
                {
                  "context" : "srcActe",
                  "condition" : "dateStart.exists() or dateEnd.exists"
                }
              ],
              "target" : [
                {
                  "context" : "tgtProcedure",
                  "contextType" : "variable",
                  "element" : "performed",
                  "variable" : "tgtProcedurePeriod",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "setActeStart",
                  "source" : [
                    {
                      "context" : "srcActe",
                      "element" : "dateStart",
                      "variable" : "srcActeStart"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtProcedurePeriod",
                      "contextType" : "variable",
                      "element" : "start",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcActeStart"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setActeEnd",
                  "source" : [
                    {
                      "context" : "srcActe",
                      "element" : "dateEnd",
                      "variable" : "srcActeEnd"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtProcedurePeriod",
                      "contextType" : "variable",
                      "element" : "end",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcActeEnd"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setCode",
              "source" : [
                {
                  "context" : "srcActe",
                  "element" : "code",
                  "variable" : "acteCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgtProcedure",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "cc",
                  "parameter" : [
                    {
                      "valueString" : "https://smt.esante.gouv.fr/terminologie-ccam"
                    },
                    {
                      "valueId" : "acteCode"
                    }
                  ]
                }
              ],
              "documentation" : "C'est le code de la CCAM facturante"
            }
          ]
        },
        {
          "name" : "setProcedureMeta",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcNi",
              "mode" : "source"
            },
            {
              "name" : "tgtMeta",
              "type" : "FHIRMeta",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setSource",
              "source" : [
                {
                  "context" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtMeta",
                  "contextType" : "variable",
                  "element" : "source",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://aphp.fr/fhir/Endpoint/dpi/ActeTable' + '/' + %srcNi.toString()"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setEncounterReference",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcEncounterId",
              "mode" : "source"
            },
            {
              "name" : "newEncounter",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setReference",
              "source" : [
                {
                  "context" : "srcEncounterId"
                }
              ],
              "target" : [
                {
                  "context" : "newEncounter",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'Encounter/' + %srcEncounterId.toString()"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "condition",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcDiag",
              "type" : "DiagTable",
              "mode" : "source"
            },
            {
              "name" : "srcPatient",
              "type" : "FHIRPatient",
              "mode" : "source"
            },
            {
              "name" : "srcEncounter",
              "type" : "FHIREncounter",
              "mode" : "source"
            },
            {
              "name" : "tgtCondition",
              "type" : "FHIRCondition",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setId",
              "source" : [
                {
                  "context" : "srcDiag"
                }
              ],
              "target" : [
                {
                  "context" : "tgtCondition",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "setMeta",
              "source" : [
                {
                  "context" : "srcDiag",
                  "element" : "diagNi",
                  "variable" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtCondition",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "tgtMeta"
                }
              ],
              "dependent" : [
                {
                  "name" : "setConditionMeta",
                  "variable" : [
                    "srcNi",
                    "tgtMeta"
                  ]
                }
              ]
            },
            {
              "name" : "setSubjectReference",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "id",
                  "variable" : "patientId"
                }
              ],
              "target" : [
                {
                  "context" : "tgtCondition",
                  "contextType" : "variable",
                  "element" : "subject",
                  "variable" : "newSubject",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setSubjectReference",
                  "variable" : [
                    "patientId",
                    "newSubject"
                  ]
                }
              ]
            },
            {
              "name" : "setEncounterReference",
              "source" : [
                {
                  "context" : "srcEncounter",
                  "element" : "id",
                  "variable" : "encounterId"
                }
              ],
              "target" : [
                {
                  "context" : "tgtCondition",
                  "contextType" : "variable",
                  "element" : "encounter",
                  "variable" : "newEncounter",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setEncounterReference",
                  "variable" : [
                    "encounterId",
                    "newEncounter"
                  ]
                }
              ]
            },
            {
              "name" : "setVerificationStatus",
              "source" : [
                {
                  "context" : "srcDiag"
                }
              ],
              "target" : [
                {
                  "context" : "tgtCondition",
                  "contextType" : "variable",
                  "element" : "verificationStatus",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "confirmed"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setCategory",
              "source" : [
                {
                  "context" : "srcDiag"
                }
              ],
              "target" : [
                {
                  "context" : "tgtCondition",
                  "contextType" : "variable",
                  "element" : "category",
                  "transform" : "cc",
                  "parameter" : [
                    {
                      "valueString" : "http://terminology.hl7.org/CodeSystem/condition-category"
                    },
                    {
                      "valueString" : "encounter-diagnosis"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setCode",
              "source" : [
                {
                  "context" : "srcDiag",
                  "element" : "code",
                  "variable" : "diagCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgtCondition",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "cc",
                  "parameter" : [
                    {
                      "valueString" : "http://hl7.org/fhir/sid/icd-10"
                    },
                    {
                      "valueId" : "diagCode"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setConditionMeta",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcNi",
              "mode" : "source"
            },
            {
              "name" : "tgtMeta",
              "type" : "FHIRMeta",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setSource",
              "source" : [
                {
                  "context" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtMeta",
                  "contextType" : "variable",
                  "element" : "source",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://aphp.fr/fhir/Endpoint/dpi/DiagTable' + '/' + %srcNi.toString()"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "observationBiol",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcBiology",
              "type" : "BiologyTable",
              "mode" : "source"
            },
            {
              "name" : "srcPatient",
              "type" : "FHIRPatient",
              "mode" : "source"
            },
            {
              "name" : "srcEncounter",
              "type" : "FHIREncounter",
              "mode" : "source"
            },
            {
              "name" : "tgtObservation",
              "type" : "FHIRObservation",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setId",
              "source" : [
                {
                  "context" : "srcBiology"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "uuid"
                }
              ]
            },
            {
              "name" : "setMeta",
              "source" : [
                {
                  "context" : "srcBiology",
                  "element" : "biologyNi",
                  "variable" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "tgtMeta"
                }
              ],
              "dependent" : [
                {
                  "name" : "setBiologyMeta",
                  "variable" : [
                    "srcNi",
                    "tgtMeta"
                  ]
                }
              ]
            },
            {
              "name" : "setSubjectReference",
              "source" : [
                {
                  "context" : "srcPatient",
                  "element" : "id",
                  "variable" : "patientId"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "subject",
                  "variable" : "newSubject",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setSubjectReference",
                  "variable" : [
                    "patientId",
                    "newSubject"
                  ]
                }
              ]
            },
            {
              "name" : "setEncounterReference",
              "source" : [
                {
                  "context" : "srcEncounter",
                  "element" : "id",
                  "variable" : "encounterId"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "encounter",
                  "variable" : "newEncounter",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "setEncounterReference",
                  "variable" : [
                    "encounterId",
                    "newEncounter"
                  ]
                }
              ]
            },
            {
              "name" : "setStatus",
              "source" : [
                {
                  "context" : "srcBiology"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "final"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setCategory",
              "source" : [
                {
                  "context" : "srcBiology"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "category",
                  "transform" : "cc",
                  "parameter" : [
                    {
                      "valueString" : "http://terminology.hl7.org/CodeSystem/observation-category"
                    },
                    {
                      "valueString" : "vital-signs"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setDate",
              "source" : [
                {
                  "context" : "srcBiology",
                  "element" : "biologyDatePrel",
                  "variable" : "biologyDatePrel"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "effective",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "biologyDatePrel"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setCode",
              "source" : [
                {
                  "context" : "srcBiology",
                  "element" : "biologyCode",
                  "variable" : "biologyCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "cc",
                  "parameter" : [
                    {
                      "valueString" : "http://loinc.org"
                    },
                    {
                      "valueId" : "biologyCode"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setQuantity",
              "source" : [
                {
                  "context" : "srcBiology",
                  "element" : "biologyValue"
                }
              ],
              "target" : [
                {
                  "context" : "tgtObservation",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "tgtObsQuantity",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Quantity"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "setValue",
                  "source" : [
                    {
                      "context" : "srcBiology",
                      "element" : "biologyValue",
                      "variable" : "biologyValue"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtObsQuantity",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "biologyValue"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setUnit",
                  "source" : [
                    {
                      "context" : "srcBiology",
                      "element" : "biologyUnit",
                      "variable" : "biologyUnit"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtObsQuantity",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "biologyUnit"
                        }
                      ]
                    },
                    {
                      "context" : "tgtObsQuantity",
                      "contextType" : "variable",
                      "element" : "unit",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "biologyUnit"
                        }
                      ]
                    },
                    {
                      "context" : "tgtObsQuantity",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://unitsofmeasure.org"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setBiologyMeta",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcNi",
              "mode" : "source"
            },
            {
              "name" : "tgtMeta",
              "type" : "FHIRMeta",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setSource",
              "source" : [
                {
                  "context" : "srcNi"
                }
              ],
              "target" : [
                {
                  "context" : "tgtMeta",
                  "contextType" : "variable",
                  "element" : "source",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://aphp.fr/fhir/Endpoint/dpi/BiologyTable' + '/' + %srcNi.toString()"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setEntryRequestAndFullUrl",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "newRes",
              "mode" : "source"
            },
            {
              "name" : "tgtEntry",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "setResourceType",
              "source" : [
                {
                  "context" : "newRes",
                  "element" : "id",
                  "variable" : "newResId"
                }
              ],
              "rule" : [
                {
                  "name" : "setFullUrl",
                  "source" : [
                    {
                      "context" : "newResId"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtEntry",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://aphp.fr/' + %newRes.type().name + '/' + %newResId"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "setRequest",
                  "source" : [
                    {
                      "context" : "newResId"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgtEntry",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "tgtEntryRequest"
                    },
                    {
                      "context" : "tgtEntryRequest",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "tgtEntryRequest",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "%newRes.type().name + '/' + %newResId"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }