WHO Digital Documentation of COVID-19 Certificates (DDCC)
1.0.1 - release International flag

This page is part of the WHO Digital Documentation of COVID-19 Certificates (DDCC) (v1.0.1: 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

StructureMap:

Official URL: http://smart.who.int/ddcc/StructureMap/CoreDataSetVSLibrary Version: 1.0.1
Draft as of 2024-12-18 Computable Name: CoreDataSetVSLibrary

Generated Narrative: StructureMap CoreDataSetVSLibrary

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

uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS" alias DDCCVS as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias AddBundle as target
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCPatient" alias DDCCPatient as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCDocumentReferenceQR" alias DDCCDocRefQR as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCVSComposition" alias DDCCVSComposition as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCImmunization" alias DDCCImmunization as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCImmunizationRecommendation" alias DDCCImmRec as target

imports "http://smart.who.int/ddcc/StructureMap/CoreDataSetLibrary"

group VSToAddBundle(source ddcc : DDCCVS, target bundle : AddBundle) {
  ddcc -> bundle.type = 'transaction' "set bundle type";
  ddcc ->  uuid() as pid,  uuid() as compid,  uuid() as iid,  uuid() as irid,  uuid() as qrwhoid,  uuid() as qrdccid then {
    ddcc ->  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', pid),  entry.request as request,  request.method = 'PUT',  request.url = append('Patient/', pid),  create('http://smart.who.int/ddcc/StructureDefinition/DDCCPatient') as patient then {
      ddcc then DDCCToPatient(ddcc, patient, pid) "setup patient";
      ddcc -> entry.resource = patient "set patient resource";
    } "create patient resource";
    ddcc ->  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', compid),  entry.request as request,  request.method = 'PUT',  request.url = append('Composition/', compid),  create('http://smart.who.int/ddcc/StructureDefinition/DDCCVSComposition') as comp then {
      ddcc then DDCCToComposition(ddcc, comp, compid, pid) "setup composition";
      ddcc ->  comp.category as category,  category.coding as coding,  coding.system = 'http://smart.who.int/ddcc/CodeSystem/DDCCCompositionCategoryCodeSystem',  coding.code = 'ddcc-vs' "set category";
      ddcc -> comp.title = 'International Certificate of Vaccination or Prophylaxis' "set title";
      ddcc -> comp.section as section then {
        ddcc ->  section.code as code,  code.coding as coding,  coding.system = 'http://loinc.org',  coding.code = '11369-6' "set code";
        ddcc.certificate as certificate then {
          certificate.issuer as issuer -> section.author = issuer "set author";
        } "set certificate";
        // ddcc.certificate as certificate -> section.author as author then {             certificate.issuer as issuer then {               issuer.identifier as pha -> author.identifier as identifier, author.type = "Organization" then {                 pha.value as value -> identifier.value = value "set pha";               } "set author identifier";             } "set author ref";                        } "set author";
        ddcc ->  section.focus as focus,  focus.reference = append('Immunization/', iid) "set focus";
        ddcc ->  section.entry as entry,  entry.reference = append('Immunization/', iid) "add Immunization entry";
        ddcc ->  section.entry as entry,  entry.reference = append('ImmunizationRecommendation/', irid) "add ImmunizationRecommendation entry";
        ddcc ->  section.entry as entry,  entry.reference = append('DocumentReference/', qrwhoid) "add WHO QR entry";
        ddcc ->  section.entry as entry,  entry.reference = append('DocumentReference/', qrdccid) "add DCC QR entry";
      } "set section";
      ddcc -> entry.resource = comp "set composition resource";
    } "create composition resource";
    ddcc ->  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', qrwhoid),  entry.request as request,  request.method = 'PUT',  request.url = append('DocumentReference/', qrwhoid),  create('http://smart.who.int/ddcc/StructureDefinition/DDCCDocumentReferenceQR') as qr then {
      ddcc then DDCCToDocumentReference(ddcc, qr, qrwhoid, pid) "setup WHO DocRef";
      ddcc ->  qr.category as category,  category.coding as coding,  coding.system = 'http://smart.who.int/ddcc/CodeSystem/DDCCQRCategoryUsageCodeSystem',  coding.code = 'who' "set category";
      ddcc -> qr.description = 'WHO QR code for COVID 19 Vaccine Certificate' "set description";
      ddcc -> entry.resource = qr "set WHO QR";
    } "create WHO QR Doc Ref";
    ddcc ->  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', qrdccid),  entry.request as request,  request.method = 'PUT',  request.url = append('DocumentReference/', qrdccid),  create('http://smart.who.int/ddcc/StructureDefinition/DDCCDocumentReferenceQR') as qr then {
      ddcc then DDCCToDocumentReference(ddcc, qr, qrdccid, pid) "setup DCC DocRef";
      ddcc ->  qr.category as category,  category.coding as coding,  coding.system = 'http://smart.who.int/ddcc/CodeSystem/DDCCQRCategoryUsageCodeSystem',  coding.code = 'dcc' "set category";
      ddcc -> qr.description = 'DCC QR code for COVID 19 Vaccine Certificate' "set description";
      ddcc -> entry.resource = qr "set DCC QR";
    } "create DCC QR Doc Ref";
    ddcc.vaccination first as vaccination ->  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', iid),  entry.request as request,  request.method = 'PUT',  request.url = append('Immunization/', iid),  create('http://smart.who.int/ddcc/StructureDefinition/DDCCImmunization') as immunization then {
      ddcc.certificate as certificate then DDCCToImmunization(vaccination, immunization, certificate, iid, pid) "setup immunization";
      ddcc -> entry.resource = immunization "set immunization resource";
    } "create immunization resource";
    ddcc.vaccination first as vaccination ->  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', irid),  entry.request as request,  request.method = 'PUT',  request.url = append('ImmunizationRecommendation/', irid),  create('http://smart.who.int/ddcc/StructureDefinition/DDCCImmunizationRecommendation') as immrec then {
      vaccination then DDCCToImmRec(vaccination, immrec, irid, iid, pid) "setup immunization recommendation";
      ddcc -> entry.resource = immrec "set immunization recommendation resource";
    } "create immunization recommendation resource";
  } "set uuids";
}

