@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://ig.phase2.scip.synanetics.cloud/StructureMap/Patient-Registration> a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "Patient-Registration"] ; # 
  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>Generated Narrative: StructureMap Patient-Registration</b></p><a name=\"Patient-Registration\"> </a><a name=\"hcPatient-Registration\"> </a><pre class=\"fml\">#xD;\n<b>map</b><span style=\"color: navy\"> \"</span>https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Patient-Registration<span style=\"color: navy\">\" = \"</span>PatientToRegistration<span style=\"color: navy\">\"#xD;\n#xD;\n</span><b>uses</b><span style=\"color: navy\"> \"</span><a href=\"StructureDefinition-MODS-Patient.html\" title=\"MODS Patient\">https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-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><a href=\"StructureDefinition-MODS-RegistrationStatus.html\" title=\"MODS Registration Status\">https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-RegistrationStatus</a><span style=\"color: navy\">\" </span><b>alias </b>RegistrationStatus <b>as </b><b>target</b>#xD;\n#xD;\n<b>group </b>PatientRegistration<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\">tgt</span><span style=\"color: navy\"> : </span>RegistrationStatus<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.subjectOfCareId = evaluate<span style=\"color: navy\">(</span>src<span style=\"color: navy\">, </span>id<span style=\"color: navy\">)</span> <i>\"867e3c30-bdfe-4f6e-b5fe-bf0957312f58\"</i><span style=\"color: navy\">;</span>#xD;\n  src<span style=\"color: navy\"><b> -&gt; </b></span> tgt.meta<b> as </b><span style=\"color: maroon\">meta</span><span style=\"color: navy\">, </span> meta.dataClass<b> as </b><span style=\"color: maroon\">dataClass</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>dataClass.name = <span style=\"color: blue\">'Registration'</span> <i>\"7806cf8c-72e4-46dc-bdbd-32c5c9e5d5f8\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"setDataClassName\"</i><span style=\"color: navy\">;</span>#xD;\n  src.meta<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>tgt.updatedAt = evaluate<span style=\"color: navy\">(</span>meta<span style=\"color: navy\">, </span>lastUpdated<span style=\"color: navy\">)</span> <i>\"06106e07-df65-4c3b-8bb2-8ada21e43815\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"setUpdatedAt\"</i><span style=\"color: navy\">;</span>#xD;\n  src.meta<b> as </b><span style=\"color: maroon\">meta</span><span style=\"color: navy\">, </span>meta.tag<b> as </b><span style=\"color: maroon\">tag</span><b> where </b>$this.system='https://yhcr.nhs.uk/pix/registration/status'and$this.code!='success'<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = evaluate<span style=\"color: navy\">(</span>tag<span style=\"color: navy\">, </span>code<span style=\"color: navy\">)</span> <i>\"c67d24be-4560-4104-89b2-5c01159d990e\"</i><span style=\"color: navy\">;</span>#xD;\n    src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.reason = evaluate<span style=\"color: navy\">(</span>tag<span style=\"color: navy\">, </span>display<span style=\"color: navy\">)</span> <i>\"5d59340c-e41f-4358-a227-786b904b3bae\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"setStatusAndReason\"</i><span style=\"color: navy\">;</span>#xD;\n  src.contained<b> as </b><span style=\"color: maroon\">contained</span><span style=\"color: navy\">, </span>contained<b> as </b><span style=\"color: maroon\">oo</span><b> where </b>$this.resourceType='OperationOutcome'<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    oo.issue<b> as </b><span style=\"color: maroon\">issue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.diagnostics = evaluate<span style=\"color: navy\">(</span>issue<span style=\"color: navy\">, </span>diagnostics<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"setErrorDiagnostics\"</i><span style=\"color: navy\">;</span>#xD;\n  src.meta<b> as </b><span style=\"color: maroon\">meta</span><span style=\"color: navy\">, </span>meta.tag<b> as </b><span style=\"color: maroon\">tag</span><b> where </b>$this.system='https://yhcr.nhs.uk/pix/registration/status'and$this.code='success'<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = <span style=\"color: blue\">'success'</span> <i>\"65554b50-2cbe-4b3d-b585-d65e38066bad\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"setSuccessStatus\"</i><span style=\"color: navy\">;</span>#xD;\n  tgt<b> where </b>$this.status.exists().not()<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    tgt<span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = <span style=\"color: blue\">'unknown'</span> <i>\"e08b0daa-a19a-4992-96f0-d124a86933b6\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"da470550-add5-4098-bdf4-d7d4d145d626\"</i><span style=\"color: navy\">;</span>#xD;\n  \"setUnknownStatus\" <i>\"7fb80f03-3e33-4d80-8faa-35b2cb9a7d14\"</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://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Patient-Registration"^^xsd:anyURI ;
     fhir:l <https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Patient-Registration>
  ] ; # 
  fhir:version [ fhir:v "0.1.0"] ; # 
  fhir:name [ fhir:v "PatientToRegistration"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:date [ fhir:v "2026-06-10T19:05:58+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "Synanetics Ltd on behalf of DHSC/Social Care Interoperability Platform"] ; # 
  fhir:contact ( [
     fhir:name [ fhir:v "Synanetics Ltd on behalf of DHSC/Social Care Interoperability Platform" ] ;
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "https://synanetics.com" ]
     ] [
       fhir:system [ fhir:v "email" ] ;
       fhir:value [ fhir:v "info@synanetics.com" ]
     ] )
  ] ) ; # 
  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 "GB" ] ;
       fhir:display [ fhir:v "United Kingdom of Great Britain and Northern Ireland" ]
     ] )
  ] ) ; # 
  fhir:structure ( [
     fhir:url [
       fhir:v "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-Patient"^^xsd:anyURI ;
       fhir:l <https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-Patient>
     ] ;
     fhir:mode [ fhir:v "source" ] ;
     fhir:alias [ fhir:v "Patient" ]
  ] [
     fhir:url [
       fhir:v "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-RegistrationStatus"^^xsd:anyURI ;
       fhir:l <https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-RegistrationStatus>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "RegistrationStatus" ]
  ] ) ; # 
  fhir:group ( [
     fhir:name [ fhir:v "PatientRegistration" ] ;
     fhir:typeMode [ fhir:v "none" ] ;
     fhir:input ( [
       fhir:name [ fhir:v "src" ] ;
       fhir:type [ fhir:v "Patient" ] ;
       fhir:mode [ fhir:v "source" ]
     ] [
       fhir:name [ fhir:v "tgt" ] ;
       fhir:type [ fhir:v "RegistrationStatus" ] ;
       fhir:mode [ fhir:v "target" ]
     ] ) ;
     fhir:rule ( [
       fhir:name [ fhir:v "867e3c30-bdfe-4f6e-b5fe-bf0957312f58" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "tgt" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "subjectOfCareId" ] ;
         fhir:transform [ fhir:v "evaluate" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "src"
           ]
         ] [
           fhir:value [
             a fhir:String ;
             fhir:v "id"
           ]
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "setDataClassName" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "tgt" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "meta" ] ;
         fhir:variable [ fhir:v "meta" ]
       ] [
         fhir:context [ fhir:v "meta" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "dataClass" ] ;
         fhir:variable [ fhir:v "dataClass" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "7806cf8c-72e4-46dc-bdbd-32c5c9e5d5f8" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "dataClass" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "name" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "Registration"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "setUpdatedAt" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:element [ fhir:v "meta" ] ;
         fhir:variable [ fhir:v "meta" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "06106e07-df65-4c3b-8bb2-8ada21e43815" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "updatedAt" ] ;
           fhir:transform [ fhir:v "evaluate" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "meta"
             ]
           ] [
             fhir:value [
               a fhir:String ;
               fhir:v "lastUpdated"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "setStatusAndReason" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:element [ fhir:v "meta" ] ;
         fhir:variable [ fhir:v "meta" ]
       ] [
         fhir:context [ fhir:v "meta" ] ;
         fhir:element [ fhir:v "tag" ] ;
         fhir:variable [ fhir:v "tag" ] ;
         fhir:condition [ fhir:v "$this.system='https://yhcr.nhs.uk/pix/registration/status'and$this.code!='success'" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "c67d24be-4560-4104-89b2-5c01159d990e" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "status" ] ;
           fhir:transform [ fhir:v "evaluate" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "tag"
             ]
           ] [
             fhir:value [
               a fhir:String ;
               fhir:v "code"
             ]
           ] )
         ] )
       ] [
         fhir:name [ fhir:v "5d59340c-e41f-4358-a227-786b904b3bae" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "reason" ] ;
           fhir:transform [ fhir:v "evaluate" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "tag"
             ]
           ] [
             fhir:value [
               a fhir:String ;
               fhir:v "display"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "setErrorDiagnostics" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:element [ fhir:v "contained" ] ;
         fhir:variable [ fhir:v "contained" ]
       ] [
         fhir:context [ fhir:v "contained" ] ;
         fhir:variable [ fhir:v "oo" ] ;
         fhir:condition [ fhir:v "$this.resourceType='OperationOutcome'" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "issue" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "oo" ] ;
           fhir:min [ fhir:v 1 ] ;
           fhir:max [ fhir:v "1" ] ;
           fhir:element [ fhir:v "issue" ] ;
           fhir:variable [ fhir:v "issue" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "diagnostics" ] ;
           fhir:transform [ fhir:v "evaluate" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "issue"
             ]
           ] [
             fhir:value [
               a fhir:String ;
               fhir:v "diagnostics"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "setSuccessStatus" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:element [ fhir:v "meta" ] ;
         fhir:variable [ fhir:v "meta" ]
       ] [
         fhir:context [ fhir:v "meta" ] ;
         fhir:element [ fhir:v "tag" ] ;
         fhir:variable [ fhir:v "tag" ] ;
         fhir:condition [ fhir:v "$this.system='https://yhcr.nhs.uk/pix/registration/status'and$this.code='success'" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "65554b50-2cbe-4b3d-b585-d65e38066bad" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "src" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "status" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "success"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "da470550-add5-4098-bdf4-d7d4d145d626" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "tgt" ] ;
         fhir:condition [ fhir:v "$this.status.exists().not()" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "e08b0daa-a19a-4992-96f0-d124a86933b6" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "tgt" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "status" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "unknown"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "7fb80f03-3e33-4d80-8faa-35b2cb9a7d14" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "\"setUnknownStatus\"" ]
       ] )
     ] )
  ] ) . # 

# -------------------------------------------------------------------------------------

