WHO Digital Documentation of COVID-19 Certificates (DDCC)
1.0.0 - CI Build International flag

This page is part of the WHO Digital Documentation of COVID-19 Certificates (DDCC) (v1.0.0: releases Draft) based on FHIR (HL7® FHIR® Standard) R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

: null - TTL Representation

Draft as of 2024-10-15

Raw ttl | Download

@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@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 "SHCToCoreDataSetTR"] ; # 
  fhir:text [
fhir:status [ fhir:v "generated" ] ;
fhir:div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap SHCToCoreDataSetTR</b></p><a name=\"SHCToCoreDataSetTR\"> </a><a name=\"hcSHCToCoreDataSetTR\"> </a><a name=\"SHCToCoreDataSetTR-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetTR<span style=\"color: navy\">&quot; = &quot;</span>SHCToCoreDataSetTR<span style=\"color: navy\">&quot;\r\n\r\n</span><b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-bundle-dm<span style=\"color: navy\">&quot; </span><b>alias </b>SHCLabBundleDM <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-patient-general-dm<span style=\"color: navy\">&quot; </span><b>alias </b>SHCPatientDM <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-result-observation-dm<span style=\"color: navy\">&quot; </span><b>alias </b>SHCLabDM <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>DDCCBundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureDefinition-DDCCCoreDataSetTR.html\" title=\"DDCC Core Data Set Logical Model for Test Result\">http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR</a><span style=\"color: navy\">&quot; </span><b>alias </b>DDCCTR <b>as </b><b>target</b>\r\n\r\n<b>group </b>SHCToTR<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">shc</span><span style=\"color: navy\"> : </span>SHCLabBundleDM, <b>target</b> <span style=\"color: maroon\">ddccBundle</span><span style=\"color: navy\"> : </span>DDCCBundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  shc.entry<b> as </b><span style=\"color: maroon\">patientEntrySHC</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    patientEntrySHC.resource<span style=\"color: navy\"> : </span>Patient first<b> as </b><span style=\"color: maroon\">patient</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      shc.entry<b> as </b><span style=\"color: maroon\">entry</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        <span style=\"color: navy\">// </span><span style=\"color: green\">entry.resource : Immunization as immunization where vaccineCode.memberOf('http://smart.who.int/ddcc/ValueSet/who-ddcc-allowed-vaccines-covid-19') -&gt;  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS') as ddcc then {</span>\r\n        entry.resource<span style=\"color: navy\"> : </span>Observation<b> as </b><span style=\"color: maroon\">lab</span><span style=\"color: navy\"><b> -&gt; </b></span> ddccBundle.entry<b> as </b><span style=\"color: maroon\">outentry</span><span style=\"color: navy\">, </span> <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ddcc</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          lab<b> then </b>PatientToDDCCTR<span style=\"color: navy\">(</span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ddcc</span><span style=\"color: navy\">)</span> <i>&quot;set patient&quot;</i><span style=\"color: navy\">;</span>\r\n          lab<span style=\"color: navy\"><b> -&gt; </b></span>ddcc.test<b> as </b><span style=\"color: maroon\">test</span><b> then </b>LabToDDCC<span style=\"color: navy\">(</span><span style=\"color: maroon\">lab</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">test</span><span style=\"color: navy\">)</span> <i>&quot;set test&quot;</i><span style=\"color: navy\">;</span>\r\n          lab<span style=\"color: navy\"><b> -&gt; </b></span>outentry.resource = <span style=\"color: maroon\">ddcc</span> <i>&quot;set outentry&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;labs&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;entries&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;get patient&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;find patient&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PatientToDDCCTR<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>SHCPatientDM, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>DDCCTR<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  patient.name<b> as </b><span style=\"color: maroon\">name</span><b> then </b>NameToText<span style=\"color: navy\">(</span><span style=\"color: maroon\">name</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">)</span> <i>&quot;set name&quot;</i><span style=\"color: navy\">;</span>\r\n  patient.birthDate<b> as </b><span style=\"color: maroon\">birthDate</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.birthDate = <span style=\"color: maroon\">birthDate</span> <i>&quot;set birthDate&quot;</i><span style=\"color: navy\">;</span>\r\n  patient.identifier first<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <span style=\"color: maroon\">identifier</span> <i>&quot;set identifier&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>NameToText<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">name</span><span style=\"color: navy\"> : </span>HumanName, <b>target</b> <span style=\"color: maroon\">ddcc</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">append doesn't work until ddcc.name is set</span>\r\n  name.given first<b> as </b><span style=\"color: maroon\">given</span><span style=\"color: navy\"><b> -&gt; </b></span>ddcc.name = <span style=\"color: navy\">(</span>given.replaceMatches('$', ' ')<span style=\"color: navy\">)</span> <i>&quot;set first name&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: #b36b00\" title=\"This element was not defined prior to R5\">// name.given not_first as other -&gt; ddcc.name as tName, ddcc.name = append( tName, other ) &quot;set other names&quot;;</span>\r\n  name.given not_first<b> as </b><span style=\"color: maroon\">other</span><span style=\"color: navy\"><b> -&gt; </b></span> ddcc.name<b> as </b><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span> <span style=\"color: navy\">(</span>other.replaceMatches('$', ' ')<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">spaced</span><span style=\"color: navy\">, </span> ddcc.name = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">spaced</span><span style=\"color: navy\">)</span> <i>&quot;set other names&quot;</i><span style=\"color: navy\">;</span>\r\n  name.family<b> as </b><span style=\"color: maroon\">family</span><span style=\"color: navy\"><b> -&gt; </b></span> ddcc.name<b> as </b><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span> ddcc.name = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">family</span><span style=\"color: navy\">)</span> <i>&quot;add family name&quot;</i><span style=\"color: navy\">;</span>\r\n  name.text<b> as </b><span style=\"color: maroon\">text</span><span style=\"color: navy\"><b> -&gt; </b></span>ddcc.name = <span style=\"color: maroon\">text</span> <i>&quot;set full name&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>LabToDDCC<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">lab</span><span style=\"color: navy\"> : </span>SHCLabDM, <b>target</b> <span style=\"color: maroon\">test</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  lab.code<b> as </b><span style=\"color: maroon\">code</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    code.coding first<b> as </b><span style=\"color: maroon\">labType</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      labType<span style=\"color: navy\"><b> -&gt; </b></span>test.type = <span style=\"color: maroon\">labType</span> <i>&quot;set default type&quot;</i><span style=\"color: navy\">;</span>\r\n      labType<b> where </b>labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc')<span style=\"color: navy\"><b> -&gt; </b></span>test.type = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">labType</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'http://smart.who.int/ddcc/ConceptMap/lab-test-type-covid19-loinc-to-icd11'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span> <i>&quot;translate loinc type&quot;</i><span style=\"color: navy\">;</span>\r\n      labType<b> where </b>labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc')<span style=\"color: navy\"><b> -&gt; </b></span>test.pathogen = <b>c</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://id.who.int/icd11/mms'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'XN109'</span><span style=\"color: navy\">)</span> <i>&quot;set pathogen to COVID&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  lab.effectiveDateTime<b> as </b><span style=\"color: maroon\">date</span><span style=\"color: navy\"><b> -&gt; </b></span>test.date = <span style=\"color: maroon\">date</span> <i>&quot;set date&quot;</i><span style=\"color: navy\">;</span>\r\n  lab.valueCodeableConcept<b> as </b><span style=\"color: maroon\">value</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    value.coding first<b> as </b><span style=\"color: maroon\">result</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      result<span style=\"color: navy\"><b> -&gt; </b></span>test.result = <span style=\"color: maroon\">result</span> <i>&quot;set default result&quot;</i><span style=\"color: navy\">;</span>\r\n      result<b> where </b>result.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-qual-result-snomed')<span style=\"color: navy\"><b> -&gt; </b></span>test.result = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">result</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'http://smart.who.int/ddcc/ConceptMap/lab-test-qual-result-snomed-to-icd11'</span><span style=\"color: navy\">)</span> <i>&quot;translate snomed result&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">no target for result valueQuantity (for Ab titers) or valueString (for unmapped text)</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">pathogen and country are required, no source in SHC</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  ] ; # 
  fhir:url [ fhir:v "http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetTR"^^xsd:anyURI] ; # 
  fhir:version [ fhir:v "1.0.0"] ; # 
  fhir:name [ fhir:v "SHCToCoreDataSetTR"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:date [ fhir:v "2024-10-15T11:00:36+02:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "WHO"] ; # 
  fhir:contact ( [
fhir:name [ fhir:v "WHO" ] ;
    ( fhir:telecom [
fhir:system [ fhir:v "url" ] ;
fhir:value [ fhir:v "http://who.int" ]     ] )
  ] ) ; # 
  fhir:jurisdiction ( [
    ( fhir:coding [
fhir:system [ fhir:v "http://unstats.un.org/unsd/methods/m49/m49.htm"^^xsd:anyURI ] ;
fhir:code [ fhir:v "001" ]     ] )
  ] ) ; # 
  fhir:structure ( [
fhir:url [
fhir:v "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-bundle-dm"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-bundle-dm>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "SHCLabBundleDM" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-patient-general-dm"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-patient-general-dm>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "SHCPatientDM" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-result-observation-dm"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-result-observation-dm>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "SHCLabDM" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Bundle"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Bundle>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "DDCCBundle" ]
  ] [
fhir:url [
fhir:v "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR"^^xsd:anyURI ;
fhir:link <http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "DDCCTR" ]
  ] ) ; # 
  fhir:group ( [
fhir:name [ fhir:v "SHCToTR" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "shc" ] ;
fhir:type [ fhir:v "SHCLabBundleDM" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "ddccBundle" ] ;
fhir:type [ fhir:v "DDCCBundle" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "find patient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "shc" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "patientEntrySHC" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "get patient" ] ;
        ( fhir:source [
fhir:context [ fhir:v "patientEntrySHC" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:listMode [ fhir:v "first" ] ;
fhir:variable [ fhir:v "patient" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "entries" ] ;
          ( fhir:source [
fhir:context [ fhir:v "shc" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "entry" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "labs" ] ;
            ( fhir:source [
fhir:context [ fhir:v "entry" ] ;
fhir:type [ fhir:v "Observation" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "lab" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "ddccBundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "outentry" ]             ] [
fhir:contextType [ fhir:v "variable" ] ;
fhir:variable [ fhir:v "ddcc" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "set patient" ] ;
              ( fhir:source [
fhir:context [ fhir:v "lab" ]               ] ) ;
              ( fhir:dependent [
fhir:name [ fhir:v "PatientToDDCCTR" ] ;
                ( fhir:variable [ fhir:v "patient" ] [ fhir:v "ddcc" ] )               ] )             ] [
fhir:name [ fhir:v "set test" ] ;
              ( fhir:source [
fhir:context [ fhir:v "lab" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "ddcc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "test" ] ;
fhir:variable [ fhir:v "test" ]               ] ) ;
              ( fhir:dependent [
fhir:name [ fhir:v "LabToDDCC" ] ;
                ( fhir:variable [ fhir:v "lab" ] [ fhir:v "test" ] )               ] )             ] [
fhir:name [ fhir:v "set outentry" ] ;
              ( fhir:source [
fhir:context [ fhir:v "lab" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "outentry" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "ddcc" ]                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "PatientToDDCCTR" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "SHCPatientDM" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:type [ fhir:v "DDCCTR" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "set name" ] ;
      ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "NameToText" ] ;
        ( fhir:variable [ fhir:v "name" ] [ fhir:v "tgt" ] )       ] )     ] [
fhir:name [ fhir:v "set birthDate" ] ;
      ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "birthDate" ] ;
fhir:variable [ fhir:v "birthDate" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "birthDate" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "birthDate" ]         ] )       ] )     ] [
fhir:name [ fhir:v "set identifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:listMode [ fhir:v "first" ] ;
fhir:variable [ fhir:v "identifier" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "identifier" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "NameToText" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "name" ] ;
fhir:type [ fhir:v "HumanName" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "ddcc" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "set first name" ] ;
      ( fhir:source [
fhir:context [ fhir:v "name" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:listMode [ fhir:v "first" ] ;
fhir:variable [ fhir:v "given" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ddcc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "given.replaceMatches('$', ' ')" ]         ] )       ] )     ] [
fhir:name [ fhir:v "set other names" ] ;
      ( fhir:source [
fhir:context [ fhir:v "name" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:listMode [ fhir:v "not_first" ] ;
fhir:variable [ fhir:v "other" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ddcc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "tName" ]       ] [
fhir:contextType [ fhir:v "variable" ] ;
fhir:variable [ fhir:v "spaced" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "other.replaceMatches('$', ' ')" ]         ] )       ] [
fhir:context [ fhir:v "ddcc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "tName" ]         ] [
fhir:value [ fhir:v "spaced" ]         ] )       ] )     ] [
fhir:name [ fhir:v "add family name" ] ;
      ( fhir:source [
fhir:context [ fhir:v "name" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:variable [ fhir:v "family" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ddcc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "tName" ]       ] [
fhir:context [ fhir:v "ddcc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "tName" ]         ] [
fhir:value [ fhir:v "family" ]         ] )       ] )     ] [
fhir:name [ fhir:v "set full name" ] ;
      ( fhir:source [
fhir:context [ fhir:v "name" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "text" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ddcc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "text" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "LabToDDCC" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "lab" ] ;
fhir:type [ fhir:v "SHCLabDM" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "test" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "lab" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "code" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coding" ] ;
        ( fhir:source [
fhir:context [ fhir:v "code" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:listMode [ fhir:v "first" ] ;
fhir:variable [ fhir:v "labType" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "set default type" ] ;
          ( fhir:source [
fhir:context [ fhir:v "labType" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "test" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "labType" ]             ] )           ] )         ] [
fhir:name [ fhir:v "translate loinc type" ] ;
          ( fhir:source [
fhir:context [ fhir:v "labType" ] ;
fhir:condition [ fhir:v "labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc')" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "test" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "translate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "labType" ]             ] [
fhir:value [ fhir:v "http://smart.who.int/ddcc/ConceptMap/lab-test-type-covid19-loinc-to-icd11" ]             ] [
fhir:value [ fhir:v "Coding" ]             ] )           ] )         ] [
fhir:name [ fhir:v "set pathogen to COVID" ] ;
          ( fhir:source [
fhir:context [ fhir:v "labType" ] ;
fhir:condition [ fhir:v "labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc')" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "test" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "pathogen" ] ;
fhir:transform [ fhir:v "c" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "http://id.who.int/icd11/mms" ]             ] [
fhir:value [ fhir:v "XN109" ]             ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "set date" ] ;
      ( fhir:source [
fhir:context [ fhir:v "lab" ] ;
fhir:element [ fhir:v "effectiveDateTime" ] ;
fhir:variable [ fhir:v "date" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "test" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "date" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "date" ]         ] )       ] )     ] [
fhir:name [ fhir:v "valueCodeableConcept" ] ;
      ( fhir:source [
fhir:context [ fhir:v "lab" ] ;
fhir:element [ fhir:v "valueCodeableConcept" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coding" ] ;
        ( fhir:source [
fhir:context [ fhir:v "value" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:listMode [ fhir:v "first" ] ;
fhir:variable [ fhir:v "result" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "set default result" ] ;
          ( fhir:source [
fhir:context [ fhir:v "result" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "test" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "result" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "result" ]             ] )           ] )         ] [
fhir:name [ fhir:v "translate snomed result" ] ;
          ( fhir:source [
fhir:context [ fhir:v "result" ] ;
fhir:condition [ fhir:v "result.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-qual-result-snomed')" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "test" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "result" ] ;
fhir:transform [ fhir:v "translate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "result" ]             ] [
fhir:value [ fhir:v "http://smart.who.int/ddcc/ConceptMap/lab-test-qual-result-snomed-to-icd11" ]             ] )           ] )         ] )       ] )     ] )
  ] ) . #