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.

StructureMap: DDCCtoEUdcc

Official URL: http://smart.who.int/ddcc/StructureMap/DDCCtoEUdcc Version: 1.0.0
Draft as of 2024-01-19 Computable Name: DDCCtoEUdcc
map "http://smart.who.int/ddcc/StructureMap/DDCCtoEUdcc" = "DDCCtoEUdcc"


uses "http://smart.who.int/ddcc/StructureDefinition/DDCCVSomposition" alias DDCC as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCDocument" alias DDCCDocument as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCPatient" alias DDCCPatient as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCVSComposition" alias DDCCVSComposition as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCOrganization" alias DDCCOrganization as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCountryOfVaccination" alias DDCCCountryOfVaccination as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCVaccineBrand" alias DDCCVaccineBrand as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCImmunization" alias DDCCImmunization as source
uses "http://hl7.eu/fhir/ig/dcc/StructureDefinition/HC1" alias EUDCC as target
uses "http://hl7.eu/fhir/ig/dcc/StructureDefinition/v" alias vacEvent as target

group DecodeDDCCtoQR(source ddcc : DDCCDocument, target qr : EUDCC) {
  ddcc -> qr.ver = 'XXX' "Version";
  ddcc.entry as entry then {
    entry.resource : DDCCPatient as patient then DecodePatientToQR(patient, qr) "Patient";
  } "Patient";
  ddcc.entry as entry then {
    entry.resource : Immunization as immunization then DecodeImmunizationToQR(ddcc, immunization, qr) "Immunization";
  } "Immunization";
}

group DecodePatientToQR(source patient : DDCCPatient, target qr : EUDCC) {
  patient.birthDate as birthDate -> qr.dob = birthDate;
  patient.name as name then {
    name.text as text -> qr.nam = text;
  };
}

group DecodeImmunizationToQR(source ddcc : DDCCDocument, source immunization : DDCCImmunization, target qr : EUDCC) {
  immunization -> qr.v = create('http://hl7.eu/fhir/ig/dcc/StructureDefinition/v') as vacEvent then {
    immunization.protocolApplied as protocol then {
      protocol.doseNumberPositiveInt as dose -> vacEvent.dn = dose;
      protocol.seriesDosesPositiveInt as doseNum -> vacEvent.sd = doseNum;
      protocol.targetDisease as targetDisease then {
        targetDisease.coding as coding then {
          coding.code as code -> vacEvent.tg = code;
        } "Protocol-Disease-Code";
      } "Protocol-Disease";
    } "Protocol";
    immunization.occurrenceDateTime as date -> vacEvent.dt = date;
    // TODO: need to populate vacEvent.ma market authorization holder
    immunization.extension as country where (url = 'http://smart.who.int/ddcc/StructureDefinition/DDCCCountryOfEvent') then {
      country.valueCode as code -> vacEvent.co = code;
    } "Country";
    // immunization.extension : DDCCBrand as brand
    immunization.extension as brand where (url = 'http://smart.who.int/ddcc/StructureDefinition/DDCCEventBrand') then {
      brand.valueCoding as valueCoding then {
        valueCoding.code as code -> vacEvent.mp = code;
      } "Vaccine-Brand-Code";
    } "Vaccine-Brand";
    // immunization.vaccineCode : Coding as vaccineCode then {
    immunization.vaccineCode as vaccineCode then {
      vaccineCode.coding as coding then {
        coding.code as code -> vacEvent.vp = code;
      } "Vaccine-Code";
    } "Vaccine-Coding";
    ddcc.entry as entry then {
      // entry.resource : DDCCOrganization as organization
      entry.resource : Organization as organization then {
        organization.name as name -> vacEvent.is = name;
      } "Centre-Name";
    } "Vaccination-Centre";
    ddcc.entry as entry then {
      // entry.resource : DDCCVSComposition as composition
      entry.resource : Composition as composition then {
        composition.identifier as identifier then {
          identifier.value as value -> vacEvent.ci = value;
        } "Vaccination-Event-ID-Value";
      } "Vaccination-Event-ID";
    } "Vaccination-Event";
  } "Vaccination";
}