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

This is the continuous build for version 1.0.0. This version is based on the current content of https://github.com/WorldHealthOrganization/ddcc and changes regularly.

: SHCToCoreDataSetTR - JSON Representation

Draft as of 2024-01-19

Raw json | Download


{
  "resourceType" : "StructureMap",
  "id" : "SHCToCoreDataSetTR",
  "meta" : {
    "versionId" : "9",
    "lastUpdated" : "2023-02-15T19:50:41.165+00:00"
  },
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><pre>map &quot;http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetTR&quot; = &quot;SHCToCoreDataSetTR&quot;\r\n\r\n\r\nuses &quot;http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-bundle-dm&quot; alias SHCLabBundleDM as source\r\nuses &quot;http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-patient-general-dm&quot; alias SHCPatientDM as source\r\nuses &quot;http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-result-observation-dm&quot; alias SHCLabDM as source\r\nuses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias DDCCBundle as target\r\nuses &quot;http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.TR&quot; alias DDCCTR as produced\r\n\r\ngroup SHCToTR(source shc : SHCLabBundleDM, target ddccBundle : DDCCBundle) {\r\n  shc.entry as patientEntrySHC then {\r\n    patientEntrySHC.resource : Patient first as patient then {\r\n      shc.entry as entry then {\r\n        // 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/DDCCCoreDataSet.VS') as ddcc then {\r\n        entry.resource : Observation as lab -&gt;  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.TR') as ddcc then {\r\n          lab then PatientToDDCCTR(patient, ddcc) &quot;set patient&quot;;\r\n          lab -&gt; ddcc.test as test then LabToDDCC(lab, test) &quot;set test&quot;;\r\n          lab -&gt; outentry.resource = ddcc &quot;set outentry&quot;;\r\n        } &quot;labs&quot;;\r\n      } &quot;entries&quot;;\r\n    } &quot;get patient&quot;;\r\n  } &quot;find patient&quot;;\r\n}\r\n\r\ngroup PatientToDDCCTR(source patient : SHCPatientDM, target tgt : DDCCTR) {\r\n  patient.name as name then NameToText(name, tgt) &quot;set name&quot;;\r\n  patient.birthDate as birthDate -&gt; tgt.birthDate = birthDate &quot;set birthDate&quot;;\r\n  patient.identifier first as identifier -&gt; tgt.identifier = identifier &quot;set identifier&quot;;\r\n}\r\n\r\ngroup NameToText(source name : HumanName, target ddcc) {\r\n  // append doesn't work until ddcc.name is set\r\n  name.given first as given -&gt; ddcc.name = (given.replaceMatches('$', ' ')) &quot;set first name&quot;;\r\n  // name.given not_first as other -&gt; ddcc.name as tName, ddcc.name = append( tName, other ) &quot;set other names&quot;;\r\n  name.given not_first as other -&gt;  ddcc.name as tName,  (other.replaceMatches('$', ' ')) as spaced,  ddcc.name = append(tName, spaced) &quot;set other names&quot;;\r\n  name.family as family -&gt;  ddcc.name as tName,  ddcc.name = append(tName, family) &quot;add family name&quot;;\r\n  name.text as text -&gt; ddcc.name = text &quot;set full name&quot;;\r\n}\r\n\r\ngroup LabToDDCC(source lab : SHCLabDM, target test) {\r\n  lab.code as code then {\r\n    code.coding first as labType then {\r\n      labType -&gt; test.type = labType &quot;set default type&quot;;\r\n      labType where labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc') -&gt; test.type = translate(labType, 'http://smart.who.int/ddcc/ConceptMap/lab-test-type-covid19-loinc-to-icd11', 'Coding') &quot;translate loinc type&quot;;\r\n      labType where labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc') -&gt; test.pathogen = c('http://id.who.int/icd11/mms', 'XN109') &quot;set pathogen to COVID&quot;;\r\n    };\r\n  };\r\n  lab.effectiveDateTime as date -&gt; test.date = date &quot;set date&quot;;\r\n  lab.valueCodeableConcept as value then {\r\n    value.coding first as result then {\r\n      result -&gt; test.result = result &quot;set default result&quot;;\r\n      result where result.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-qual-result-snomed') -&gt; test.result = translate(result, 'http://smart.who.int/ddcc/ConceptMap/lab-test-qual-result-snomed-to-icd11') &quot;translate snomed result&quot;;\r\n    };\r\n  };\r\n}\r\n\r\n</pre></div>"
  },
  "url" : "http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetTR",
  "version" : "1.0.0",
  "name" : "SHCToCoreDataSetTR",
  "status" : "draft",
  "date" : "2024-01-19T16:18:21+00:00",
  "publisher" : "WHO",
  "contact" : [
    {
      "name" : "WHO",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://who.int"
        }
      ]
    }
  ],
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code" : "001"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-bundle-dm",
      "mode" : "source",
      "alias" : "SHCLabBundleDM"
    },
    {
      "url" : "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-patient-general-dm",
      "mode" : "source",
      "alias" : "SHCPatientDM"
    },
    {
      "url" : "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-infectious-disease-laboratory-result-observation-dm",
      "mode" : "source",
      "alias" : "SHCLabDM"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode" : "target",
      "alias" : "DDCCBundle"
    },
    {
      "url" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.TR",
      "mode" : "produced",
      "alias" : "DDCCTR"
    }
  ],
  "group" : [
    {
      "name" : "SHCToTR",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "shc",
          "type" : "SHCLabBundleDM",
          "mode" : "source"
        },
        {
          "name" : "ddccBundle",
          "type" : "DDCCBundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "find patient",
          "source" : [
            {
              "context" : "shc",
              "element" : "entry",
              "variable" : "patientEntrySHC"
            }
          ],
          "rule" : [
            {
              "name" : "get patient",
              "source" : [
                {
                  "context" : "patientEntrySHC",
                  "type" : "Patient",
                  "element" : "resource",
                  "listMode" : "first",
                  "variable" : "patient"
                }
              ],
              "rule" : [
                {
                  "name" : "entries",
                  "source" : [
                    {
                      "context" : "shc",
                      "element" : "entry",
                      "variable" : "entry"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "labs",
                      "source" : [
                        {
                          "context" : "entry",
                          "type" : "Observation",
                          "element" : "resource",
                          "variable" : "lab"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "ddccBundle",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "outentry"
                        },
                        {
                          "contextType" : "variable",
                          "variable" : "ddcc",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.TR"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "set patient",
                          "source" : [
                            {
                              "context" : "lab"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "PatientToDDCCTR",
                              "variable" : [
                                "patient",
                                "ddcc"
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "set test",
                          "source" : [
                            {
                              "context" : "lab"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "ddcc",
                              "contextType" : "variable",
                              "element" : "test",
                              "variable" : "test"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "LabToDDCC",
                              "variable" : [
                                "lab",
                                "test"
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "set outentry",
                          "source" : [
                            {
                              "context" : "lab"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "outentry",
                              "contextType" : "variable",
                              "element" : "resource",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "ddcc"
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "documentation" : "entry.resource : Immunization as immunization where vaccineCode.memberOf('http://smart.who.int/ddcc/ValueSet/who-ddcc-allowed-vaccines-covid-19') ->  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.VS') as ddcc then {"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "PatientToDDCCTR",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "patient",
          "type" : "SHCPatientDM",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "DDCCTR",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set name",
          "source" : [
            {
              "context" : "patient",
              "element" : "name",
              "variable" : "name"
            }
          ],
          "dependent" : [
            {
              "name" : "NameToText",
              "variable" : [
                "name",
                "tgt"
              ]
            }
          ]
        },
        {
          "name" : "set birthDate",
          "source" : [
            {
              "context" : "patient",
              "element" : "birthDate",
              "variable" : "birthDate"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "birthDate",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "birthDate"
                }
              ]
            }
          ]
        },
        {
          "name" : "set identifier",
          "source" : [
            {
              "context" : "patient",
              "element" : "identifier",
              "listMode" : "first",
              "variable" : "identifier"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "identifier"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "NameToText",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "name",
          "type" : "HumanName",
          "mode" : "source"
        },
        {
          "name" : "ddcc",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set first name",
          "source" : [
            {
              "context" : "name",
              "element" : "given",
              "listMode" : "first",
              "variable" : "given"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "given.replaceMatches('$', ' ')"
                }
              ]
            }
          ],
          "documentation" : "append doesn't work until ddcc.name is set"
        },
        {
          "name" : "set other names",
          "source" : [
            {
              "context" : "name",
              "element" : "given",
              "listMode" : "not_first",
              "variable" : "other"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "tName"
            },
            {
              "contextType" : "variable",
              "variable" : "spaced",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "other.replaceMatches('$', ' ')"
                }
              ]
            },
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "append",
              "parameter" : [
                {
                  "valueId" : "tName"
                },
                {
                  "valueId" : "spaced"
                }
              ]
            }
          ],
          "documentation" : "name.given not_first as other -> ddcc.name as tName, ddcc.name = append( tName, other ) \"set other names\";"
        },
        {
          "name" : "add family name",
          "source" : [
            {
              "context" : "name",
              "element" : "family",
              "variable" : "family"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "tName"
            },
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "append",
              "parameter" : [
                {
                  "valueId" : "tName"
                },
                {
                  "valueId" : "family"
                }
              ]
            }
          ]
        },
        {
          "name" : "set full name",
          "source" : [
            {
              "context" : "name",
              "element" : "text",
              "variable" : "text"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "text"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "LabToDDCC",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "lab",
          "type" : "SHCLabDM",
          "mode" : "source"
        },
        {
          "name" : "test",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "code",
          "source" : [
            {
              "context" : "lab",
              "element" : "code",
              "variable" : "code"
            }
          ],
          "rule" : [
            {
              "name" : "coding",
              "source" : [
                {
                  "context" : "code",
                  "element" : "coding",
                  "listMode" : "first",
                  "variable" : "labType"
                }
              ],
              "rule" : [
                {
                  "name" : "set default type",
                  "source" : [
                    {
                      "context" : "labType"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "test",
                      "contextType" : "variable",
                      "element" : "type",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "labType"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "translate loinc type",
                  "source" : [
                    {
                      "context" : "labType",
                      "condition" : "labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "test",
                      "contextType" : "variable",
                      "element" : "type",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "labType"
                        },
                        {
                          "valueString" : "http://smart.who.int/ddcc/ConceptMap/lab-test-type-covid19-loinc-to-icd11"
                        },
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "set pathogen to COVID",
                  "source" : [
                    {
                      "context" : "labType",
                      "condition" : "labType.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "test",
                      "contextType" : "variable",
                      "element" : "pathogen",
                      "transform" : "c",
                      "parameter" : [
                        {
                          "valueString" : "http://id.who.int/icd11/mms"
                        },
                        {
                          "valueString" : "XN109"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "set date",
          "source" : [
            {
              "context" : "lab",
              "element" : "effectiveDateTime",
              "variable" : "date"
            }
          ],
          "target" : [
            {
              "context" : "test",
              "contextType" : "variable",
              "element" : "date",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "date"
                }
              ]
            }
          ]
        },
        {
          "name" : "valueCodeableConcept",
          "source" : [
            {
              "context" : "lab",
              "element" : "valueCodeableConcept",
              "variable" : "value"
            }
          ],
          "rule" : [
            {
              "name" : "coding",
              "source" : [
                {
                  "context" : "value",
                  "element" : "coding",
                  "listMode" : "first",
                  "variable" : "result"
                }
              ],
              "rule" : [
                {
                  "name" : "set default result",
                  "source" : [
                    {
                      "context" : "result"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "test",
                      "contextType" : "variable",
                      "element" : "result",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "result"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "translate snomed result",
                  "source" : [
                    {
                      "context" : "result",
                      "condition" : "result.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-qual-result-snomed')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "test",
                      "contextType" : "variable",
                      "element" : "result",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "result"
                        },
                        {
                          "valueString" : "http://smart.who.int/ddcc/ConceptMap/lab-test-qual-result-snomed-to-icd11"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}