Generated Narrative: StructureMap CertICAOtoCoreDataSet #xD; map "http://smart.who.int/ddcc/StructureMap/CertICAOtoCoreDataSet" = "CertICAOtoCoreDataSet"#xD; #xD; // Structure map transforming CertICAO logical model to bundle of Core Data Set logical model#xD; #xD; uses "http://smart.who.int/ddcc/StructureDefinition/CertICAOVDS" alias VDS as source#xD; uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias DDCCBundle as target#xD; uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet" alias DDCC as target#xD; uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS" alias DDCCVS as target#xD; uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR" alias DDCCTR as target#xD; #xD; group CertICAOtoCoreDataSet(source src : VDS, target ddccBundle : DDCCBundle) {#xD; src.data as data then {#xD; data.msg as msg then {#xD; msg.ve as ve then {#xD; ve.vd as vd -> ddccBundle.entry as outentry, create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS') as ddcc then {#xD; data.hdr as hdr -> ddcc.certificate as certificate then VDStoCoreDataSetCertificate(hdr, msg, certificate) "set certificate";#xD; msg.pid as pid then ExtractPatient(pid, ddcc) "set patient";#xD; vd -> ddcc.vaccination as vaccination then ExtractVaccine(ve, vd, vaccination) "set vaccination";#xD; vd -> outentry.resource = ddcc "set outentry";#xD; };#xD; };#xD; msg.tr as tr -> ddccBundle.entry as outentry, create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR') as ddcc then {#xD; data.hdr as hdr -> ddcc.certificate as certificate then VDStoCoreDataSetCertificate(hdr, msg, certificate) "set certificate";#xD; msg.pid as pid then ExtractPatient(pid, ddcc) "set patient";#xD; msg.sp as sp then {#xD; msg.dat as dat -> ddcc.test as test then ExtractTest(sp, dat, tr, test) "set test";#xD; };#xD; tr -> outentry.resource = ddcc "set outentry";#xD; };#xD; };#xD; };#xD; }#xD; #xD; group VDStoCoreDataSetCertificate(source hdr, source msg, target certificate) {#xD; hdr.v as v -> certificate.version = v "set version";#xD; msg.uvci as uvci -> certificate.hcid as hcid, hcid.value = uvci "set hcid from uvci";#xD; msg.utci as utci -> certificate.hcid as hcid, hcid.value = utci "set hcid from utci";#xD; hdr.is as is -> certificate.issuer = create('Reference') as issuer, issuer.display = is "set issuer";#xD; }#xD; #xD; group ExtractPatient(source pid, target ddcc : DDCC) {#xD; pid.n as name -> ddcc.name = name "set name";#xD; pid.dob as birthDate -> ddcc.birthDate = birthDate "set birthDate";#xD; pid.i as priorityIdentifier -> ddcc.identifier as identifier, identifier.value = priorityIdentifier "set priorityIdentifier";#xD; pid.dn -> ddcc.identifier as identifier then ExtractDocumentTypeNumber(pid, identifier) "set Document Type Number";#xD; }#xD; #xD; group ExtractDocumentTypeNumber(source src, target identif : Identifier) {#xD; src.dn as docNumber -> identif.value = docNumber "set doc number";#xD; src.dt as docType where (docType = 'P') -> identif.system = 'PPN' "set doc number P"; // P – Passport (Doc 9303-4)#xD; src.dt as docType where (docType = 'A') -> identif.system = 'DL' "set doc number A"; // A – ID Card (Doc 9303-5)#xD; src.dt as docType where (docType = 'C') -> identif.system = 'DL' "set doc number C"; // C – ID Card (Doc 9303-5)#xD; src.dt as docType where (docType = 'I') -> identif.system = 'DL' "set doc number I"; // I – ID Card Doc 9303-5)#xD; src.dt as docType where (docType = 'AC') -> identif.system = 'EN' "set doc number AC"; // AC - Crew Member Certificate (Doc 9303-5)#xD; src.dt as docType where (docType = 'V') -> identif.system = 'ACSN' "set doc number V"; // V – Visa (Doc 9303-7)#xD; src.dt as docType where (docType = 'D') -> identif.system = 'DL' "set doc number D"; // D – Driving License (ISO18013-1)#xD; }#xD; #xD; group ExtractVaccine(source ve, source vd, target vaccination) {#xD; ve.des as des -> vaccination.vaccine as coding, coding.system = 'http://id.who.int/icd11/mms', coding.code = des "set vaccine";#xD; ve.nam as nam -> vaccination.brand as coding, coding.code = nam "set brand";#xD; ve.dis as dis -> vaccination.disease as coding, coding.system = 'http://id.who.int/icd11/mms', coding.code = dis "set target disease";#xD; vd.dvc as dvc -> vaccination.date = dvc "set date";#xD; vd.seq as seq -> vaccination.dose = seq "set dose";#xD; vd.dvn as dvn -> vaccination.nextDose = dvn "set nextDose";#xD; vd.ctr as ctr -> vaccination.country as coding then {#xD; ctr then ExtractCountry(ctr, coding) "set country";#xD; };#xD; vd.adm as adm -> vaccination.centre = adm "set centre";#xD; vd.lot as lot -> vaccination.lot = lot "set lot";#xD; }#xD; #xD; group ExtractTest(source sp, source dat, source tr, target test) {#xD; tr -> test.pathogen as coding, coding.system = 'http://id.who.int/icd11/mms', coding.code = 'XN109' "set pathogen";#xD; tr.tc as tc then {#xD; tc -> test.type as coding, coding.code = tc "set default type";#xD; tc -> c('http://smart.who.int/ddcc/CodeSystem/lab-test-type-icao', tc) as coded then {#xD; tc where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-icao') -> test.type = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-type-icao-to-icd11', 'Coding') "translate ICAO type";#xD; } "coding";#xD; };#xD; tr.m as m then {#xD; m -> test.origin as coding, coding.code = m "set default origin";#xD; m -> c('http://smart.who.int/ddcc/CodeSystem/lab-test-sample-origin-icao', m) as coded then {#xD; m where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-sample-origin-icao') -> test.origin = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-sample-origin-icao-to-icd11', 'Coding') "translate ICAO origin";#xD; } "coding";#xD; };#xD; dat.sc as date -> test.date = date "set date";#xD; tr.r as r then {#xD; r -> test.result as coding, coding.code = r "set default result";#xD; r -> c('http://smart.who.int/ddcc/CodeSystem/lab-test-qual-result-icao', r) as coded then {#xD; r where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-qual-result-icao') -> test.result = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-qual-result-icao-to-icd11', 'Coding') "translate ICAO result";#xD; } "coding";#xD; };#xD; sp.spn as spn -> test.centre as coding, coding.code = spn "set centre";#xD; sp.ctr as ctr -> test.country as coding then {#xD; ctr then ExtractCountry(ctr, coding) "set country";#xD; };#xD; }#xD; #xD; group ExtractCountry(source country, target coding) {#xD; // ICAO Doc 9303-1 country codes are a superset of ISO 3166 3 letter codes#xD; country -> coding.code = country "set default country";#xD; country -> c('urn:iso:std:iso:3166', country) as coded then {#xD; country where coded.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-3') -> coding.code = country, coding.system = 'urn:iso:std:iso:3166' "set country with system";#xD; } "coded";#xD; }#xD; #xD;
Structure map transforming CertICAO logical model to bundle of Core Data Set logical model
AC - Crew Member Certificate (Doc 9303-5)