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

StructureMap:

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

Structure map transforming CertDIVOC logical model to bundle of Core Data Set logical model

Generated Narrative: StructureMap CertDIVOCtoCoreDataSet

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

// Structure map transforming CertDIVOC logical model to bundle of Core Data Set logical model

uses "http://smart.who.int/ddcc/StructureDefinition/CertDIVOC" alias DIVOC as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias DDCCBundle as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet" alias DDCC as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS" alias DDCCVS as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR" alias DDCCTR as target

group CertDIVOCtoCoreDataSetBundle(source src : DIVOC, target ddccBundle : DDCCBundle) {
  src.type as type then {
    type where type = 'ProofOfVaccinationCredential' then {
      src.evidence as evidence ->  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS') as ddcc then {
        src.credentialSubject as credentialSubject then CredentialSubjecttoCoreDataSet(credentialSubject, ddcc) "set patient";
        src -> ddcc.certificate as certificate then CertDIVOCtoCoreDataSetCertificate(src, evidence, certificate) "set certificate";
        evidence -> ddcc.vaccination as vaccination then EvidencetoCoreDataSetVS(evidence, vaccination) "set vaccination";
        evidence -> outentry.resource = ddcc "set outentry";
      };
    } "ProofOfVaccinationCredential";
    type where type = 'ProofOfTestCertificateCredential' then {
      src.evidence as evidence ->  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR') as ddcc then {
        src.credentialSubject as credentialSubject then CredentialSubjecttoCoreDataSet(credentialSubject, ddcc) "set patient";
        src -> ddcc.certificate as certificate then CertDIVOCtoCoreDataSetCertificate(src, evidence, certificate) "set certificate";
        evidence -> ddcc.test as test then EvidencetoCoreDataSetTR(evidence, test) "set test";
        evidence -> outentry.resource = ddcc "set outentry";
      };
    } "ProofOfTestCertificateCredential";
  };
}

group CredentialSubjecttoCoreDataSet(source credentialSubject, target ddcc : DDCC) {
  credentialSubject.name as name -> ddcc.name = name "set name";
  credentialSubject.dob as birthDate -> ddcc.birthDate = birthDate "set birthDate";
  credentialSubject.id as id ->  create('Identifier') as identifier,  identifier.value = id then {
    id -> ddcc.identifier = identifier "set identifier";
  } "identifier";
}

group CertDIVOCtoCoreDataSetCertificate(source src : DIVOC, source evidence, target certificate) {
  evidence.certificateId as certificateId ->  certificate.hcid as hcid,  hcid.value = certificateId "set hcid";
  src.context as context then {
    context where (context.contains('cowin.gov.in')) -> certificate.version = context "set version";
  };
  evidence -> certificate.period = create('Period') as period then {
    evidence.effectiveStart as effectiveStart -> period.start = effectiveStart "set period start";
    evidence.effectiveUntil as effectiveUntil -> period.end = effectiveUntil "set period end";
  } "period";
  src.issuer as issuer ->  certificate.issuer = create('Reference') as issuer,  issuer.display = issuer "set issuer";
}

group EvidencetoCoreDataSetVS(source evidence, target vaccination) {
  evidence.icd11Code as icd11Code ->  vaccination.vaccine as coding,  coding.system = 'http://id.who.int/icd11/mms',  coding.code = icd11Code "set vaccine";
  evidence.vaccine as vaccine ->  vaccination.brand as coding,  coding.code = vaccine "set brand";
  evidence.manufacturer as manufacturer ->  vaccination.manufacturer as coding,  coding.code = manufacturer "set manufacturer";
  evidence.batch as batch -> vaccination.lot = batch "set lot";
  evidence.date as date -> vaccination.date = date "set date";
  evidence.dose as dose -> vaccination.dose = dose "set dose";
  evidence.totalDoses as totalDoses -> vaccination.totalDoses = totalDoses "set totalDoses";
  evidence.facility as facility then {
    facility.address as address then {
      address.addressCountry as addressCountry ->  vaccination.country as coding,  coding.system = 'urn:iso:std:iso:3166',  coding.code = addressCountry "set country";
    };
    facility.name as name -> vaccination.centre = name "set centre";
  };
  evidence.verifier as verifier then {
    verifier.name as name ->  vaccination.practitioner as practitioner,  practitioner.value = name "set practitioner";
  };
}

group EvidencetoCoreDataSetTR(source evidence, target test) {
  evidence.disease as disease then {
    disease where disease = 'COVID-19' ->  test.pathogen as coding,  coding.system = 'http://id.who.int/icd11/mms',  coding.code = 'XN109' "set COVID19 pathogen";
    disease where (disease = 'COVID-19').not() ->  test.pathogen as coding,  coding.code = disease "set other pathogen";
  };
  evidence.testType as testType then {
    testType ->  test.type as coding,  coding.code = testType "set default type";
    testType -> c('http://smart.who.int/ddcc/CodeSystem/lab-test-type-divoc', testType) as coded then {
      testType where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-divoc') -> test.type = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-type-divoc-to-icd11', 'Coding') "translate DIVOC type";
    } "coding";
  };
  evidence.sampleOrigin as sampleOrigin then {
    sampleOrigin ->  test.origin as coding,  coding.code = sampleOrigin "set default origin";
    sampleOrigin -> c('http://smart.who.int/ddcc/CodeSystem/lab-test-sample-origin-divoc', sampleOrigin) as coded then {
      sampleOrigin where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-sample-origin-divoc') -> test.origin = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-sample-origin-divoc-to-icd11', 'Coding') "translate DIVOC origin";
    } "coding";
  };
  evidence.result as result then {
    result ->  test.result as coding,  coding.code = result "set default result";
    result -> c('http://smart.who.int/ddcc/CodeSystem/lab-test-qual-result-divoc', result) as coded then {
      result where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-qual-result-divoc') -> test.result = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-qual-result-divoc-to-icd11', 'Coding') "translate DIVOC result";
    } "coded";
  };
  evidence.sampleCollectionTimestamp as date -> test.date = date "set date";
  evidence.testName as testName ->  test.brand as coding,  coding.code = testName "set brand";
  evidence.manufacturer as manufacturer ->  test.manufacturer as coding,  coding.code = manufacturer "set manufacturer";
  evidence.facility as facility then {
    facility.address as address then {
      address.addressCountry as addressCountry ->  test.country as coding,  coding.system = 'urn:iso:std:iso:3166',  coding.code = addressCountry "set country";
    };
    facility.name as name ->  test.centre as coding,  coding.code = name "set centre";
  };
}