@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 -------------------------------------------------------------------

<https://aphp.github.io/IG-fhir-dm/StructureMap/CoreFHIRPatient2OMOP> a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "CoreFHIRPatient2OMOP"] ; # 
  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 CoreFHIRPatient2OMOP</b></p><a name=\"CoreFHIRPatient2OMOP\"> </a><a name=\"hcCoreFHIRPatient2OMOP\"> </a><pre class=\"fml\">#xD;\n<b>map</b><span style=\"color: navy\"> \"</span>https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIRPatient2OMOP<span style=\"color: navy\">\" = \"</span>CoreFHIRPatient2OMOP<span style=\"color: navy\">\"#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Cette ressource présente les spécifications de l''alignement entre la ressource `Patient` vers les tables correspodantes du CDM OMOP.</span>#xD;\n#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">\" </span><b>alias </b>Patient <b>as </b><b>source</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/LogicalBundle<span style=\"color: navy\">\" </span><b>alias </b>LogicalBundle <b>as </b><b>target</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPPerson<span style=\"color: navy\">\" </span><b>alias </b>PersonTable <b>as </b><b>target</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPLocation<span style=\"color: navy\">\" </span><b>alias </b>LocationTable <b>as </b><b>target</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span>https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPDeath<span style=\"color: navy\">\" </span><b>alias </b>DeathTable <b>as </b><b>target</b>#xD;\n#xD;\n<b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-CoreFHIR2OMOPPerson.html\" title=\"Mapping FHIR Patient resource to OMOP Person\">https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPPerson</a><span style=\"color: navy\">\"#xD;\n</span><b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-CoreFHIR2OMOPLocation.html\" title=\"Mapping Patient resource to Location OMOP Domain\">https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation</a><span style=\"color: navy\">\"#xD;\n</span><b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-CoreFHIR2OMOPDeath.html\" title=\"Mapping FHIR Patient resource to OMOP Death\">https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPDeath</a><span style=\"color: navy\">\"#xD;\n</span>#xD;\n<b>group </b>Patient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">tgtBundle</span><span style=\"color: navy\"> : </span>LogicalBundle<span style=\"color: navy\">)</span><b> &lt;&lt;types&gt;&gt;</b><span style=\"color: navy\"> {#xD;\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>tgtBundle.entry<b> as </b><span style=\"color: maroon\">newEntry</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>newEntry.person = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PersonTable'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newPerson</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      src<b> then </b>Person<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newPerson</span><span style=\"color: navy\">)</span> <i>\"transformPerson\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createPerson\"</i><span style=\"color: navy\">;</span>#xD;\n    src.address<b> as </b><span style=\"color: maroon\">srcAddress</span><b> where </b>(use = 'home') and period.end.empty()<span style=\"color: navy\"><b> -&gt; </b></span>newEntry.location = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'LocationTable'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newLocation</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      srcAddress<b> then </b>Location<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcAddress</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newLocation</span><span style=\"color: navy\">)</span> <i>\"transformLocation\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createLocation\"</i><span style=\"color: navy\">;</span>#xD;\n    src<b> where </b>deceased.is(System.DateTime) or deceased.is(System.Boolean)<span style=\"color: navy\"><b> -&gt; </b></span>newEntry.death = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'DeathTable'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newDeath</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      src<b> then </b>Death<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newDeath</span><span style=\"color: navy\">)</span> <i>\"transformDeath\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"createDeath\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"newEntry\"</i><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span></pre></div>"^^rdf:XMLLiteral ]
  ] ; # 
  fhir:url [
     fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIRPatient2OMOP"^^xsd:anyURI ;
     fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIRPatient2OMOP>
  ] ; # 
  fhir:version [ fhir:v "0.1.0"] ; # 
  fhir:name [ fhir:v "CoreFHIRPatient2OMOP"] ; # 
  fhir:title [ fhir:v "Cette ressource présente les spécifications de l''alignement entre la ressource `Patient` vers les tables correspodantes du CDM OMOP."] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:date [ fhir:v "2026-04-16T14:35:38+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 "Cette ressource présente les spécifications de l''alignement entre la ressource `Patient` vers les tables correspodantes du CDM OMOP."] ; # 
  fhir:jurisdiction ( [
     fhir:coding ( [
       fhir:system [
         fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ;
         fhir:l <urn:iso:std:iso:3166>
       ] ;
       fhir:code [ fhir:v "FR" ]
     ] )
  ] ) ; # 
  fhir:structure ( [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/Patient"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/Patient>
     ] ;
     fhir:mode [ fhir:v "source" ] ;
     fhir:alias [ fhir:v "Patient" ]
  ] [
     fhir:url [
       fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/LogicalBundle"^^xsd:anyURI ;
       fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/LogicalBundle>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "LogicalBundle" ]
  ] [
     fhir:url [
       fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPPerson"^^xsd:anyURI ;
       fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPPerson>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "PersonTable" ]
  ] [
     fhir:url [
       fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPLocation"^^xsd:anyURI ;
       fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPLocation>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "LocationTable" ]
  ] [
     fhir:url [
       fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPDeath"^^xsd:anyURI ;
       fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPDeath>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "DeathTable" ]
  ] ) ; # 
  fhir:import ( [
     fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPPerson"^^xsd:anyURI ;
     fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPPerson>
  ] [
     fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation"^^xsd:anyURI ;
     fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation>
  ] [
     fhir:v "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPDeath"^^xsd:anyURI ;
     fhir:l <https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPDeath>
  ] ) ; # 
  fhir:group ( [
     fhir:name [ fhir:v "Patient" ] ;
     fhir:typeMode [ fhir:v "types" ] ;
     fhir:input ( [
       fhir:name [ fhir:v "src" ] ;
       fhir:type [ fhir:v "Patient" ] ;
       fhir:mode [ fhir:v "source" ]
     ] [
       fhir:name [ fhir:v "tgtBundle" ] ;
       fhir:type [ fhir:v "LogicalBundle" ] ;
       fhir:mode [ fhir:v "target" ]
     ] ) ;
     fhir:rule ( [
       fhir:name [ fhir:v "newEntry" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "tgtBundle" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "entry" ] ;
         fhir:variable [ fhir:v "newEntry" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "createPerson" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "newEntry" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "person" ] ;
           fhir:variable [ fhir:v "newPerson" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "PersonTable"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "transformPerson" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "src" ]
           ] ) ;
           fhir:dependent ( [
             fhir:name [ fhir:v "Person" ] ;
             fhir:variable ( [ fhir:v "src" ] [ fhir:v "newPerson" ] )
           ] )
         ] )
       ] [
         fhir:name [ fhir:v "createLocation" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ] ;
           fhir:element [ fhir:v "address" ] ;
           fhir:variable [ fhir:v "srcAddress" ] ;
           fhir:condition [ fhir:v "(use = 'home') and period.end.empty()" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "newEntry" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "location" ] ;
           fhir:variable [ fhir:v "newLocation" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "LocationTable"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "transformLocation" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "srcAddress" ]
           ] ) ;
           fhir:dependent ( [
             fhir:name [ fhir:v "Location" ] ;
             fhir:variable ( [ fhir:v "srcAddress" ] [ fhir:v "newLocation" ] )
           ] )
         ] )
       ] [
         fhir:name [ fhir:v "createDeath" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ] ;
           fhir:condition [ fhir:v "deceased.is(System.DateTime) or deceased.is(System.Boolean)" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "newEntry" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "death" ] ;
           fhir:variable [ fhir:v "newDeath" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "DeathTable"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "transformDeath" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "src" ]
           ] ) ;
           fhir:dependent ( [
             fhir:name [ fhir:v "Death" ] ;
             fhir:variable ( [ fhir:v "src" ] [ fhir:v "newDeath" ] )
           ] )
         ] )
       ] )
     ] )
  ] ) . # 

# -------------------------------------------------------------------------------------

