Données socles des Entrepôts de Données de Santé Hospitalier
0.1.0 - ci-build FRA

Données socles des Entrepôts de Données de Santé Hospitalier - 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

## : Transforms QuestionnaireResponse based on Questionnaire Usage Variables socles into FHIR resources conforming to DM profiles - TTL Representation

Draft as of 2026-05-28

Raw ttl | Download

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

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

     a fhir:StructureMap ;
      fhir:nodeRole fhir:treeRoot ;
      fhir:id [ fhir:v "Q2FSL"] ; #
      fhir:text [
    fhir:status [ fhir:v "generated" ] ;
    fhir:div [ fhir:v "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Narratif généré : StructureMap Q2FSL</b></p><a name=\"Q2FSL\"> </a><a name=\"hcQ2FSL\"> </a><pre class=\"fml\">#xD;\n<b>map</b><span style=\"color: navy\"> \"</span>https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureMap/Q2FSL<span style=\"color: navy\">\" = \"</span>Q2FSL<span style=\"color: navy\">\"#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Transforms QuestionnaireResponse based on Questionnaire Usage Variables socles into FHIR resources conforming to DM profiles</span>#xD;\n#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">\" </span><b>alias </b>QuestionnaireResponse <b>as </b><b>source</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">\" </span><b>alias </b>Bundle <b>as </b><b>target</b>#xD;\n#xD;\n<span style=\"color: navy\">// </span><span style=\"color: green\">Main entry point: Transform QuestionnaireResponse to Bundle</span>#xD;\n<b>group </b>QuestionnaireResponseToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Initialize Bundle</span>#xD;\n  src<span style=\"color: navy\"><b> -&gt; </b></span>bundle.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"bundleid\"</i><span style=\"color: navy\">;</span>#xD;\n  src<span style=\"color: navy\"><b> -&gt; </b></span>bundle.type = <span style=\"color: blue\">'collection'</span> <i>\"bundletype\"</i><span style=\"color: navy\">;</span>#xD;\n  src<span style=\"color: navy\"><b> -&gt; </b></span>bundle.timestamp = <span style=\"color: navy\">(</span>now()<span style=\"color: navy\">)</span> <i>\"setTimestamp\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Create Patient resource</span>#xD;\n  src<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">patientEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>patientEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      src<b> then </b>CreatePatient<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>\"createpatient\"</i><span style=\"color: navy\">;</span>#xD;\n      src<span style=\"color: navy\"><b> -&gt; </b></span> patient.id<b> as </b><span style=\"color: maroon\">patientId</span><span style=\"color: navy\">, </span> patientEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patientId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Create Locations from geocoding data</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">src then CreateLocations(src, patient, bundle) \"create-locations\";</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Create Encounters from PMSI data</span>#xD;\n      src<b> then </b>CreateEncounters<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createencounters\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Create Laboratory Observations</span>#xD;\n      src<b> then </b>CreateLaboratoryObservations<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createlabobservations\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Create Medication Requests</span>#xD;\n      src<b> then </b>CreateMedicationRequests<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createmedicationrequests\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Create Medication Administrations</span>#xD;\n      src<b> then </b>CreateMedicationAdministrations<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createmedicationadministrations\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Create Vital Sign Observations</span>#xD;\n      src<b> then </b>CreateVitalSignObservations<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createvitalsigns\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createpatientresource\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"patiententry\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Patient from QuestionnaireResponse</span>#xD;\n<b>group </b>CreatePatient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>patient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"patientid\"</i><span style=\"color: navy\">;</span>#xD;\n  src<span style=\"color: navy\"><b> -&gt; </b></span>patient.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-patient'</span> <i>\"patientprofile\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"patientmeta\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">// </span><span style=\"color: green\">Extract patient identity data from linkId 4647259356106 &gt; 2958000860428</span>#xD;\n  src.item<b> as </b><span style=\"color: maroon\">socioDemo</span><b> where </b>(linkId = '4647259356106')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    socioDemo.item<b> as </b><span style=\"color: maroon\">identity</span><b> where </b>(linkId = '2958000860428')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      <span style=\"color: navy\">// </span><span style=\"color: green\">Patient name (linkId 8605698058770 = family, 6214879623503 = given)</span>#xD;\n      identity<span style=\"color: navy\"><b> -&gt; </b></span>patient.name = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'HumanName'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">name</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        identity.item<b> as </b><span style=\"color: maroon\">familyItem</span><b> where </b>(linkId = '8605698058770')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>          familyItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>name.family = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"setfamily\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"extractfamily\"</i><span style=\"color: navy\">;</span>#xD;\n        identity.item<b> as </b><span style=\"color: maroon\">givenItem</span><b> where </b>(linkId = '6214879623503')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>          givenItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>name.given = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"setgiven\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"extractgiven\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"setname\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">NIR identifier (linkId 5711960356160)</span>#xD;\n      identity.item<b> as </b><span style=\"color: maroon\">nirItem</span><b> where </b>(linkId = '5711960356160')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        nirItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">nir</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span>nir.system = <span style=\"color: blue\">'urn:oid:1.2.250.1.213.1.4.8'</span> <i>\"nirsystem\"</i><span style=\"color: navy\">;</span>#xD;\n          ans<span style=\"color: navy\"><b> -&gt; </b></span>nir.value = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"nirvalue\"</i><span style=\"color: navy\">;</span>#xD;\n          ans<span style=\"color: navy\"><b> -&gt; </b></span>nir.type = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://interopsante.org/fhir/CodeSystem/fr-v2-0203'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'NIR'</span><span style=\"color: navy\">)</span> <i>\"nirtype\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setnir\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractnir\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">INS identifier (linkId 3764723550987)</span>#xD;\n      identity.item<b> as </b><span style=\"color: maroon\">insItem</span><b> where </b>(linkId = '3764723550987')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        insItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ins</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span>ins.system = <span style=\"color: blue\">'urn:oid:1.2.250.1.213.1.4.10'</span> <i>\"inssystem\"</i><span style=\"color: navy\">;</span>#xD;\n          ans<span style=\"color: navy\"><b> -&gt; </b></span>ins.value = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"insvalue\"</i><span style=\"color: navy\">;</span>#xD;\n          ans<span style=\"color: navy\"><b> -&gt; </b></span>ins.type = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://interopsante.org/fhir/CodeSystem/fr-v2-0203'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'INS-C'</span><span style=\"color: navy\">)</span> <i>\"instype\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setins\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractins\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Birth date (linkId 5036133558154)</span>#xD;\n      identity.item<b> as </b><span style=\"color: maroon\">birthItem</span><b> where </b>(linkId = '5036133558154')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        birthItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.birthDate = <span style=\"color: navy\">(</span>%ans.valueDate<span style=\"color: navy\">)</span> <i>\"setbirthdate\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractbirthdate\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Death date (linkId 5633552097315)</span>#xD;\n      identity.item<b> as </b><span style=\"color: maroon\">deathItem</span><b> where </b>(linkId = '5633552097315')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        deathItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.deceased = <span style=\"color: navy\">(</span>%ans.valueDate<span style=\"color: navy\">)</span> <i>\"setdeceaseddate\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Death source (linkId 9098810065693)</span>#xD;\n        deathItem.item<b> as </b><span style=\"color: maroon\">deathSource</span><b> where </b>(linkId = '9098810065693')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>          deathSource.answer<b> as </b><span style=\"color: maroon\">sourceAns</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.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\">ext</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            sourceAns<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-death-source'</span> <i>\"deathsourceurl\"</i><span style=\"color: navy\">;</span>#xD;\n            sourceAns<span style=\"color: navy\"><b> -&gt; </b></span>ext.value = <span style=\"color: navy\">(</span>%sourceAns.valueCoding<span style=\"color: navy\">)</span> <i>\"deathsourcevalue\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"setdeathsourceext\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"extractdeathsource\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractdeath\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Multiple birth rank (linkId 6931296968515)</span>#xD;\n      identity.item<b> as </b><span style=\"color: maroon\">multipleItem</span><b> where </b>(linkId = '6931296968515')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        multipleItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.multipleBirth = <span style=\"color: navy\">(</span>%ans.valueInteger<span style=\"color: navy\">)</span> <i>\"setmultiplebirth\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractmultiplebirth\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"processidentity\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">// </span><span style=\"color: green\">Gender from PMSI data (linkId 3894630481120 within 2825244231605)</span>#xD;\n    src.item<b> as </b><span style=\"color: maroon\">pmsiGroup</span><b> where </b>(linkId = '2825244231605')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      pmsiGroup.item<b> as </b><span style=\"color: maroon\">sexItem</span><b> where </b>(linkId = '3894630481120')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        sexItem.answer<b> as </b><span style=\"color: maroon\">ans</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans.valueString<b> as </b><span style=\"color: maroon\">female</span><b> where </b>($this = 'f')<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'female'</span> <i>\"setGenderF\"</i><span style=\"color: navy\">;</span>#xD;\n          ans.valueString<b> as </b><span style=\"color: maroon\">female</span><b> where </b>($this = 'm')<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'male'</span> <i>\"setGenderM\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"valueCoding\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractgender\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Address from code géographique (linkId 2446369196222)</span>#xD;\n      pmsiGroup.item<b> as </b><span style=\"color: maroon\">codeGeoItem</span><b> where </b>(linkId = '2446369196222')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        codeGeoItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.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\">addr</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span>addr.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\">ext</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            ans<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-pmsi-code-geo'</span> <i>\"codegeourl\"</i><span style=\"color: navy\">;</span>#xD;\n            ans.value<b> as </b><span style=\"color: maroon\">val</span><span style=\"color: navy\"><b> -&gt; </b></span>ext.value = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">val</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span> <i>\"codegeovalue\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"setcodegeoext\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">// </span><span style=\"color: green\">Environnement</span>#xD;\n          socioDemo.item<b> as </b><span style=\"color: maroon\">environnementItem</span><b> where </b>(linkId = '5491974639955')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>            <span style=\"color: navy\">// </span><span style=\"color: green\">geolocation</span>#xD;\n            environnementItem.item<b> as </b><span style=\"color: maroon\">geocodageItem</span><b> where </b>(linkId = '3816475533472')<span style=\"color: navy\"><b> -&gt; </b></span>addr.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\">geolocationExt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              geocodageItem.item<b> as </b><span style=\"color: maroon\">latItem</span><b> where </b>(linkId = '3709843054556')<span style=\"color: navy\"><b> -&gt; </b></span> geolocationExt.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/geolocation'</span><span style=\"color: navy\">, </span> geolocationExt.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\">latExt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                latItem.answer<b> as </b><span style=\"color: maroon\">lat</span><span style=\"color: navy\"><b> -&gt; </b></span> latExt.url = <span style=\"color: blue\">'latitude'</span><span style=\"color: navy\">, </span> latExt.value = <span style=\"color: navy\">(</span>%lat.valueDecimal<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                  geocodageItem.item<b> as </b><span style=\"color: maroon\">longItem</span><b> where </b>(linkId = '7651448032665')<span style=\"color: navy\"><b> -&gt; </b></span>geolocationExt.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\">longExt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                    longItem.answer<b> as </b><span style=\"color: maroon\">long</span><span style=\"color: navy\"><b> -&gt; </b></span> longExt.url = <span style=\"color: blue\">'longitude'</span><span style=\"color: navy\">, </span> longExt.value = <span style=\"color: navy\">(</span>%long.valueDecimal<span style=\"color: navy\">)</span> <i>\"setLong\"</i><span style=\"color: navy\">;</span>#xD;\n                  <span style=\"color: navy\">}</span> <i>\"createLongExt\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">}</span> <i>\"setLat\"</i><span style=\"color: navy\">;</span>#xD;\n              <span style=\"color: navy\">}</span> <i>\"createLatExt\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"createGeolocExt\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">IRIS</span>#xD;\n            environnementItem.item<b> as </b><span style=\"color: maroon\">irisItem</span><b> where </b>(linkId = '7621032273792')<span style=\"color: navy\"><b> -&gt; </b></span> addr.line<b> as </b><span style=\"color: maroon\">addrLine</span><span style=\"color: navy\">, </span> addrLine.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\">irisExt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              irisItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span> irisExt.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-censusTract'</span><span style=\"color: navy\">, </span> irisExt.valueString = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"setIrisExt\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"navIrisItem\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"navEnv\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setaddress\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractcodegeo\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"extractpmsidemographics\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"processsociodemographics\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Locations from geocoding and IRIS data</span>#xD;\n<b>group </b>CreateLocations<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Extract geocoding data from linkId 4647259356106 &gt; 5491974639955 &gt; 3816475533472</span>#xD;\n  src.item<b> as </b><span style=\"color: maroon\">socioDemo</span><b> where </b>(linkId = '4647259356106')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    socioDemo.item<b> as </b><span style=\"color: maroon\">environment</span><b> where </b>(linkId = '5491974639955')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      <span style=\"color: navy\">// </span><span style=\"color: green\">Geocoding locations (repeating group 3816475533472)</span>#xD;\n      environment.item<b> as </b><span style=\"color: maroon\">geocodingItem</span><b> where </b>(linkId = '3816475533472')<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">locationEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        geocodingItem<span style=\"color: navy\"><b> -&gt; </b></span>locationEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Location'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">location</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          geocodingItem<span style=\"color: navy\"><b> -&gt; </b></span>location.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"locationid\"</i><span style=\"color: navy\">;</span>#xD;\n          geocodingItem<span style=\"color: navy\"><b> -&gt; </b></span>location.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            geocodingItem<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-location'</span> <i>\"locationprofile\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"locationmeta\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">// </span><span style=\"color: green\">Position with latitude and longitude</span>#xD;\n          geocodingItem<span style=\"color: navy\"><b> -&gt; </b></span>location.position = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'LocationPosition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">pos</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            <span style=\"color: navy\">// </span><span style=\"color: green\">Latitude (linkId 3709843054556)</span>#xD;\n            geocodingItem.item<b> as </b><span style=\"color: maroon\">latItem</span><b> where </b>(linkId = '3709843054556')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              latItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>pos.latitude = <span style=\"color: navy\">(</span>%ans.valueDecimal<span style=\"color: navy\">)</span> <i>\"setlatitude\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"extractlatitude\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Longitude (linkId 7651448032665)</span>#xD;\n            geocodingItem.item<b> as </b><span style=\"color: maroon\">longItem</span><b> where </b>(linkId = '7651448032665')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              longItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>pos.longitude = <span style=\"color: navy\">(</span>%ans.valueDecimal<span style=\"color: navy\">)</span> <i>\"setlongitude\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"extractlongitude\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"setposition\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">// </span><span style=\"color: green\">Extension for collection date (linkId 1185653257776)</span>#xD;\n          <span style=\"color: navy\">// </span><span style=\"color: green\">geocodingItem.item as dateItem where (linkId = '1185653257776') then {             dateItem.answer as ans -&gt; location.extension = create('Extension') as ext then {               ans -&gt; ext.url = 'http://hl7.org/fhir/StructureDefinition/data-collection-date' \"date-url\";               ans -&gt; ext.value = (%ans.valueDate) \"date-value\";             } \"set-collection-date\";           } \"extract-collection-date\";</span>#xD;\n          location<span style=\"color: navy\"><b> -&gt; </b></span>locationEntry.request<b> as </b><span style=\"color: maroon\">request</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            location<span style=\"color: navy\"><b> -&gt; </b></span>request.method = <span style=\"color: blue\">'POST'</span> <i>\"setmethod\"</i><span style=\"color: navy\">;</span>#xD;\n            location<span style=\"color: navy\"><b> -&gt; </b></span>request.url = <span style=\"color: blue\">'Location'</span> <i>\"seturl\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"setrequest\"</i><span style=\"color: navy\">;</span>#xD;\n          location.id<b> as </b><span style=\"color: maroon\">locId</span><span style=\"color: navy\"><b> -&gt; </b></span>locationEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">locId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"createlocation\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"geocodinglocationentry\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">IRIS locations (repeating item 7621032273792)</span>#xD;\n      environment.item<b> as </b><span style=\"color: maroon\">irisItem</span><b> where </b>(linkId = '7621032273792')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        irisItem.answer<b> as </b><span style=\"color: maroon\">irisAnswer</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">locationEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          irisAnswer<span style=\"color: navy\"><b> -&gt; </b></span>locationEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Location'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">location</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            irisAnswer<span style=\"color: navy\"><b> -&gt; </b></span>location.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"locationid\"</i><span style=\"color: navy\">;</span>#xD;\n            irisAnswer<span style=\"color: navy\"><b> -&gt; </b></span>location.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              irisAnswer<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-location'</span> <i>\"locationprofile\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"locationmeta\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">IRIS code as identifier</span>#xD;\n            irisAnswer<span style=\"color: navy\"><b> -&gt; </b></span>location.identifier = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">identifier</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              irisAnswer<span style=\"color: navy\"><b> -&gt; </b></span>identifier.system = <span style=\"color: blue\">'urn:oid:2.16.840.1.113883.2.8.1.5.5'</span> <i>\"irissystem\"</i><span style=\"color: navy\">;</span>#xD;\n              irisAnswer<span style=\"color: navy\"><b> -&gt; </b></span>identifier.value = <span style=\"color: navy\">(</span>%irisAnswer.valueCoding.code<span style=\"color: navy\">)</span> <i>\"irisvalue\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"setirisidentifier\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Collection date from nested item (linkId 4999580038872)</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">irisAnswer.item as dateItem where (linkId = '4999580038872') then {               dateItem.answer as ans -&gt; location.extension = create('Extension') as ext then {                 ans -&gt; ext.url = 'http://hl7.org/fhir/StructureDefinition/data-collection-date' \"date-url\";                 ans -&gt; ext.value = (%ans.valueDate) \"date-value\";               } \"set-collection-date\";             } \"extract-iris-date\";</span>#xD;\n            location<span style=\"color: navy\"><b> -&gt; </b></span>locationEntry.request<b> as </b><span style=\"color: maroon\">request</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              location<span style=\"color: navy\"><b> -&gt; </b></span>request.method = <span style=\"color: blue\">'POST'</span> <i>\"setmethod\"</i><span style=\"color: navy\">;</span>#xD;\n              location<span style=\"color: navy\"><b> -&gt; </b></span>request.url = <span style=\"color: blue\">'Location'</span> <i>\"seturl\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"setrequest\"</i><span style=\"color: navy\">;</span>#xD;\n            location.id<b> as </b><span style=\"color: maroon\">locId</span><span style=\"color: navy\"><b> -&gt; </b></span>locationEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">locId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"createirislocation\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"irislocationentry\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"processiris\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"processenvironment\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"processsociodemographicslocation\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Encounters from PMSI data</span>#xD;\n<b>group </b>CreateEncounters<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">PMSI data group (linkId 2825244231605) - Note: This can repeat in the structure</span>#xD;\n  src.item<b> as </b><span style=\"color: maroon\">pmsiItem</span><b> where </b>(linkId = '2825244231605')<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">encounterEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    pmsiItem<span style=\"color: navy\"><b> -&gt; </b></span>encounterEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Encounter'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">encounter</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      pmsiItem<span style=\"color: navy\"><b> -&gt; </b></span>encounter.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"encounterid\"</i><span style=\"color: navy\">;</span>#xD;\n      pmsiItem<span style=\"color: navy\"><b> -&gt; </b></span>encounter.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        pmsiItem<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-encounter'</span> <i>\"encounterprofile\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"encountermeta\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">status</span>#xD;\n      src<span style=\"color: navy\"><b> -&gt; </b></span>encounter.status = <span style=\"color: blue\">'finished'</span> <i>\"setStatus\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">class</span>#xD;\n      src<span style=\"color: navy\"><b> -&gt; </b></span>encounter.class = <b>c</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v3-ActCode'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'IMP'</span><span style=\"color: navy\">)</span> <i>\"setClass\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n      src<span style=\"color: navy\"><b> -&gt; </b></span> encounter.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Encounter period (start: 5991443718282, end: 6114780320846)</span>#xD;\n      pmsiItem<span style=\"color: navy\"><b> -&gt; </b></span>encounter.period = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Period'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">period</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        pmsiItem.item<b> as </b><span style=\"color: maroon\">startItem</span><b> where </b>(linkId = '5991443718282')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>          startItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>period.start = <span style=\"color: navy\">(</span>%ans.valueDate<span style=\"color: navy\">)</span> <i>\"setstart\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"extractstart\"</i><span style=\"color: navy\">;</span>#xD;\n        pmsiItem.item<b> as </b><span style=\"color: maroon\">endItem</span><b> where </b>(linkId = '6114780320846')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>          endItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>period.end = <span style=\"color: navy\">(</span>%ans.valueDate<span style=\"color: navy\">)</span> <i>\"setend\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"extractend\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"setperiod\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Mode d'entrée (linkId 6172398101212)</span>#xD;\n      pmsiItem.item<b> as </b><span style=\"color: maroon\">modeInItem</span><b> where </b>(linkId = '6172398101212')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        modeInItem.answer<b> as </b><span style=\"color: maroon\">ans</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans.valueString<b> as </b><span style=\"color: maroon\">valueString</span><span style=\"color: navy\"><b> -&gt; </b></span> encounter.hospitalization<b> as </b><span style=\"color: maroon\">hosp</span><span style=\"color: navy\">, </span> hosp.admitSource<b> as </b><span style=\"color: maroon\">admitSource</span><span style=\"color: navy\">, </span> admitSource.coding<b> as </b><span style=\"color: maroon\">admitSourceCoding</span><span style=\"color: navy\">, </span> admitSourceCoding.code = <span style=\"color: maroon\">valueString</span> <i>\"setadmitsource\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"navValue\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractmodein\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Mode de sortie (linkId 3354867075704)</span>#xD;\n      pmsiItem.item<b> as </b><span style=\"color: maroon\">modeOutItem</span><b> where </b>(linkId = '3354867075704')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        modeOutItem.answer<b> as </b><span style=\"color: maroon\">ans</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans.valueString<b> as </b><span style=\"color: maroon\">valueString</span><span style=\"color: navy\"><b> -&gt; </b></span> encounter.hospitalization<b> as </b><span style=\"color: maroon\">hosp</span><span style=\"color: navy\">, </span> hosp.dischargeDisposition<b> as </b><span style=\"color: maroon\">dischargeDisposition</span><span style=\"color: navy\">, </span> dischargeDisposition.coding<b> as </b><span style=\"color: maroon\">dischargeDispositionCoding</span><span style=\"color: navy\">, </span> dischargeDispositionCoding.code = <span style=\"color: maroon\">valueString</span> <i>\"setdischargedisposition\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"navValue\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractmodeout\"</i><span style=\"color: navy\">;</span>#xD;\n      src<span style=\"color: navy\"><b> -&gt; </b></span> encounter.id<b> as </b><span style=\"color: maroon\">encId</span><span style=\"color: navy\">, </span> encounterEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">encId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Create nested Conditions and Procedures</span>#xD;\n      pmsiItem<b> then </b>CreateConditions<span style=\"color: navy\">(</span><span style=\"color: maroon\">pmsiItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">encounter</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createconditions\"</i><span style=\"color: navy\">;</span>#xD;\n      pmsiItem<b> then </b>CreateProcedures<span style=\"color: navy\">(</span><span style=\"color: maroon\">pmsiItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">encounter</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createprocedures\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createencounter\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"encounterentry\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Conditions from nested diagnostics</span>#xD;\n<b>group </b>CreateConditions<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">pmsiItem</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">encounter</span><span style=\"color: navy\"> : </span>Encounter, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Diagnostics group (linkId 9391816419630) - can repeat</span>#xD;\n  pmsiItem.item<b> as </b><span style=\"color: maroon\">diagGroup</span><b> where </b>(linkId = '9391816419630')<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">conditionEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    diagGroup<span style=\"color: navy\"><b> -&gt; </b></span>conditionEntry.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\">condition</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      diagGroup<span style=\"color: navy\"><b> -&gt; </b></span>condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"conditionid\"</i><span style=\"color: navy\">;</span>#xD;\n      diagGroup<span style=\"color: navy\"><b> -&gt; </b></span>condition.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        diagGroup<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-condition'</span> <i>\"conditionprofile\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"conditionmeta\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n      diagGroup<span style=\"color: navy\"><b> -&gt; </b></span> condition.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Link to encounter</span>#xD;\n      diagGroup<span style=\"color: navy\"><b> -&gt; </b></span> encounter.id<b> as </b><span style=\"color: maroon\">encId</span><span style=\"color: navy\">, </span> condition.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\">ref</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Encounter/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">encId</span><span style=\"color: navy\">)</span> <i>\"setencounter\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Diagnostic code (linkId 5505101189372) - CIM-10</span>#xD;\n      diagGroup.item<b> as </b><span style=\"color: maroon\">diagCodeItem</span><b> where </b>(linkId = '5505101189372')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        diagCodeItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>condition.code = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">code</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span> code.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"setcoding\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setcode\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractdiagcode\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Type de diagnostic (linkId 6427586743735) - DP/DAS/DR</span>#xD;\n      diagGroup.item<b> as </b><span style=\"color: maroon\">diagTypeItem</span><b> where </b>(linkId = '6427586743735')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        diagTypeItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>condition.category = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">category</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span>category.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            ans<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/CodeSystem/pmsi-mco-diag-type'</span> <i>\"diagtypesystem\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"diagtypecode\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"setcategorycoding\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setcategory\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractdiagtype\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Recorded date (linkId 7114466839467)</span>#xD;\n      diagGroup.item<b> as </b><span style=\"color: maroon\">dateItem</span><b> where </b>(linkId = '7114466839467')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        dateItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>condition.recordedDate = <span style=\"color: navy\">(</span>%ans.valueDate<span style=\"color: navy\">)</span> <i>\"setrecordeddate\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractrecordeddate\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">fullurl</span>#xD;\n      pmsiItem<span style=\"color: navy\"><b> -&gt; </b></span> condition.id<b> as </b><span style=\"color: maroon\">condId</span><span style=\"color: navy\">, </span> conditionEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">condId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createcondition\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"conditionentry\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Procedures from nested actes</span>#xD;\n<b>group </b>CreateProcedures<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">pmsiItem</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">encounter</span><span style=\"color: navy\"> : </span>Encounter, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Actes group (linkId 591926901726) - can repeat</span>#xD;\n  pmsiItem.item<b> as </b><span style=\"color: maroon\">acteGroup</span><b> where </b>(linkId = '591926901726')<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">procedureEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    acteGroup<span style=\"color: navy\"><b> -&gt; </b></span>procedureEntry.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\">procedure</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      acteGroup<span style=\"color: navy\"><b> -&gt; </b></span>procedure.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"procedureid\"</i><span style=\"color: navy\">;</span>#xD;\n      acteGroup<span style=\"color: navy\"><b> -&gt; </b></span>procedure.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        acteGroup<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-procedure'</span> <i>\"procedureprofile\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"proceduremeta\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">status</span>#xD;\n      acteGroup<span style=\"color: navy\"><b> -&gt; </b></span>procedure.status = <span style=\"color: blue\">'completed'</span> <i>\"setStatus\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n      acteGroup<span style=\"color: navy\"><b> -&gt; </b></span> procedure.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Link to encounter</span>#xD;\n      acteGroup<span style=\"color: navy\"><b> -&gt; </b></span> encounter.id<b> as </b><span style=\"color: maroon\">encId</span><span style=\"color: navy\">, </span> procedure.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\">ref</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Encounter/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">encId</span><span style=\"color: navy\">)</span> <i>\"setencounter\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Acte code (linkId 7758110033600) - CCAM</span>#xD;\n      acteGroup.item<b> as </b><span style=\"color: maroon\">acteCodeItem</span><b> where </b>(linkId = '7758110033600')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        acteCodeItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>procedure.code = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">code</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span> code.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"setcoding\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setcode\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractactecode\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Date de l'acte (linkId 5066866286682)</span>#xD;\n      acteGroup.item<b> as </b><span style=\"color: maroon\">dateItem</span><b> where </b>(linkId = '5066866286682')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        dateItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>procedure.performed = <span style=\"color: navy\">(</span>%ans.valueDateTime<span style=\"color: navy\">)</span> <i>\"setperformed\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractperformeddate\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">fullurl</span>#xD;\n      pmsiItem<span style=\"color: navy\"><b> -&gt; </b></span> procedure.id<b> as </b><span style=\"color: maroon\">procId</span><span style=\"color: navy\">, </span> procedureEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">procId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createprocedure\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"procedureentry\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Medication Requests</span>#xD;\n<b>group </b>CreateMedicationRequests<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Exposition médicamenteuse (linkId 817801935685)</span>#xD;\n  src.item<b> as </b><span style=\"color: maroon\">medExpoGroup</span><b> where </b>(linkId = '817801935685')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    <span style=\"color: navy\">// </span><span style=\"color: green\">Médicament prescrit (linkId 156631794800) - repeating</span>#xD;\n    medExpoGroup.item<b> as </b><span style=\"color: maroon\">prescribedGroup</span><b> where </b>(linkId = '156631794800')<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">medReqEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span>medReqEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'MedicationRequest'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">medReq</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span>medReq.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"medreqid\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">fullurl</span>#xD;\n        src<span style=\"color: navy\"><b> -&gt; </b></span> medReq.id<b> as </b><span style=\"color: maroon\">medReqId</span><span style=\"color: navy\">, </span> medReqEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">medReqId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n        prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span>medReq.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-medication-request'</span> <i>\"medreqprofile\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"medreqmeta\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n        prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span> medReq.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Status and intent</span>#xD;\n        prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span>medReq.status = <span style=\"color: blue\">'active'</span> <i>\"setstatus\"</i><span style=\"color: navy\">;</span>#xD;\n        prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span>medReq.intent = <span style=\"color: blue\">'order'</span> <i>\"setintent\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">MedicationCodeableConcept</span>#xD;\n        prescribedGroup.answer<b> as </b><span style=\"color: maroon\">prescribedMedication</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          prescribedMedication.item<b> as </b><span style=\"color: maroon\">atcItem</span><b> where </b>(linkId = '1923143398283')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>            atcItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span> medReq.medication = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">medReqCC</span><span style=\"color: navy\">, </span> medReqCC.coding<b> as </b><span style=\"color: maroon\">medReqC</span><span style=\"color: navy\">, </span> medReqC.code = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> medReqC.display = <span style=\"color: navy\">(</span>%prescribedMedication.valueString<span style=\"color: navy\">)</span> <i>\"setAtcCoding\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"navAtcItem\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"navPrescribedMedication\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Create Medication resource and reference</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">prescribedGroup -&gt; bundle.entry as medEntry then {           prescribedGroup -&gt; medEntry.resource = create('Medication') as medication then {             prescribedGroup -&gt; medication.id = uuid() \"med-id\";              // ATC code from nested items             prescribedGroup.item as atcItem where (linkId.contains('ATC')) then {               atcItem.answer as ans -&gt; medication.code = create('CodeableConcept') as code then {                 ans -&gt; code.coding = (%ans.valueCoding) \"set-atc-coding\";               } \"set-med-code\";             } \"extract-atc\";              prescribedGroup -&gt; medication.id as medId, medEntry.fullUrl = append('urn:uuid:', medId) \"set-fullUrl\";              // Link MedicationRequest to Medication             prescribedGroup -&gt; medication.id as medId, medReq.medication = create('Reference') as ref, ref.reference = append('Medication/', medId) \"set-medication-reference\";            } \"create-medication\";         } \"medication-entry\";</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Dosage instructions</span>#xD;\n        prescribedGroup<span style=\"color: navy\"><b> -&gt; </b></span>medReq.dosageInstruction = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Dosage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">dosage</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          <span style=\"color: navy\">// </span><span style=\"color: green\">Route</span>#xD;\n          prescribedGroup.answer<b> as </b><span style=\"color: maroon\">prescribedMedication</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            prescribedMedication.item<b> as </b><span style=\"color: maroon\">routeItem</span><b> where </b>(linkId = '387026794874')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              routeItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>dosage.route<b> as </b><span style=\"color: maroon\">route</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                ans<span style=\"color: navy\"><b> -&gt; </b></span> route.coding<b> as </b><span style=\"color: maroon\">routeCoding</span><span style=\"color: navy\">, </span> routeCoding.code = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"setroutecoding\"</i><span style=\"color: navy\">;</span>#xD;\n              <span style=\"color: navy\">}</span> <i>\"setroute\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"navRouteItem\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"navPrescribedMedication\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">// </span><span style=\"color: green\">Timing</span>#xD;\n          medExpoGroup.item<b> as </b><span style=\"color: maroon\">posoGroup</span><b> where </b>(linkId = '6348237104421')<span style=\"color: navy\"><b> -&gt; </b></span> dosage.timing<b> as </b><span style=\"color: maroon\">timing</span><span style=\"color: navy\">, </span> timing.repeat<b> as </b><span style=\"color: maroon\">timingRepeat</span><span style=\"color: navy\">, </span> timingRepeat.boundsPeriod<b> as </b><span style=\"color: maroon\">timingPeriod</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            posoGroup.item<b> as </b><span style=\"color: maroon\">DateDebItem</span><b> where </b>(linkId = '316347573327')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              DateDebItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>timingPeriod.start = <span style=\"color: navy\">(</span>%ans.valueDate<span style=\"color: navy\">)</span> <i>\"setDateDeb\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"navDateDeb\"</i><span style=\"color: navy\">;</span>#xD;\n            posoGroup.item<b> as </b><span style=\"color: maroon\">DateFinItem</span><b> where </b>(linkId = '429570775935')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              DateFinItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>timingPeriod.end = <span style=\"color: navy\">(</span>%ans.valueDate<span style=\"color: navy\">)</span> <i>\"setDateFin\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"navDateFin\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"navPoso\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setdosage\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"createmedreq\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"medreqentry\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"processmedexpo\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Medication Administrations</span>#xD;\n<b>group </b>CreateMedicationAdministrations<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Exposition médicamenteuse (linkId 817801935685)</span>#xD;\n  src.item<b> as </b><span style=\"color: maroon\">medExpoGroup</span><b> where </b>(linkId = '817801935685')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    <span style=\"color: navy\">// </span><span style=\"color: green\">Médicament administré (linkId 266852453304) - repeating</span>#xD;\n    medExpoGroup.item<b> as </b><span style=\"color: maroon\">adminGroup</span><b> where </b>(linkId = '266852453304')<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">medAdminEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      adminGroup<span style=\"color: navy\"><b> -&gt; </b></span>medAdminEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'MedicationAdministration'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">medAdmin</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        adminGroup<span style=\"color: navy\"><b> -&gt; </b></span>medAdmin.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"medadminid\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">fullurl</span>#xD;\n        src<span style=\"color: navy\"><b> -&gt; </b></span> medAdmin.id<b> as </b><span style=\"color: maroon\">medAdminId</span><span style=\"color: navy\">, </span> medAdminEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">medAdminId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n        adminGroup<span style=\"color: navy\"><b> -&gt; </b></span>medAdmin.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          adminGroup<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-medication-administration'</span> <i>\"medadminprofile\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"medadminmeta\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n        adminGroup<span style=\"color: navy\"><b> -&gt; </b></span> medAdmin.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Status</span>#xD;\n        adminGroup<span style=\"color: navy\"><b> -&gt; </b></span>medAdmin.status = <span style=\"color: blue\">'completed'</span> <i>\"setstatus\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">MedicationCodeableConcept</span>#xD;\n        adminGroup.answer<b> as </b><span style=\"color: maroon\">administeredMedication</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          administeredMedication.item<b> as </b><span style=\"color: maroon\">atcItem</span><b> where </b>(linkId = '631972144976')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>            atcItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span> medAdmin.medication = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">medAdminCC</span><span style=\"color: navy\">, </span> medAdminCC.coding<b> as </b><span style=\"color: maroon\">medAdminC</span><span style=\"color: navy\">, </span> medAdminC.code = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> medAdminC.display = <span style=\"color: navy\">(</span>%administeredMedication.valueString<span style=\"color: navy\">)</span> <i>\"setAtcCoding\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"navAtcItem\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"navadministeredMedication\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Create Medication resource and reference</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">adminGroup -&gt; bundle.entry as medEntry then {           adminGroup -&gt; medEntry.resource = create('Medication') as medication then {             adminGroup -&gt; medication.id = uuid() \"med-id\";              // ATC code from nested items             adminGroup.item as atcItem where (linkId.contains('ATC')) then {               atcItem.answer as ans -&gt; medication.code = create('CodeableConcept') as code then {                 ans -&gt; code.coding = (%ans.valueCoding) \"set-atc-coding\";               } \"set-med-code\";             } \"extract-atc\";              adminGroup -&gt; medication.id as medId, medEntry.fullUrl = append('Medication/', medId) \"set-fullUrl\";              // Link MedicationAdministration to Medication             adminGroup -&gt; medication.id as medId, medAdmin.medication = create('Reference') as ref, ref.reference = append('urn:uuid:', medId) \"set-medication-reference\";            } \"create-medication\";         } \"medication-entry\";</span>#xD;\n        <span style=\"color: navy\">// </span><span style=\"color: green\">Dosage (FHIR)</span>#xD;\n        adminGroup<span style=\"color: navy\"><b> -&gt; </b></span>medAdmin.dosage<b> as </b><span style=\"color: maroon\">dosage</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          <span style=\"color: navy\">// </span><span style=\"color: green\">Route</span>#xD;\n          adminGroup.answer<b> as </b><span style=\"color: maroon\">administeredMedication</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            administeredMedication.item<b> as </b><span style=\"color: maroon\">routeItem</span><b> where </b>(linkId = '811931484859')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              routeItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>dosage.route = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">route</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                ans<span style=\"color: navy\"><b> -&gt; </b></span> route.coding<b> as </b><span style=\"color: maroon\">routeCoding</span><span style=\"color: navy\">, </span> routeCoding.code = <span style=\"color: navy\">(</span>%ans.valueString<span style=\"color: navy\">)</span> <i>\"setroutecoding\"</i><span style=\"color: navy\">;</span>#xD;\n              <span style=\"color: navy\">}</span> <i>\"setroute\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"navRoute\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"navadministeredMedication\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">// </span><span style=\"color: green\">Dosage (QR)</span>#xD;\n          medExpoGroup.item<b> as </b><span style=\"color: maroon\">doseGroup</span><b> where </b>(linkId = '5720103839343')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>            <span style=\"color: navy\">// </span><span style=\"color: green\">Dose</span>#xD;\n            doseGroup.item<b> as </b><span style=\"color: maroon\">quantityItem</span><b> where </b>(linkId = '4765772671997')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              quantityItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>dosage.dose = <span style=\"color: navy\">(</span>%ans.valueQuantity<span style=\"color: navy\">)</span> <i>\"setDose\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"navquantity\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Effective period</span>#xD;\n            doseGroup.item<b> as </b><span style=\"color: maroon\">startItem</span><b> where </b>(linkId = '1443558617577')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              startItem.answer<b> as </b><span style=\"color: maroon\">startAns</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                doseGroup.item<b> as </b><span style=\"color: maroon\">endItem</span><b> where </b>(linkId = '780829110731')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>                  endItem.answer<b> as </b><span style=\"color: maroon\">endAns</span><span style=\"color: navy\"><b> -&gt; </b></span> medAdmin.effectivePeriod<b> as </b><span style=\"color: maroon\">adminPeriod</span><span style=\"color: navy\">, </span> adminPeriod.start = <span style=\"color: navy\">(</span>%startAns.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> adminPeriod.end = <span style=\"color: navy\">(</span>%endAns.value<span style=\"color: navy\">)</span> <i>\"setAdminPeriod\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">}</span> <i>\"navEnd\"</i><span style=\"color: navy\">;</span>#xD;\n              <span style=\"color: navy\">}</span> <i>\"navStartAns\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"navStart\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"navDosage\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setdosage\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"createmedadmin\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"medadminentry\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"processmedexpoadmin\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Vital Sign Observations</span>#xD;\n<b>group </b>CreateVitalSignObservations<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Examen clinique (linkId 214880328197)</span>#xD;\n  src.item<b> as </b><span style=\"color: maroon\">examGroup</span><b> where </b>(linkId = '214880328197')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    <span style=\"color: navy\">// </span><span style=\"color: green\">Dossier de soins (linkId 305831246173) - repeating</span>#xD;\n    examGroup.item<b> as </b><span style=\"color: maroon\">dossierGroup</span><b> where </b>(linkId = '305831246173')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      <span style=\"color: navy\">// </span><span style=\"color: green\">Height (linkId 4846902346416)</span>#xD;\n      dossierGroup.item<b> as </b><span style=\"color: maroon\">heightItem</span><b> where </b>(linkId = '4846902346416')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        heightItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">obsEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span>obsEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">obs</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"obsid\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.id<b> as </b><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">, </span> obsEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              ans<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-observation-body-height'</span> <i>\"obsprofile\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"obsmeta\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.status = <span style=\"color: blue\">'final'</span> <i>\"obsstatus\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.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>\"obscategory\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.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: blue\">'8302-2'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Body height'</span><span style=\"color: navy\">)</span> <i>\"obscode\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Value</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.value = <span style=\"color: navy\">(</span>%ans.valueQuantity<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtObsVal</span><span style=\"color: navy\">, </span> tgtObsVal.code = <span style=\"color: navy\">(</span>%ans.valueQuantity.unit<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtObsVal.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>\"setvalue\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Effective date from nested item</span>#xD;\n            ans.item<b> as </b><span style=\"color: maroon\">dateItem</span><b> where </b>(linkId = '941821315470')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              dateItem.answer<b> as </b><span style=\"color: maroon\">dateAns</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                dateAns.value<b> as </b><span style=\"color: maroon\">val</span><span style=\"color: navy\"><b> -&gt; </b></span>obs.effective = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">val</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'dateTime'</span><span style=\"color: navy\">)</span> <i>\"seteffective\"</i><span style=\"color: navy\">;</span>#xD;\n              <span style=\"color: navy\">}</span> <i>\"navDateAns\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"extracteffective\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"createheightobs\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"heightobsentry\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractheight\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Weight (linkId 451513217936)</span>#xD;\n      dossierGroup.item<b> as </b><span style=\"color: maroon\">weightItem</span><b> where </b>(linkId = '451513217936')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        weightItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">obsEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span>obsEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">obs</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"obsid\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.id<b> as </b><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">, </span> obsEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              ans<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-observation-body-weight'</span> <i>\"obsprofile\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"obsmeta\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.status = <span style=\"color: blue\">'final'</span> <i>\"obsstatus\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.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>\"obscategory\"</i><span style=\"color: navy\">;</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.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: blue\">'29463-7'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Body weight'</span><span style=\"color: navy\">)</span> <i>\"obscode\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Value</span>#xD;\n            ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.value = <span style=\"color: navy\">(</span>%ans.valueQuantity<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtObsVal</span><span style=\"color: navy\">, </span> tgtObsVal.code = <span style=\"color: navy\">(</span>%ans.valueQuantity.unit<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtObsVal.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>\"setvalue\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">// </span><span style=\"color: green\">Effective date from nested item</span>#xD;\n            ans.item<b> as </b><span style=\"color: maroon\">dateItem</span><b> where </b>(linkId = '151269044052')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>              dateItem.answer<b> as </b><span style=\"color: maroon\">dateAns</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                dateAns.value<b> as </b><span style=\"color: maroon\">val</span><span style=\"color: navy\"><b> -&gt; </b></span>obs.effective = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">val</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'dateTime'</span><span style=\"color: navy\">)</span> <i>\"seteffective\"</i><span style=\"color: navy\">;</span>#xD;\n              <span style=\"color: navy\">}</span> <i>\"navDateAns\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"extracteffective\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"createweightobs\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"weightobsentry\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractweight\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Blood Pressure - need both systolic and diastolic</span>#xD;\n      dossierGroup.item<b> as </b><span style=\"color: maroon\">sysItem</span><b> where </b>(linkId = '4160905247955')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        sysItem.answer<b> as </b><span style=\"color: maroon\">sysAns</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          dossierGroup.item<b> as </b><span style=\"color: maroon\">diaItem</span><b> where </b>(linkId = '848797127998')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>            diaItem.answer<b> as </b><span style=\"color: maroon\">diaAns</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">obsEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>              sysAns<span style=\"color: navy\"><b> -&gt; </b></span>obsEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">obs</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                sysAns<span style=\"color: navy\"><b> -&gt; </b></span>obs.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"obsid\"</i><span style=\"color: navy\">;</span>#xD;\n                sysAns<span style=\"color: navy\"><b> -&gt; </b></span> obs.id<b> as </b><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">, </span> obsEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n                sysAns<span style=\"color: navy\"><b> -&gt; </b></span>obs.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                  sysAns<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-observation-blood-pressure'</span> <i>\"obsprofile\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">}</span> <i>\"obsmeta\"</i><span style=\"color: navy\">;</span>#xD;\n                sysAns<span style=\"color: navy\"><b> -&gt; </b></span>obs.status = <span style=\"color: blue\">'final'</span> <i>\"obsstatus\"</i><span style=\"color: navy\">;</span>#xD;\n                sysAns<span style=\"color: navy\"><b> -&gt; </b></span>obs.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>\"obscategory\"</i><span style=\"color: navy\">;</span>#xD;\n                sysAns<span style=\"color: navy\"><b> -&gt; </b></span>obs.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: blue\">'85354-9'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Blood pressure panel'</span><span style=\"color: navy\">)</span> <i>\"obscode\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n                sysAns<span style=\"color: navy\"><b> -&gt; </b></span> obs.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">// </span><span style=\"color: green\">Systolic component</span>#xD;\n                sysAns<span style=\"color: navy\"><b> -&gt; </b></span>obs.component<b> as </b><span style=\"color: maroon\">sysComp</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                  sysAns<span style=\"color: navy\"><b> -&gt; </b></span>sysComp.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: blue\">'8480-6'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Systolic blood pressure'</span><span style=\"color: navy\">)</span> <i>\"syscode\"</i><span style=\"color: navy\">;</span>#xD;\n                  sysAns<span style=\"color: navy\"><b> -&gt; </b></span> sysComp.value = <span style=\"color: navy\">(</span>%sysAns.valueQuantity<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">sysVal</span><span style=\"color: navy\">, </span> sysVal.code = <span style=\"color: navy\">(</span>%sysAns.valueQuantity.unit<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> sysVal.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>\"sysvalue\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">}</span> <i>\"setsystolic\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">// </span><span style=\"color: green\">Diastolic component</span>#xD;\n                diaAns<span style=\"color: navy\"><b> -&gt; </b></span>obs.component<b> as </b><span style=\"color: maroon\">diaComp</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                  diaAns<span style=\"color: navy\"><b> -&gt; </b></span>diaComp.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: blue\">'8462-4'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Diastolic blood pressure'</span><span style=\"color: navy\">)</span> <i>\"diacode\"</i><span style=\"color: navy\">;</span>#xD;\n                  diaAns<span style=\"color: navy\"><b> -&gt; </b></span> diaComp.value = <span style=\"color: navy\">(</span>%diaAns.valueQuantity<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">diaVal</span><span style=\"color: navy\">, </span> diaVal.code = <span style=\"color: navy\">(</span>%diaAns.valueQuantity.unit<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> diaVal.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>\"diavalue\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">}</span> <i>\"setdiastolic\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">// </span><span style=\"color: green\">Effective date from nested item</span>#xD;\n                sysAns.item<b> as </b><span style=\"color: maroon\">sysDateItem</span><b> where </b>(linkId = '987654638442')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>                  sysDateItem.answer<b> as </b><span style=\"color: maroon\">dateAns</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>                    dateAns.value<b> as </b><span style=\"color: maroon\">val</span><span style=\"color: navy\"><b> -&gt; </b></span>obs.effective = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">val</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'dateTime'</span><span style=\"color: navy\">)</span> <i>\"seteffective\"</i><span style=\"color: navy\">;</span>#xD;\n                  <span style=\"color: navy\">}</span> <i>\"navDateAns\"</i><span style=\"color: navy\">;</span>#xD;\n                <span style=\"color: navy\">}</span> <i>\"navDate\"</i><span style=\"color: navy\">;</span>#xD;\n              <span style=\"color: navy\">}</span> <i>\"createbpobs\"</i><span style=\"color: navy\">;</span>#xD;\n            <span style=\"color: navy\">}</span> <i>\"bpobsentr\"</i><span style=\"color: navy\">;</span>#xD;\n          <span style=\"color: navy\">}</span> <i>\"extractdiastolic\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"processsystolic\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractbloodpressure\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"processdossier\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"processexam\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Group: Create Laboratory Observations</span>#xD;\n<b>group </b>CreateLaboratoryObservations<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Biologie group (linkId 7702944131447)</span>#xD;\n  src.item<b> as </b><span style=\"color: maroon\">bioGroup</span><b> where </b>(linkId = '7702944131447')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    <span style=\"color: navy\">// </span><span style=\"color: green\">Fonction rénale (linkId 5241323453538)</span>#xD;\n    bioGroup.item<b> as </b><span style=\"color: maroon\">renalGroup</span><b> where </b>(linkId = '5241323453538')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      <span style=\"color: navy\">// </span><span style=\"color: green\">Urée (linkId 7169026818760)</span>#xD;\n      renalGroup.item<b> as </b><span style=\"color: maroon\">ureaItem</span><b> where </b>(linkId = '7169026818760')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        ureaItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ureaItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createureaobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracturea\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Créatininémie (linkId 500408205043)</span>#xD;\n      renalGroup.item<b> as </b><span style=\"color: maroon\">creatItem</span><b> where </b>(linkId = '500408205043')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        creatItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">creatItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createcreatobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractcreat\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">DFG (linkId 786621340679)</span>#xD;\n      renalGroup.item<b> as </b><span style=\"color: maroon\">dfgItem</span><b> where </b>(linkId = '786621340679')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        dfgItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">dfgItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createdfgobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractdfg\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"processrenal\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">// </span><span style=\"color: green\">Hémogramme (linkId 419282985970)</span>#xD;\n    bioGroup.item<b> as </b><span style=\"color: maroon\">hemoGroup</span><b> where </b>(linkId = '419282985970')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      <span style=\"color: navy\">// </span><span style=\"color: green\">Leucocytes (linkId 210077225604)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">leukoItem</span><b> where </b>(linkId = '210077225604')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        leukoItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">leukoItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createleukoobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractleuko\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Hémoglobine (linkId 304159088493)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">hemoItem</span><b> where </b>(linkId = '304159088493')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        hemoItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">hemoItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createhemoobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracthemo\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Hématocrite (linkId 813863316705)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">hematItem</span><b> where </b>(linkId = '813863316705')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        hematItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">hematItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createhematobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracthemat\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Erythrocytes (linkId 459731866614)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">eryItem</span><b> where </b>(linkId = '459731866614')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        eryItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">eryItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createeryobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractery\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">VGM (linkId 163624088831)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">vgmItem</span><b> where </b>(linkId = '163624088831')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        vgmItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">vgmItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createvgmobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractvgm\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Plaquettes (linkId 794156787471)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">platItem</span><b> where </b>(linkId = '794156787471')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        platItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">platItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createplatobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractplat\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Neutrophiles (linkId 961905168477)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">neutItem</span><b> where </b>(linkId = '961905168477')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        neutItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">neutItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createneutobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractneut\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Lymphocytes (linkId 695150914696)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">lymphItem</span><b> where </b>(linkId = '695150914696')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        lymphItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">lymphItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createlymphobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractlymph\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Eosinophiles (linkId 700490326748)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">eosiItem</span><b> where </b>(linkId = '700490326748')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        eosiItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">eosiItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createeosiobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracteosi\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Monocytes (linkId 168661900522)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">monoItem</span><b> where </b>(linkId = '168661900522')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        monoItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">monoItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createmonoobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractmono\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">TP (linkId 658898841893)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">tpItem</span><b> where </b>(linkId = '658898841893')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        tpItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tpItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createtpobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracttp\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">TCA (linkId 795145096241)</span>#xD;\n      hemoGroup.item<b> as </b><span style=\"color: maroon\">tcaItem</span><b> where </b>(linkId = '795145096241')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        tcaItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tcaItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createtcaobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracttca\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"processhemo\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">// </span><span style=\"color: green\">Bilan hépatique (linkId 796308115381)</span>#xD;\n    bioGroup.item<b> as </b><span style=\"color: maroon\">liverGroup</span><b> where </b>(linkId = '796308115381')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      <span style=\"color: navy\">// </span><span style=\"color: green\">ASAT (linkId 715226319725)</span>#xD;\n      liverGroup.item<b> as </b><span style=\"color: maroon\">asatItem</span><b> where </b>(linkId = '715226319725')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        asatItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">asatItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createasatobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractasat\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">ALAT (linkId 876439410327)</span>#xD;\n      liverGroup.item<b> as </b><span style=\"color: maroon\">alatItem</span><b> where </b>(linkId = '876439410327')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        alatItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">alatItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createalatobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractalat\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">GGT (linkId 287545455976)</span>#xD;\n      liverGroup.item<b> as </b><span style=\"color: maroon\">ggtItem</span><b> where </b>(linkId = '287545455976')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        ggtItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ggtItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createggtobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractggt\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">PAL (linkId 508269571594)</span>#xD;\n      liverGroup.item<b> as </b><span style=\"color: maroon\">palItem</span><b> where </b>(linkId = '508269571594')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        palItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">palItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createpalobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractpal\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Bilirubine totale (linkId 927344090061)</span>#xD;\n      liverGroup.item<b> as </b><span style=\"color: maroon\">bilTotItem</span><b> where </b>(linkId = '927344090061')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        bilTotItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bilTotItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createbiltotobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractbiltot\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Bilirubine conjuguée (linkId 208196328453)</span>#xD;\n      liverGroup.item<b> as </b><span style=\"color: maroon\">bilConjItem</span><b> where </b>(linkId = '208196328453')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        bilConjItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bilConjItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createbilconjobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractbilconj\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"processliver\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">// </span><span style=\"color: green\">Métabolisme glucidique (linkId 334039497382)</span>#xD;\n    bioGroup.item<b> as </b><span style=\"color: maroon\">glucoseGroup</span><b> where </b>(linkId = '334039497382')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>      <span style=\"color: navy\">// </span><span style=\"color: green\">Glycémie à jeun (linkId 273778921448)</span>#xD;\n      glucoseGroup.item<b> as </b><span style=\"color: maroon\">glycItem</span><b> where </b>(linkId = '273778921448')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        glycItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">glycItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createglycobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractglyc\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">HbA1c (linkId 632894677152)</span>#xD;\n      glucoseGroup.item<b> as </b><span style=\"color: maroon\">hba1cItem</span><b> where </b>(linkId = '632894677152')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        hba1cItem.answer<b> as </b><span style=\"color: maroon\">ans</span><span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>CreateLabObservation<span style=\"color: navy\">(</span><span style=\"color: maroon\">ans</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">hba1cItem</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>\"createhba1cobs\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracthba1c\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"processglucose\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"processbiology\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Helper: Create a single Laboratory Observation</span>#xD;\n<b>group </b>CreateLabObservation<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">ans</span>, <b>source</b> <span style=\"color: maroon\">parentItem</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  ans<span style=\"color: navy\"><b> -&gt; </b></span>bundle.entry<b> as </b><span style=\"color: maroon\">obsEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    ans<span style=\"color: navy\"><b> -&gt; </b></span>obsEntry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">obs</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>\"obsid\"</i><span style=\"color: navy\">;</span>#xD;\n      ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.id<b> as </b><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">, </span> obsEntry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">obsId</span><span style=\"color: navy\">)</span> <i>\"setfullUrl\"</i><span style=\"color: navy\">;</span>#xD;\n      ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        ans<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/dm-observation-laboratory-generic'</span> <i>\"obsprofile\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"obsmeta\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Status</span>#xD;\n      ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.status = <span style=\"color: blue\">'final'</span> <i>\"obsstatus\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Category</span>#xD;\n      ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.category = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">cat</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        ans<span style=\"color: navy\"><b> -&gt; </b></span>cat.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          ans<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>\"catsystem\"</i><span style=\"color: navy\">;</span>#xD;\n          ans<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: blue\">'laboratory'</span> <i>\"catcode\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"setcategorycoding\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"setcategory\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Link to patient</span>#xD;\n      ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> patient.id<b> as </b><span style=\"color: maroon\">patId</span><span style=\"color: navy\">, </span> ref.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patId</span><span style=\"color: navy\">)</span> <i>\"setsubject\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Value as Quantity</span>#xD;\n      ans<span style=\"color: navy\"><b> -&gt; </b></span> obs.value = <span style=\"color: navy\">(</span>%ans.valueQuantity<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtObsVal</span><span style=\"color: navy\">, </span> tgtObsVal.code = <span style=\"color: navy\">(</span>%ans.valueQuantity.unit<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtObsVal.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>\"setvalue\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Extract nested items - LOINC code, effective date, status, reference ranges</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">LOINC code</span>#xD;\n      ans.item<b> as </b><span style=\"color: maroon\">loincItem</span><b> where </b>(text.contains('code loinc'))<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        loincItem.answer<b> as </b><span style=\"color: maroon\">loincAns</span><span style=\"color: navy\"><b> -&gt; </b></span> obs.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: navy\">(</span>%loincAns.valueString<span style=\"color: navy\">)</span> <i>\"setloinccoding\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extractloinc\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">effectiveDateTime</span>#xD;\n      ans.item<b> as </b><span style=\"color: maroon\">dateItem</span><b> where </b>(text.contains('Date et heure du prélèvement'))<b> then</b><span style=\"color: navy\"> {#xD;\n</span>        dateItem.answer<b> as </b><span style=\"color: maroon\">dateAns</span><span style=\"color: navy\"><b> -&gt; </b></span>obs.effective = <span style=\"color: navy\">(</span>%dateAns.valueDateTime<span style=\"color: navy\">)</span> <i>\"seteffective\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"extracteffective\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: #b36b00\" title=\"Cet élément n'était pas défini avant R5\">// parentItem.item as statusItem where (linkId.contains('Statut de validation')) then {         statusItem.answer as statusAns -&gt; obs.extension = create('Extension') as ext then {           statusAns -&gt; ext.url = 'http://hl7.org/fhir/StructureDefinition/observation-status' \"status-url\";           statusAns -&gt; ext.value = (%statusAns.valueString) \"status-value\";         } \"set-status-ext\";       } \"extract-validation-status\";</span>#xD;\n      <span style=\"color: navy\">// </span><span style=\"color: green\">Reference ranges (low and high)</span>#xD;\n      ans<span style=\"color: navy\"><b> -&gt; </b></span>obs.referenceRange<b> as </b><span style=\"color: maroon\">refRange</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        ans.item<b> as </b><span style=\"color: maroon\">lowItem</span><b> where </b>(text.contains('Borne inférieure'))<b> then</b><span style=\"color: navy\"> {#xD;\n</span>          lowItem.answer<b> as </b><span style=\"color: maroon\">lowAns</span><span style=\"color: navy\"><b> -&gt; </b></span> refRange.low = <span style=\"color: navy\">(</span>%lowAns.valueQuantity<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtLow</span><span style=\"color: navy\">, </span> tgtLow.code = <span style=\"color: navy\">(</span>%ans.valueQuantity.unit<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtLow.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>\"setlow\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"extractlow\"</i><span style=\"color: navy\">;</span>#xD;\n        ans.item<b> as </b><span style=\"color: maroon\">highItem</span><b> where </b>(text.contains('Borne supérieure'))<b> then</b><span style=\"color: navy\"> {#xD;\n</span>          highItem.answer<b> as </b><span style=\"color: maroon\">highAns</span><span style=\"color: navy\"><b> -&gt; </b></span> refRange.high = <span style=\"color: navy\">(</span>%highAns.valueQuantity<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtHigh</span><span style=\"color: navy\">, </span> tgtHigh.code = <span style=\"color: navy\">(</span>%ans.valueQuantity.unit<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtHigh.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span> <i>\"sethigh\"</i><span style=\"color: navy\">;</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"extracthigh\"</i><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"setrefrange\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createobs\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"obsentry\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span></pre></div>"^^rdf:XMLLiteral ]
      ] ; #
      fhir:url [
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureMap/Q2FSL"^^xsd:anyURI ;
    fhir:l <https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureMap/Q2FSL>
      ] ; #
      fhir:version [ fhir:v "0.1.0"] ; #
      fhir:name [ fhir:v "Q2FSL"] ; #
      fhir:title [ fhir:v "Transforms QuestionnaireResponse based on Questionnaire Usage Variables socles into FHIR resources conforming to DM profiles"] ; #
      fhir:status [ fhir:v "draft"] ; #
      fhir:date [ fhir:v "2026-05-28T20:54:01+00:00"^^xsd:dateTime] ; #
      fhir:publisher [ fhir:v "AP-HP"] ; #
      fhir:contact ( [
    fhir:name [ fhir:v "AP-HP" ] ;
        ( fhir:telecom [
    fhir:system [ fhir:v "url" ] ;
    fhir:value [ fhir:v "https://aphp.fr" ]     ] )
      ] ) ; #
      fhir:description [ fhir:v "Transforms QuestionnaireResponse based on Questionnaire Usage Variables socles into FHIR resources conforming to DM profiles"] ; #
      fhir:jurisdiction ( [
        ( fhir:coding [
    fhir:system [
    fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ;
    fhir:l <urn:iso:std:iso:3166>       ] ;
    fhir:code [ fhir:v "FRA" ]     ] )
      ] ) ; #
      fhir:structure ( [
    fhir:url [
    fhir:v "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"^^xsd:anyURI ;
    fhir:l <http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse>     ] ;
    fhir:mode [ fhir:v "source" ] ;
    fhir:alias [ fhir:v "QuestionnaireResponse" ]
      ] [
    fhir:url [
    fhir:v "http://hl7.org/fhir/StructureDefinition/Bundle"^^xsd:anyURI ;
    fhir:l <http://hl7.org/fhir/StructureDefinition/Bundle>     ] ;
    fhir:mode [ fhir:v "target" ] ;
    fhir:alias [ fhir:v "Bundle" ]
      ] ) ; #
      fhir:group ( [
    fhir:name [ fhir:v "QuestionnaireResponseToBundle" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Main entry point: Transform QuestionnaireResponse to Bundle" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "bundleid" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]       ] )     ] [
    fhir:name [ fhir:v "bundletype" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "type" ] ;
    fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "collection"           ]         ] )       ] )     ] [
    fhir:name [ fhir:v "setTimestamp" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "timestamp" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "now()"           ]         ] )       ] )     ] [
    fhir:name [ fhir:v "patiententry" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "patientEntry" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "createpatientresource" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "src" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "patientEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "patient" ] ;
    fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient"             ]           ] )         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "createpatient" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreatePatient" ] ;
                ( fhir:variable [ fhir:v "src" ] [ fhir:v "patient" ] )           ] )         ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patientId" ]           ] [
    fhir:context [ fhir:v "patientEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patientId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "createencounters" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreateEncounters" ] ;
                ( fhir:variable [ fhir:v "src" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )           ] )         ] [
    fhir:name [ fhir:v "createlabobservations" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreateLaboratoryObservations" ] ;
                ( fhir:variable [ fhir:v "src" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )           ] )         ] [
    fhir:name [ fhir:v "createmedicationrequests" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreateMedicationRequests" ] ;
                ( fhir:variable [ fhir:v "src" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )           ] )         ] [
    fhir:name [ fhir:v "createmedicationadministrations" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreateMedicationAdministrations" ] ;
                ( fhir:variable [ fhir:v "src" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )           ] )         ] [
    fhir:name [ fhir:v "createvitalsigns" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreateVitalSignObservations" ] ;
                ( fhir:variable [ fhir:v "src" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreatePatient" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Patient from QuestionnaireResponse" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "patientid" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]       ] )     ] [
    fhir:name [ fhir:v "patientmeta" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"           ]         ] )       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "patientprofile" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "src" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-patient"             ]           ] )         ] )       ] )     ] [
    fhir:name [ fhir:v "processsociodemographics" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "socioDemo" ] ;
    fhir:condition [ fhir:v "(linkId = '4647259356106')" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "processidentity" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "socioDemo" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "identity" ] ;
    fhir:condition [ fhir:v "(linkId = '2958000860428')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "setname" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "identity" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "name" ] ;
    fhir:variable [ fhir:v "name" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "HumanName"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "extractfamily" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "identity" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "familyItem" ] ;
    fhir:condition [ fhir:v "(linkId = '8605698058770')" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setfamily" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "familyItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "name" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "family" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                   ]                 ] )               ] )             ] )           ] [
    fhir:name [ fhir:v "extractgiven" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "identity" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "givenItem" ] ;
    fhir:condition [ fhir:v "(linkId = '6214879623503')" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setgiven" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "givenItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "name" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "given" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractnir" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "identity" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "nirItem" ] ;
    fhir:condition [ fhir:v "(linkId = '5711960356160')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setnir" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "nirItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "identifier" ] ;
    fhir:variable [ fhir:v "nir" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Identifier"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "nirsystem" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "nir" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:oid:1.2.250.1.213.1.4.8"                   ]                 ] )               ] )             ] [
    fhir:name [ fhir:v "nirvalue" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "nir" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                   ]                 ] )               ] )             ] [
    fhir:name [ fhir:v "nirtype" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "nir" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "type" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://interopsante.org/fhir/CodeSystem/fr-v2-0203"                   ]                 ] [
    fhir:value [
    a fhir:String ;
    fhir:v "NIR"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractins" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "identity" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "insItem" ] ;
    fhir:condition [ fhir:v "(linkId = '3764723550987')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setins" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "insItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "identifier" ] ;
    fhir:variable [ fhir:v "ins" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Identifier"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "inssystem" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "ins" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:oid:1.2.250.1.213.1.4.10"                   ]                 ] )               ] )             ] [
    fhir:name [ fhir:v "insvalue" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "ins" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                   ]                 ] )               ] )             ] [
    fhir:name [ fhir:v "instype" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "ins" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "type" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://interopsante.org/fhir/CodeSystem/fr-v2-0203"                   ]                 ] [
    fhir:value [
    a fhir:String ;
    fhir:v "INS-C"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractbirthdate" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "identity" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "birthItem" ] ;
    fhir:condition [ fhir:v "(linkId = '5036133558154')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setbirthdate" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "birthItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "birthDate" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDate"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractdeath" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "identity" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "deathItem" ] ;
    fhir:condition [ fhir:v "(linkId = '5633552097315')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setdeceaseddate" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "deathItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "deceased" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDate"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "extractdeathsource" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "deathItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "deathSource" ] ;
    fhir:condition [ fhir:v "(linkId = '9098810065693')" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setdeathsourceext" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "deathSource" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "sourceAns" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "extension" ] ;
    fhir:variable [ fhir:v "ext" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Extension"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "deathsourceurl" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "sourceAns" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "ext" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-death-source"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "deathsourcevalue" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "sourceAns" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "ext" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%sourceAns.valueCoding"                     ]                   ] )                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractmultiplebirth" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "identity" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "multipleItem" ] ;
    fhir:condition [ fhir:v "(linkId = '6931296968515')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setmultiplebirth" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "multipleItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "multipleBirth" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueInteger"                 ]               ] )             ] )           ] )         ] )       ] [
    fhir:name [ fhir:v "extractpmsidemographics" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "pmsiGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '2825244231605')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "extractgender" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "sexItem" ] ;
    fhir:condition [ fhir:v "(linkId = '3894630481120')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "valueCoding" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "sexItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setGenderF" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "valueString" ] ;
    fhir:variable [ fhir:v "female" ] ;
    fhir:condition [ fhir:v "($this = 'f')" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "gender" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "female"                   ]                 ] )               ] )             ] [
    fhir:name [ fhir:v "setGenderM" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "valueString" ] ;
    fhir:variable [ fhir:v "female" ] ;
    fhir:condition [ fhir:v "($this = 'm')" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "gender" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "male"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractcodegeo" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "codeGeoItem" ] ;
    fhir:condition [ fhir:v "(linkId = '2446369196222')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setaddress" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "codeGeoItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "address" ] ;
    fhir:variable [ fhir:v "addr" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Address"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setcodegeoext" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "addr" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "extension" ] ;
    fhir:variable [ fhir:v "ext" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Extension"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "codegeourl" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "ext" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-pmsi-code-geo"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "codegeovalue" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "val" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "ext" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:transform [ fhir:v "cast" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:Id ;
    fhir:v "val"                     ]                   ] [
    fhir:value [
    a fhir:String ;
    fhir:v "code"                     ]                   ] )                 ] )               ] )             ] [
    fhir:name [ fhir:v "navEnv" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "socioDemo" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "environnementItem" ] ;
    fhir:condition [ fhir:v "(linkId = '5491974639955')" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "createGeolocExt" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "environnementItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "geocodageItem" ] ;
    fhir:condition [ fhir:v "(linkId = '3816475533472')" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "addr" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "extension" ] ;
    fhir:variable [ fhir:v "geolocationExt" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Extension"                     ]                   ] )                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "createLatExt" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "geocodageItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "latItem" ] ;
    fhir:condition [ fhir:v "(linkId = '3709843054556')" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "geolocationExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://hl7.org/fhir/StructureDefinition/geolocation"                       ]                     ] )                   ] [
    fhir:context [ fhir:v "geolocationExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "extension" ] ;
    fhir:variable [ fhir:v "latExt" ] ;
    fhir:transform [ fhir:v "create" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Extension"                       ]                     ] )                   ] ) ;
                      ( fhir:rule [
    fhir:name [ fhir:v "setLat" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "latItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "lat" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "latExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "latitude"                         ]                       ] )                     ] [
    fhir:context [ fhir:v "latExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%lat.valueDecimal"                         ]                       ] )                     ] ) ;
                        ( fhir:rule [
    fhir:name [ fhir:v "createLongExt" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "geocodageItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "longItem" ] ;
    fhir:condition [ fhir:v "(linkId = '7651448032665')" ]                       ] ) ;
                          ( fhir:target [
    fhir:context [ fhir:v "geolocationExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "extension" ] ;
    fhir:variable [ fhir:v "longExt" ] ;
    fhir:transform [ fhir:v "create" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Extension"                           ]                         ] )                       ] ) ;
                          ( fhir:rule [
    fhir:name [ fhir:v "setLong" ] ;
                            ( fhir:source [
    fhir:context [ fhir:v "longItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "long" ]                         ] ) ;
                            ( fhir:target [
    fhir:context [ fhir:v "longExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "longitude"                             ]                           ] )                         ] [
    fhir:context [ fhir:v "longExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%long.valueDecimal"                             ]                           ] )                         ] )                       ] )                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "navIrisItem" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "environnementItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "irisItem" ] ;
    fhir:condition [ fhir:v "(linkId = '7621032273792')" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "addr" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "line" ] ;
    fhir:variable [ fhir:v "addrLine" ]                 ] [
    fhir:context [ fhir:v "addrLine" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "extension" ] ;
    fhir:variable [ fhir:v "irisExt" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Extension"                     ]                   ] )                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setIrisExt" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "irisItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "irisExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-censusTract"                       ]                     ] )                   ] [
    fhir:context [ fhir:v "irisExt" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "valueString" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                       ]                     ] )                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateLocations" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Locations from geocoding and IRIS data" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "processsociodemographicslocation" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "socioDemo" ] ;
    fhir:condition [ fhir:v "(linkId = '4647259356106')" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "processenvironment" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "socioDemo" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "environment" ] ;
    fhir:condition [ fhir:v "(linkId = '5491974639955')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "geocodinglocationentry" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "environment" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "geocodingItem" ] ;
    fhir:condition [ fhir:v "(linkId = '3816475533472')" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "locationEntry" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createlocation" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "geocodingItem" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "locationEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "location" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Location"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "locationid" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "geocodingItem" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "location" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]               ] )             ] [
    fhir:name [ fhir:v "locationmeta" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "geocodingItem" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "location" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "locationprofile" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "geocodingItem" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-location"                     ]                   ] )                 ] )               ] )             ] [
    fhir:name [ fhir:v "setposition" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "geocodingItem" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "location" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "position" ] ;
    fhir:variable [ fhir:v "pos" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "LocationPosition"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "extractlatitude" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "geocodingItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "latItem" ] ;
    fhir:condition [ fhir:v "(linkId = '3709843054556')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setlatitude" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "latItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "pos" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "latitude" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDecimal"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "extractlongitude" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "geocodingItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "longItem" ] ;
    fhir:condition [ fhir:v "(linkId = '7651448032665')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setlongitude" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "longItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "pos" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "longitude" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDecimal"                       ]                     ] )                   ] )                 ] )               ] )             ] [
    fhir:name [ fhir:v "setrequest" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "location" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "locationEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "request" ] ;
    fhir:variable [ fhir:v "request" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "setmethod" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "location" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "request" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "method" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "POST"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "seturl" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "location" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "request" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Location"                     ]                   ] )                 ] )               ] )             ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "location" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "locId" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "locationEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"                   ]                 ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "locId"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "processiris" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "environment" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "irisItem" ] ;
    fhir:condition [ fhir:v "(linkId = '7621032273792')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "irislocationentry" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "irisItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "irisAnswer" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "locationEntry" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "createirislocation" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "irisAnswer" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "locationEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "location" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Location"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "locationid" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "irisAnswer" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "location" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]                 ] )               ] [
    fhir:name [ fhir:v "locationmeta" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "irisAnswer" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "location" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"                     ]                   ] )                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "locationprofile" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "irisAnswer" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-location"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "setirisidentifier" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "irisAnswer" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "location" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "identifier" ] ;
    fhir:variable [ fhir:v "identifier" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Identifier"                     ]                   ] )                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "irissystem" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "irisAnswer" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "identifier" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:oid:2.16.840.1.113883.2.8.1.5.5"                       ]                     ] )                   ] )                 ] [
    fhir:name [ fhir:v "irisvalue" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "irisAnswer" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "identifier" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%irisAnswer.valueCoding.code"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "setrequest" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "location" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "locationEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "request" ] ;
    fhir:variable [ fhir:v "request" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setmethod" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "location" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "request" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "method" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "POST"                       ]                     ] )                   ] )                 ] [
    fhir:name [ fhir:v "seturl" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "location" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "request" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "url" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Location"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "location" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "locId" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "locationEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"                     ]                   ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "locId"                     ]                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateEncounters" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Encounters from PMSI data" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "encounterentry" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "pmsiItem" ] ;
    fhir:condition [ fhir:v "(linkId = '2825244231605')" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "encounterEntry" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "createencounter" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "encounterEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "encounter" ] ;
    fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Encounter"             ]           ] )         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "encounterid" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]           ] )         ] [
    fhir:name [ fhir:v "encountermeta" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "encounterprofile" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-encounter"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setStatus" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "finished"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setClass" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "class" ] ;
    fhir:transform [ fhir:v "c" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://terminology.hl7.org/CodeSystem/v3-ActCode"               ]             ] [
    fhir:value [
    a fhir:String ;
    fhir:v "IMP"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setsubject" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"               ]             ] )           ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]           ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setperiod" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "period" ] ;
    fhir:variable [ fhir:v "period" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Period"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "extractstart" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "startItem" ] ;
    fhir:condition [ fhir:v "(linkId = '5991443718282')" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setstart" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "startItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "period" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "start" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDate"                   ]                 ] )               ] )             ] )           ] [
    fhir:name [ fhir:v "extractend" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "endItem" ] ;
    fhir:condition [ fhir:v "(linkId = '6114780320846')" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setend" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "endItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "period" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "end" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDate"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractmodein" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "modeInItem" ] ;
    fhir:condition [ fhir:v "(linkId = '6172398101212')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "navValue" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "modeInItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setadmitsource" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "valueString" ] ;
    fhir:variable [ fhir:v "valueString" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "hospitalization" ] ;
    fhir:variable [ fhir:v "hosp" ]               ] [
    fhir:context [ fhir:v "hosp" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "admitSource" ] ;
    fhir:variable [ fhir:v "admitSource" ]               ] [
    fhir:context [ fhir:v "admitSource" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "admitSourceCoding" ]               ] [
    fhir:context [ fhir:v "admitSourceCoding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:Id ;
    fhir:v "valueString"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractmodeout" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "modeOutItem" ] ;
    fhir:condition [ fhir:v "(linkId = '3354867075704')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "navValue" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "modeOutItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setdischargedisposition" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "valueString" ] ;
    fhir:variable [ fhir:v "valueString" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "hospitalization" ] ;
    fhir:variable [ fhir:v "hosp" ]               ] [
    fhir:context [ fhir:v "hosp" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "dischargeDisposition" ] ;
    fhir:variable [ fhir:v "dischargeDisposition" ]               ] [
    fhir:context [ fhir:v "dischargeDisposition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "dischargeDispositionCoding" ]               ] [
    fhir:context [ fhir:v "dischargeDispositionCoding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:Id ;
    fhir:v "valueString"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "src" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "encId" ]           ] [
    fhir:context [ fhir:v "encounterEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "encId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "createconditions" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreateConditions" ] ;
                ( fhir:variable [ fhir:v "pmsiItem" ] [ fhir:v "patient" ] [ fhir:v "encounter" ] [ fhir:v "bundle" ] )           ] )         ] [
    fhir:name [ fhir:v "createprocedures" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]           ] ) ;
              ( fhir:dependent [
    fhir:name [ fhir:v "CreateProcedures" ] ;
                ( fhir:variable [ fhir:v "pmsiItem" ] [ fhir:v "patient" ] [ fhir:v "encounter" ] [ fhir:v "bundle" ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateConditions" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Conditions from nested diagnostics" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "pmsiItem" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "encounter" ] ;
    fhir:type [ fhir:v "Encounter" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "conditionentry" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "diagGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '9391816419630')" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "conditionEntry" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "createcondition" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "conditionEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "condition" ] ;
    fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Condition"             ]           ] )         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "conditionid" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]           ] )         ] [
    fhir:name [ fhir:v "conditionmeta" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "conditionprofile" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-condition"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setsubject" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"               ]             ] )           ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]           ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setencounter" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "encId" ]           ] [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "encounter" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"               ]             ] )           ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Encounter/"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "encId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "extractdiagcode" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "diagCodeItem" ] ;
    fhir:condition [ fhir:v "(linkId = '5505101189372')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setcode" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "diagCodeItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:variable [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "CodeableConcept"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setcoding" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "code" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "coding" ]               ] [
    fhir:context [ fhir:v "coding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractdiagtype" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "diagTypeItem" ] ;
    fhir:condition [ fhir:v "(linkId = '6427586743735')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setcategory" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "diagTypeItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "category" ] ;
    fhir:variable [ fhir:v "category" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "CodeableConcept"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setcategorycoding" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "category" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "coding" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Coding"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "diagtypesystem" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "coding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/CodeSystem/pmsi-mco-diag-type"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "diagtypecode" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "coding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                     ]                   ] )                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractrecordeddate" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "diagGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "dateItem" ] ;
    fhir:condition [ fhir:v "(linkId = '7114466839467')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setrecordeddate" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "dateItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "recordedDate" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDate"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "condition" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "condId" ]           ] [
    fhir:context [ fhir:v "conditionEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "condId"               ]             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateProcedures" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Procedures from nested actes" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "pmsiItem" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "encounter" ] ;
    fhir:type [ fhir:v "Encounter" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "procedureentry" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "acteGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '591926901726')" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "procedureEntry" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "createprocedure" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "procedureEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "procedure" ] ;
    fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Procedure"             ]           ] )         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "procedureid" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]           ] )         ] [
    fhir:name [ fhir:v "proceduremeta" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "procedureprofile" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-procedure"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setStatus" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "completed"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setsubject" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"               ]             ] )           ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]           ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setencounter" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "encounter" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "encId" ]           ] [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "encounter" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"               ]             ] )           ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Encounter/"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "encId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "extractactecode" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "acteCodeItem" ] ;
    fhir:condition [ fhir:v "(linkId = '7758110033600')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setcode" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "acteCodeItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:variable [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "CodeableConcept"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setcoding" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "code" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "coding" ]               ] [
    fhir:context [ fhir:v "coding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractperformeddate" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "acteGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "dateItem" ] ;
    fhir:condition [ fhir:v "(linkId = '5066866286682')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setperformed" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "dateItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "performed" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDateTime"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "pmsiItem" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "procedure" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "procId" ]           ] [
    fhir:context [ fhir:v "procedureEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "procId"               ]             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateMedicationRequests" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Medication Requests" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "processmedexpo" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "medExpoGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '817801935685')" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "medreqentry" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "medExpoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "prescribedGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '156631794800')" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "medReqEntry" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "createmedreq" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "medReqEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "medReq" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "MedicationRequest"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "medreqid" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]             ] )           ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "src" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "medReqId" ]             ] [
    fhir:context [ fhir:v "medReqEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"                 ]               ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "medReqId"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "medreqmeta" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "medreqprofile" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-medication-request"                   ]                 ] )               ] )             ] )           ] [
    fhir:name [ fhir:v "setsubject" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"                 ]               ] )             ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]             ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"                 ]               ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "setstatus" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "active"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "setintent" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "intent" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "order"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "navPrescribedMedication" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "prescribedMedication" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "navAtcItem" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "prescribedMedication" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "atcItem" ] ;
    fhir:condition [ fhir:v "(linkId = '1923143398283')" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "setAtcCoding" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "atcItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "medication" ] ;
    fhir:variable [ fhir:v "medReqCC" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "CodeableConcept"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "medReqCC" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "medReqC" ]                 ] [
    fhir:context [ fhir:v "medReqC" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "medReqC" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "display" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%prescribedMedication.valueString"                     ]                   ] )                 ] )               ] )             ] )           ] [
    fhir:name [ fhir:v "setdosage" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medReq" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "dosageInstruction" ] ;
    fhir:variable [ fhir:v "dosage" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Dosage"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "navPrescribedMedication" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "prescribedGroup" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "prescribedMedication" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "navRouteItem" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "prescribedMedication" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "routeItem" ] ;
    fhir:condition [ fhir:v "(linkId = '387026794874')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setroute" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "routeItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "dosage" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "route" ] ;
    fhir:variable [ fhir:v "route" ]                   ] ) ;
                      ( fhir:rule [
    fhir:name [ fhir:v "setroutecoding" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "ans" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "route" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "routeCoding" ]                     ] [
    fhir:context [ fhir:v "routeCoding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                         ]                       ] )                     ] )                   ] )                 ] )               ] )             ] [
    fhir:name [ fhir:v "navPoso" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "medExpoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "posoGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '6348237104421')" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "dosage" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "timing" ] ;
    fhir:variable [ fhir:v "timing" ]               ] [
    fhir:context [ fhir:v "timing" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "repeat" ] ;
    fhir:variable [ fhir:v "timingRepeat" ]               ] [
    fhir:context [ fhir:v "timingRepeat" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "boundsPeriod" ] ;
    fhir:variable [ fhir:v "timingPeriod" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "navDateDeb" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "posoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "DateDebItem" ] ;
    fhir:condition [ fhir:v "(linkId = '316347573327')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setDateDeb" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "DateDebItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "timingPeriod" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "start" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDate"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "navDateFin" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "posoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "DateFinItem" ] ;
    fhir:condition [ fhir:v "(linkId = '429570775935')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setDateFin" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "DateFinItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "timingPeriod" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "end" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueDate"                       ]                     ] )                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateMedicationAdministrations" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Medication Administrations" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "processmedexpoadmin" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "medExpoGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '817801935685')" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "medadminentry" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "medExpoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "adminGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '266852453304')" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "medAdminEntry" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "createmedadmin" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "medAdminEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "medAdmin" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "MedicationAdministration"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "medadminid" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]             ] )           ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "src" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "medAdminId" ]             ] [
    fhir:context [ fhir:v "medAdminEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"                 ]               ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "medAdminId"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "medadminmeta" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "medadminprofile" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-medication-administration"                   ]                 ] )               ] )             ] )           ] [
    fhir:name [ fhir:v "setsubject" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"                 ]               ] )             ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]             ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"                 ]               ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "setstatus" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "completed"                 ]               ] )             ] )           ] [
    fhir:name [ fhir:v "navadministeredMedication" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "administeredMedication" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "navAtcItem" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "administeredMedication" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "atcItem" ] ;
    fhir:condition [ fhir:v "(linkId = '631972144976')" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "setAtcCoding" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "atcItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "medication" ] ;
    fhir:variable [ fhir:v "medAdminCC" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "CodeableConcept"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "medAdminCC" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "medAdminC" ]                 ] [
    fhir:context [ fhir:v "medAdminC" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "medAdminC" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "display" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%administeredMedication.valueString"                     ]                   ] )                 ] )               ] )             ] )           ] [
    fhir:name [ fhir:v "setdosage" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "dosage" ] ;
    fhir:variable [ fhir:v "dosage" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "navadministeredMedication" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "adminGroup" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "administeredMedication" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "navRoute" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "administeredMedication" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "routeItem" ] ;
    fhir:condition [ fhir:v "(linkId = '811931484859')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setroute" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "routeItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "dosage" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "route" ] ;
    fhir:variable [ fhir:v "route" ] ;
    fhir:transform [ fhir:v "create" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "CodeableConcept"                       ]                     ] )                   ] ) ;
                      ( fhir:rule [
    fhir:name [ fhir:v "setroutecoding" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "ans" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "route" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "routeCoding" ]                     ] [
    fhir:context [ fhir:v "routeCoding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueString"                         ]                       ] )                     ] )                   ] )                 ] )               ] )             ] [
    fhir:name [ fhir:v "navDosage" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "medExpoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "doseGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '5720103839343')" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "navquantity" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "doseGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "quantityItem" ] ;
    fhir:condition [ fhir:v "(linkId = '4765772671997')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "setDose" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "quantityItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "dosage" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "dose" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "navStart" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "doseGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "startItem" ] ;
    fhir:condition [ fhir:v "(linkId = '1443558617577')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "navStartAns" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "startItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "startAns" ]                   ] ) ;
                      ( fhir:rule [
    fhir:name [ fhir:v "navEnd" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "doseGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "endItem" ] ;
    fhir:condition [ fhir:v "(linkId = '780829110731')" ]                     ] ) ;
                        ( fhir:rule [
    fhir:name [ fhir:v "setAdminPeriod" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "endItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "endAns" ]                       ] ) ;
                          ( fhir:target [
    fhir:context [ fhir:v "medAdmin" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "effectivePeriod" ] ;
    fhir:variable [ fhir:v "adminPeriod" ]                       ] [
    fhir:context [ fhir:v "adminPeriod" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "start" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%startAns.value"                           ]                         ] )                       ] [
    fhir:context [ fhir:v "adminPeriod" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "end" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%endAns.value"                           ]                         ] )                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateVitalSignObservations" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Vital Sign Observations" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "processexam" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "examGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '214880328197')" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "processdossier" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "examGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "dossierGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '305831246173')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "extractheight" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "dossierGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "heightItem" ] ;
    fhir:condition [ fhir:v "(linkId = '4846902346416')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "heightobsentry" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "heightItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "obsEntry" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "createheightobs" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "obs" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Observation"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "obsid" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]                 ] )               ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "obsId" ]                 ] [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"                     ]                   ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "obsId"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obsmeta" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"                     ]                   ] )                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "obsprofile" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-observation-body-height"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obsstatus" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "final"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obscategory" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "category" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://terminology.hl7.org/CodeSystem/observation-category"                     ]                   ] [
    fhir:value [
    a fhir:String ;
    fhir:v "vital-signs"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obscode" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://loinc.org"                     ]                   ] [
    fhir:value [
    a fhir:String ;
    fhir:v "8302-2"                     ]                   ] [
    fhir:value [
    a fhir:String ;
    fhir:v "Body height"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "setsubject" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]                 ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"                     ]                   ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "setvalue" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "tgtObsVal" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "tgtObsVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity.unit"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "tgtObsVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://unitsofmeasure.org"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "extracteffective" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "dateItem" ] ;
    fhir:condition [ fhir:v "(linkId = '941821315470')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "navDateAns" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "dateItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "dateAns" ]                   ] ) ;
                      ( fhir:rule [
    fhir:name [ fhir:v "seteffective" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "dateAns" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "val" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "effective" ] ;
    fhir:transform [ fhir:v "cast" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:Id ;
    fhir:v "val"                         ]                       ] [
    fhir:value [
    a fhir:String ;
    fhir:v "dateTime"                         ]                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractweight" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "dossierGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "weightItem" ] ;
    fhir:condition [ fhir:v "(linkId = '451513217936')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "weightobsentry" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "weightItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "obsEntry" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "createweightobs" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "obs" ] ;
    fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Observation"                   ]                 ] )               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "obsid" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]                 ] )               ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "obsId" ]                 ] [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"                     ]                   ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "obsId"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obsmeta" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"                     ]                   ] )                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "obsprofile" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "ans" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-observation-body-weight"                       ]                     ] )                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obsstatus" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "final"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obscategory" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "category" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://terminology.hl7.org/CodeSystem/observation-category"                     ]                   ] [
    fhir:value [
    a fhir:String ;
    fhir:v "vital-signs"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "obscode" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://loinc.org"                     ]                   ] [
    fhir:value [
    a fhir:String ;
    fhir:v "29463-7"                     ]                   ] [
    fhir:value [
    a fhir:String ;
    fhir:v "Body weight"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "setsubject" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]                 ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"                     ]                   ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "setvalue" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "tgtObsVal" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "tgtObsVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity.unit"                     ]                   ] )                 ] [
    fhir:context [ fhir:v "tgtObsVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://unitsofmeasure.org"                     ]                   ] )                 ] )               ] [
    fhir:name [ fhir:v "extracteffective" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "dateItem" ] ;
    fhir:condition [ fhir:v "(linkId = '151269044052')" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "navDateAns" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "dateItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "dateAns" ]                   ] ) ;
                      ( fhir:rule [
    fhir:name [ fhir:v "seteffective" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "dateAns" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "val" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "effective" ] ;
    fhir:transform [ fhir:v "cast" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:Id ;
    fhir:v "val"                         ]                       ] [
    fhir:value [
    a fhir:String ;
    fhir:v "dateTime"                         ]                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractbloodpressure" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "dossierGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "sysItem" ] ;
    fhir:condition [ fhir:v "(linkId = '4160905247955')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "processsystolic" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "sysItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "sysAns" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "extractdiastolic" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "dossierGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "diaItem" ] ;
    fhir:condition [ fhir:v "(linkId = '848797127998')" ]               ] ) ;
                  ( fhir:rule [
    fhir:name [ fhir:v "bpobsentr" ] ;
                    ( fhir:source [
    fhir:context [ fhir:v "diaItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "diaAns" ]                 ] ) ;
                    ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "obsEntry" ]                 ] ) ;
                    ( fhir:rule [
    fhir:name [ fhir:v "createbpobs" ] ;
                      ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                   ] ) ;
                      ( fhir:target [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "obs" ] ;
    fhir:transform [ fhir:v "create" ] ;
                        ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Observation"                       ]                     ] )                   ] ) ;
                      ( fhir:rule [
    fhir:name [ fhir:v "obsid" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]                     ] )                   ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "obsId" ]                     ] [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"                         ]                       ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "obsId"                         ]                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "obsmeta" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"                         ]                       ] )                     ] ) ;
                        ( fhir:rule [
    fhir:name [ fhir:v "obsprofile" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                       ] ) ;
                          ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/edsh-observation-blood-pressure"                           ]                         ] )                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "obsstatus" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "final"                         ]                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "obscategory" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "category" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://terminology.hl7.org/CodeSystem/observation-category"                         ]                       ] [
    fhir:value [
    a fhir:String ;
    fhir:v "vital-signs"                         ]                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "obscode" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://loinc.org"                         ]                       ] [
    fhir:value [
    a fhir:String ;
    fhir:v "85354-9"                         ]                       ] [
    fhir:value [
    a fhir:String ;
    fhir:v "Blood pressure panel"                         ]                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "setsubject" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"                         ]                       ] )                     ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]                     ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                          ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"                         ]                       ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"                         ]                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "setsystolic" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "component" ] ;
    fhir:variable [ fhir:v "sysComp" ]                     ] ) ;
                        ( fhir:rule [
    fhir:name [ fhir:v "syscode" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                       ] ) ;
                          ( fhir:target [
    fhir:context [ fhir:v "sysComp" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://loinc.org"                           ]                         ] [
    fhir:value [
    a fhir:String ;
    fhir:v "8480-6"                           ]                         ] [
    fhir:value [
    a fhir:String ;
    fhir:v "Systolic blood pressure"                           ]                         ] )                       ] )                     ] [
    fhir:name [ fhir:v "sysvalue" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "sysAns" ]                       ] ) ;
                          ( fhir:target [
    fhir:context [ fhir:v "sysComp" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "sysVal" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%sysAns.valueQuantity"                           ]                         ] )                       ] [
    fhir:context [ fhir:v "sysVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%sysAns.valueQuantity.unit"                           ]                         ] )                       ] [
    fhir:context [ fhir:v "sysVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://unitsofmeasure.org"                           ]                         ] )                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "setdiastolic" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "diaAns" ]                     ] ) ;
                        ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "component" ] ;
    fhir:variable [ fhir:v "diaComp" ]                     ] ) ;
                        ( fhir:rule [
    fhir:name [ fhir:v "diacode" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "diaAns" ]                       ] ) ;
                          ( fhir:target [
    fhir:context [ fhir:v "diaComp" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "cc" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://loinc.org"                           ]                         ] [
    fhir:value [
    a fhir:String ;
    fhir:v "8462-4"                           ]                         ] [
    fhir:value [
    a fhir:String ;
    fhir:v "Diastolic blood pressure"                           ]                         ] )                       ] )                     ] [
    fhir:name [ fhir:v "diavalue" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "diaAns" ]                       ] ) ;
                          ( fhir:target [
    fhir:context [ fhir:v "diaComp" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "diaVal" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%diaAns.valueQuantity"                           ]                         ] )                       ] [
    fhir:context [ fhir:v "diaVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%diaAns.valueQuantity.unit"                           ]                         ] )                       ] [
    fhir:context [ fhir:v "diaVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                            ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://unitsofmeasure.org"                           ]                         ] )                       ] )                     ] )                   ] [
    fhir:name [ fhir:v "navDate" ] ;
                        ( fhir:source [
    fhir:context [ fhir:v "sysAns" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "sysDateItem" ] ;
    fhir:condition [ fhir:v "(linkId = '987654638442')" ]                     ] ) ;
                        ( fhir:rule [
    fhir:name [ fhir:v "navDateAns" ] ;
                          ( fhir:source [
    fhir:context [ fhir:v "sysDateItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "dateAns" ]                       ] ) ;
                          ( fhir:rule [
    fhir:name [ fhir:v "seteffective" ] ;
                            ( fhir:source [
    fhir:context [ fhir:v "dateAns" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "val" ]                         ] ) ;
                            ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "effective" ] ;
    fhir:transform [ fhir:v "cast" ] ;
                              ( fhir:parameter [
    fhir:value [
    a fhir:Id ;
    fhir:v "val"                             ]                           ] [
    fhir:value [
    a fhir:String ;
    fhir:v "dateTime"                             ]                           ] )                         ] )                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateLaboratoryObservations" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Group: Create Laboratory Observations" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "src" ] ;
    fhir:type [ fhir:v "QuestionnaireResponse" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "processbiology" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "src" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "bioGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '7702944131447')" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "processrenal" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "bioGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "renalGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '5241323453538')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "extracturea" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "renalGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "ureaItem" ] ;
    fhir:condition [ fhir:v "(linkId = '7169026818760')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createureaobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "ureaItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "ureaItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractcreat" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "renalGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "creatItem" ] ;
    fhir:condition [ fhir:v "(linkId = '500408205043')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createcreatobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "creatItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "creatItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractdfg" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "renalGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "dfgItem" ] ;
    fhir:condition [ fhir:v "(linkId = '786621340679')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createdfgobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "dfgItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "dfgItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] )       ] [
    fhir:name [ fhir:v "processhemo" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "bioGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "hemoGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '419282985970')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "extractleuko" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "leukoItem" ] ;
    fhir:condition [ fhir:v "(linkId = '210077225604')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createleukoobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "leukoItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "leukoItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extracthemo" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "hemoItem" ] ;
    fhir:condition [ fhir:v "(linkId = '304159088493')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createhemoobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "hemoItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "hemoItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extracthemat" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "hematItem" ] ;
    fhir:condition [ fhir:v "(linkId = '813863316705')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createhematobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "hematItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "hematItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractery" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "eryItem" ] ;
    fhir:condition [ fhir:v "(linkId = '459731866614')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createeryobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "eryItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "eryItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractvgm" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "vgmItem" ] ;
    fhir:condition [ fhir:v "(linkId = '163624088831')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createvgmobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "vgmItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "vgmItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractplat" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "platItem" ] ;
    fhir:condition [ fhir:v "(linkId = '794156787471')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createplatobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "platItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "platItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractneut" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "neutItem" ] ;
    fhir:condition [ fhir:v "(linkId = '961905168477')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createneutobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "neutItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "neutItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractlymph" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "lymphItem" ] ;
    fhir:condition [ fhir:v "(linkId = '695150914696')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createlymphobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "lymphItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "lymphItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extracteosi" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "eosiItem" ] ;
    fhir:condition [ fhir:v "(linkId = '700490326748')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createeosiobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "eosiItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "eosiItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractmono" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "monoItem" ] ;
    fhir:condition [ fhir:v "(linkId = '168661900522')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createmonoobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "monoItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "monoItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extracttp" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "tpItem" ] ;
    fhir:condition [ fhir:v "(linkId = '658898841893')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createtpobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "tpItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "tpItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extracttca" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "hemoGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "tcaItem" ] ;
    fhir:condition [ fhir:v "(linkId = '795145096241')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createtcaobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "tcaItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "tcaItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] )       ] [
    fhir:name [ fhir:v "processliver" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "bioGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "liverGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '796308115381')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "extractasat" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "liverGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "asatItem" ] ;
    fhir:condition [ fhir:v "(linkId = '715226319725')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createasatobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "asatItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "asatItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractalat" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "liverGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "alatItem" ] ;
    fhir:condition [ fhir:v "(linkId = '876439410327')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createalatobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "alatItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "alatItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractggt" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "liverGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "ggtItem" ] ;
    fhir:condition [ fhir:v "(linkId = '287545455976')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createggtobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "ggtItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "ggtItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractpal" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "liverGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "palItem" ] ;
    fhir:condition [ fhir:v "(linkId = '508269571594')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createpalobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "palItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "palItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractbiltot" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "liverGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "bilTotItem" ] ;
    fhir:condition [ fhir:v "(linkId = '927344090061')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createbiltotobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "bilTotItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "bilTotItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extractbilconj" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "liverGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "bilConjItem" ] ;
    fhir:condition [ fhir:v "(linkId = '208196328453')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createbilconjobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "bilConjItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "bilConjItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] )       ] [
    fhir:name [ fhir:v "processglucose" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "bioGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "glucoseGroup" ] ;
    fhir:condition [ fhir:v "(linkId = '334039497382')" ]         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "extractglyc" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "glucoseGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "glycItem" ] ;
    fhir:condition [ fhir:v "(linkId = '273778921448')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createglycobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "glycItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "glycItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extracthba1c" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "glucoseGroup" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "hba1cItem" ] ;
    fhir:condition [ fhir:v "(linkId = '632894677152')" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "createhba1cobs" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "hba1cItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ]             ] ) ;
                ( fhir:dependent [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
                  ( fhir:variable [ fhir:v "ans" ] [ fhir:v "hba1cItem" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] )             ] )           ] )         ] )       ] )     ] )
      ] [
    fhir:name [ fhir:v "CreateLabObservation" ] ;
    fhir:typeMode [ fhir:v "none" ] ;
    fhir:documentation [ fhir:v "Helper: Create a single Laboratory Observation" ] ;
        ( fhir:input [
    fhir:name [ fhir:v "ans" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "parentItem" ] ;
    fhir:mode [ fhir:v "source" ]     ] [
    fhir:name [ fhir:v "patient" ] ;
    fhir:type [ fhir:v "Patient" ] ;
    fhir:mode [ fhir:v "target" ]     ] [
    fhir:name [ fhir:v "bundle" ] ;
    fhir:type [ fhir:v "Bundle" ] ;
    fhir:mode [ fhir:v "target" ]     ] ) ;
        ( fhir:rule [
    fhir:name [ fhir:v "obsentry" ] ;
          ( fhir:source [
    fhir:context [ fhir:v "ans" ]       ] ) ;
          ( fhir:target [
    fhir:context [ fhir:v "bundle" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "entry" ] ;
    fhir:variable [ fhir:v "obsEntry" ]       ] ) ;
          ( fhir:rule [
    fhir:name [ fhir:v "createobs" ] ;
            ( fhir:source [
    fhir:context [ fhir:v "ans" ]         ] ) ;
            ( fhir:target [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "resource" ] ;
    fhir:variable [ fhir:v "obs" ] ;
    fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Observation"             ]           ] )         ] ) ;
            ( fhir:rule [
    fhir:name [ fhir:v "obsid" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:transform [ fhir:v "uuid" ]           ] )         ] [
    fhir:name [ fhir:v "setfullUrl" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "obsId" ]           ] [
    fhir:context [ fhir:v "obsEntry" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "fullUrl" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "urn:uuid:"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "obsId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "obsmeta" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "meta" ] ;
    fhir:variable [ fhir:v "meta" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Meta"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "obsprofile" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "meta" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "profile" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "https://aphp.github.io/IG-FHIR-EDSH-SOCLE-COMMUN/StructureDefinition/dm-observation-laboratory-generic"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "obsstatus" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "status" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "final"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setcategory" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "category" ] ;
    fhir:variable [ fhir:v "cat" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "CodeableConcept"               ]             ] )           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setcategorycoding" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "ans" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "cat" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "coding" ] ;
    fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Coding"                 ]               ] )             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "catsystem" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "coding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://terminology.hl7.org/CodeSystem/observation-category"                   ]                 ] )               ] )             ] [
    fhir:name [ fhir:v "catcode" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "ans" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "coding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "laboratory"                   ]                 ] )               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setsubject" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "subject" ] ;
    fhir:variable [ fhir:v "ref" ] ;
    fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Reference"               ]             ] )           ] [
    fhir:context [ fhir:v "patient" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "id" ] ;
    fhir:variable [ fhir:v "patId" ]           ] [
    fhir:context [ fhir:v "ref" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "reference" ] ;
    fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "Patient/"               ]             ] [
    fhir:value [
    a fhir:Id ;
    fhir:v "patId"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "setvalue" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "value" ] ;
    fhir:variable [ fhir:v "tgtObsVal" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity"               ]             ] )           ] [
    fhir:context [ fhir:v "tgtObsVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity.unit"               ]             ] )           ] [
    fhir:context [ fhir:v "tgtObsVal" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://unitsofmeasure.org"               ]             ] )           ] )         ] [
    fhir:name [ fhir:v "extractloinc" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "loincItem" ] ;
    fhir:condition [ fhir:v "(text.contains('code loinc'))" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "setloinccoding" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "loincItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "loincAns" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:variable [ fhir:v "code" ]             ] [
    fhir:context [ fhir:v "code" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "coding" ] ;
    fhir:variable [ fhir:v "coding" ]             ] [
    fhir:context [ fhir:v "coding" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%loincAns.valueString"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "extracteffective" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "dateItem" ] ;
    fhir:condition [ fhir:v "(text.contains('Date et heure du prélèvement'))" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "seteffective" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "dateItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "dateAns" ]             ] ) ;
                ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "effective" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%dateAns.valueDateTime"                 ]               ] )             ] )           ] )         ] [
    fhir:name [ fhir:v "setrefrange" ] ;
              ( fhir:source [
    fhir:context [ fhir:v "ans" ]           ] ) ;
              ( fhir:target [
    fhir:context [ fhir:v "obs" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "referenceRange" ] ;
    fhir:variable [ fhir:v "refRange" ]           ] ) ;
              ( fhir:rule [
    fhir:name [ fhir:v "extractlow" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "lowItem" ] ;
    fhir:condition [ fhir:v "(text.contains('Borne inférieure'))" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "setlow" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "lowItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "lowAns" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "refRange" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "low" ] ;
    fhir:variable [ fhir:v "tgtLow" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%lowAns.valueQuantity"                   ]                 ] )               ] [
    fhir:context [ fhir:v "tgtLow" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity.unit"                   ]                 ] )               ] [
    fhir:context [ fhir:v "tgtLow" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://unitsofmeasure.org"                   ]                 ] )               ] )             ] )           ] [
    fhir:name [ fhir:v "extracthigh" ] ;
                ( fhir:source [
    fhir:context [ fhir:v "ans" ] ;
    fhir:element [ fhir:v "item" ] ;
    fhir:variable [ fhir:v "highItem" ] ;
    fhir:condition [ fhir:v "(text.contains('Borne supérieure'))" ]             ] ) ;
                ( fhir:rule [
    fhir:name [ fhir:v "sethigh" ] ;
                  ( fhir:source [
    fhir:context [ fhir:v "highItem" ] ;
    fhir:element [ fhir:v "answer" ] ;
    fhir:variable [ fhir:v "highAns" ]               ] ) ;
                  ( fhir:target [
    fhir:context [ fhir:v "refRange" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "high" ] ;
    fhir:variable [ fhir:v "tgtHigh" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%highAns.valueQuantity"                   ]                 ] )               ] [
    fhir:context [ fhir:v "tgtHigh" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "code" ] ;
    fhir:transform [ fhir:v "evaluate" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "%ans.valueQuantity.unit"                   ]                 ] )               ] [
    fhir:context [ fhir:v "tgtHigh" ] ;
    fhir:contextType [ fhir:v "variable" ] ;
    fhir:element [ fhir:v "system" ] ;
    fhir:transform [ fhir:v "copy" ] ;
                    ( fhir:parameter [
    fhir:value [
    a fhir:String ;
    fhir:v "http://unitsofmeasure.org"                   ]                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
      ] ) . #