group DDCCToImmunization(source src, target immunization : DDCCImmunization, source certificate, source iid, source pid) {
  iid -> immunization.id = iid "set id";
  src.brand as brand -> immunization.extension as ext then {
    brand ->  ext.url = 'http://smart.who.int/ddcc/StructureDefinition/DDCCVaccineBrand',  ext.value = brand "set brand extension values";
  } "set brand extension";
  src.maholder as maholder -> immunization.extension as ext then {
    maholder ->  ext.url = 'http://smart.who.int/ddcc/StructureDefinition/DDCCVaccineMarketAuthorization',  ext.value = maholder "set MA Holder extension values";
  } "set maholder extension";
  src.country as country -> immunization.extension as ext then {
    country.code as code ->  ext.url = 'http://smart.who.int/ddcc/StructureDefinition/DDCCCountryOfVaccination',  ext.value = code "set country extension values";
  } "set country extension";
  src.validFrom as validFrom -> immunization.extension as ext then {
    validFrom ->  ext.url = 'http://smart.who.int/ddcc/StructureDefinition/DDCCVaccineValidFrom',  ext.value = validFrom "set valid from extension values";
  } "set vaccine valid extension";
  src -> immunization.status = 'completed' "set status";
  src.vaccine as vaccine ->  immunization.vaccineCode as vacCode,  vacCode.coding = vaccine "set vaccine";
  src ->  immunization.patient as patient,  patient.reference = append('Patient/', pid) "set patient";
  src.manufacturer as manufacturer ->  immunization.manufacturer as tman,  tman.identifier as ident then {
    manufacturer.system as system -> ident.system = system "set system";
    manufacturer.code as code -> ident.value = code "set value";
  } "set manufacturer identifier";
  src.lot as lot -> immunization.lotNumber = lot "set lot number";
  src.date as date -> immunization.occurrence = date "set occurrence date";
  src.centre as centre -> immunization.location as location then {
    centre -> location.display = centre "set location display";
  } "set location";
  src.practitioner as practitioner -> immunization.performer as performer then {
    practitioner.value as hw -> performer.actor as actor then {
      hw ->  actor.type = 'Practitioner',  actor.identifier as identifier then {
        hw -> identifier.value = hw "set hw identifier";
      } "set actor";
    } "set performer";
  } "set practitioner";
  src -> immunization.protocolApplied as protocol then {
    src -> protocol.authority as authority then {
      certificate.issuer as issuer -> authority.type = 'Organization' then {
        issuer.identifier as pha -> authority.identifier as identifier then {
          pha.value as value -> identifier.value = value "set pha";
        } "set issuer identifier";
      } "set issuer";
    } "set authority";
    src.disease as disease -> protocol.targetDisease as tdisease then {
      disease -> tdisease.coding = disease "set target disease code";
    } "set target disease";
    src.dose as dose -> protocol.doseNumber = dose "set dose number";
    src.totalDoses as totalDoses -> protocol.seriesDoses = totalDoses "set total doses";
  } "set protocolApplied";
}

group DDCCToImmRec(source src, target immrec : DDCCImmunizationRecommendation, source irid, source iid, source pid) {
  src.date as date -> immrec.date = date "set date";
  src ->  immrec.patient as patient,  patient.reference = append('Patient/', pid) "set patient";
  src -> immrec.recommendation as rec then {
    src.vaccine as vaccine -> rec.vaccineCode as vaccineCode then {
      vaccine -> vaccineCode.coding = vaccine "set vaccine code coding";
    } "set vaccine code";
    src.disease as disease -> rec.targetDisease as targetDisease then {
      disease -> targetDisease.coding = disease "set target disease coding";
    } "set target disease";
    src -> rec.forecastStatus as forecast then {
      src -> forecast.coding as coding then {
        src -> coding.system = 'http://terminology.hl7.org/2.1.0/CodeSystem-immunization-recommendation-status.html' "set forecast system";
        src -> coding.code = 'due' "set forecast code";
      } "set forecast status coding";
    } "set forecast status";
    src -> rec.dateCriterion as due_date then {
      src -> due_date.code as code then {
        src -> code.coding as coding then {
          src -> coding.system = 'http://loinc.org' "set due date code system";
          src -> coding.code = '30980-7' "set due date code code";
        } "set due date code coding";
      } "set due date code";
      src.nextDose as nextDose -> due_date.value = nextDose "set due date value";
    } "set date criterion";
    src.dose as dose -> rec.doseNumber = (dose.toInteger() + 1) "set dose number";
    src.totalDoses as totalDoses -> rec.seriesDoses = totalDoses "set total doses";
    src ->  rec.supportingImmunization as imm,  imm.reference = append('Immunization/', iid) "set supporting immunization";
  } "set recommendation";
}