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. For a full list of available versions, see the Directory of published versions

StructureMap:

Official URL: http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetVS Version: 1.0.0
Draft as of 2024-10-15 Computable Name: SHCToCoreDataSetVS

Generated Narrative: StructureMap SHCToCoreDataSetVS

map "http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetVS" = "SHCToCoreDataSetVS"

uses "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-vaccination-bundle-dm" alias SHCVaccinationBundleDM as source
uses "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-patient-general-dm" alias SHCPatientDM as source
uses "http://hl7.org/fhir/uv/shc-vaccination/StructureDefinition/shc-vaccination-dm" alias SHCImmunizationDM as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias DDCCBundle as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS" alias DDCCVS as target

group SHCToVS(source shc : SHCVaccinationBundleDM, target ddccBundle : DDCCBundle) {
  shc.entry as patientEntrySHC then {
    patientEntrySHC.resource : Patient first as patient then {
      shc.entry as entry then {
        // 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/DDCCCoreDataSetVS') as ddcc then {
        entry.resource : Immunization as immunization ->  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS') as ddcc then {
          immunization then PatientToDDCCVS(patient, ddcc) "set patient";
          immunization -> ddcc.vaccination as vaccination then ImmunizationToDDCC(immunization, vaccination) "set vaccination";
          immunization -> outentry.resource = ddcc "set outentry";
        } "immunizations";
      } "entries";
    } "get patient";
  } "find patient";
}

group PatientToDDCCVS(source patient : SHCPatientDM, target tgt : DDCCVS) {
  patient.name as name then NameToText(name, tgt) "set name";
  patient.birthDate as birthDate -> tgt.birthDate = birthDate "set birthDate";
  patient.identifier first as identifier -> tgt.identifier = identifier "set identifier";
}

group NameToText(source name : HumanName, target ddcc) {
  // append doesn't work until ddcc.name is set
  name.given first as given -> ddcc.name = (given.replaceMatches('$', ' ')) "set first name";
  // name.given not_first as other -> ddcc.name as tName, ddcc.name = append( tName, other ) "set other names";
  name.given not_first as other ->  ddcc.name as tName,  (other.replaceMatches('$', ' ')) as spaced,  ddcc.name = append(tName, spaced) "set other names";
  name.family as family ->  ddcc.name as tName,  ddcc.name = append(tName, family) "add family name";
  name.text as text -> ddcc.name = text "set full name";
}

group ImmunizationToDDCC(source immunization : SHCImmunizationDM, target vaccination) {
  immunization.vaccineCode as vaccine then {
    vaccine.coding as coding then {
      coding -> vaccination.vaccine = coding "set default vaccine";
      coding -> vaccination.brand = coding "set default brand";
      coding where coding.memberOf('http://smart.who.int/ddcc/ValueSet/vaccine-covid19-cvx') -> vaccination.vaccine = translate(coding, 'http://smart.who.int/ddcc/ConceptMap/vaccine-covid19-cvx-to-icd11', 'Coding') "translate COVID CVX vaccine";
      coding where coding.memberOf('http://smart.who.int/ddcc/ValueSet/vaccine-covid19-snomed') -> vaccination.vaccine = translate(coding, 'http://smart.who.int/ddcc/ConceptMap/vaccine-covid19-snomed-to-icd11', 'Coding') "translate COVID SNOMED vaccine";
    };
  };
  immunization.manufacturer as tman then {
    tman.identifier as identifier -> vaccination.manufacturer as manufacturer then {
      identifier.system as system -> manufacturer.system = system "set manufacturer system";
      identifier.value as value -> manufacturer.code = value "set manufacturer value";
    } "set manufacturer id";
  };
  immunization.lotNumber as lot -> vaccination.lot = lot "set lot";
  immunization.occurrence as date -> vaccination.date = date "set date";
  immunization.performer as performer then {
    performer.actor as actor then {
      actor.display as centre -> vaccination.centre = centre "set centre";
    };
  };
}