Generated Narrative: StructureMap CertDCCtoCoreDataSet #xD; map "http://smart.who.int/ddcc/StructureMap/CertDCCtoCoreDataSet" = "CertDCCtoCoreDataSet"#xD; #xD; // Structure map transforming CertDCC logical model to bundle of Core Data Set logical model#xD; #xD; uses "http://smart.who.int/ddcc/StructureDefinition/CertDCC" alias CWTPayload 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 CertDCCtoCoreDataSet(source src : CWTPayload, target ddccBundle : DDCCBundle) {#xD; src.-260 as hcert then {#xD; hcert.1 as dcc then {#xD; dcc.v as v -> ddccBundle.entry as outentry, create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVS') as ddcc then {#xD; v then DCCtoCoreDataSet(dcc, ddcc) "set DDCC";#xD; v -> ddcc.certificate as certificate then CertDCCtoCoreDataSetCertificate(src, dcc, v, certificate) "set certificate";#xD; v -> ddcc.vaccination as vaccination then VtoCoreDataSetVS(v, vaccination) "set vaccination";#xD; v -> outentry.resource = ddcc "set outentry";#xD; };#xD; dcc.t as t -> ddccBundle.entry as outentry, create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetTR') as ddcc then {#xD; t then DCCtoCoreDataSet(dcc, ddcc) "set DDCC";#xD; t -> ddcc.certificate as certificate then CertDCCtoCoreDataSetCertificate(src, dcc, t, certificate) "set certificate";#xD; t -> ddcc.test as test then TtoCoreDataSetTR(t, test) "set test";#xD; t -> outentry.resource = ddcc "set outentry";#xD; };#xD; } "eu_DCC_v1";#xD; } "hcert";#xD; }#xD; #xD; group DCCtoCoreDataSet(source dcc, target ddcc : DDCC) {#xD; dcc.dob as birthDate -> ddcc.birthDate = birthDate "set birthDate";#xD; dcc.nam as nam then {#xD; nam.gn as given -> ddcc.name = (given.replaceMatches('$', ' ')) "set given name";#xD; nam.fn as family -> ddcc.name as tName, ddcc.name = append(tName, family) "add family name";#xD; };#xD; }#xD; #xD; group CertDCCtoCoreDataSetCertificate(source src : CWTPayload, source dcc, source g, target certificate) {#xD; src -> certificate.period = create('Period') as period then CwtToPeriod(src, period) "set period";#xD; dcc.ver as ver -> certificate.version = ver "set version";#xD; g.ci as ci -> certificate.hcid as hcid, hcid.value = ci "set hcid";#xD; g.is as is -> certificate.issuer = create('Reference') as issuer, issuer.display = is "set issuer";#xD; }#xD; #xD; group CwtToPeriod(source src : CWTPayload, target tgt : Period) {#xD; src.6 as iat -> append(iat, ' seconds') as epoch, tgt.start = (@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()) "set period start";#xD; src.4 as exp -> append(exp, ' seconds') as epoch, tgt.end = (@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()) "set period end";#xD; }#xD; #xD; group VtoCoreDataSetVS(source v, target vaccination) {#xD; v.tg as tg -> vaccination.disease as coding, coding.system = 'http://snomed.info/sct', coding.code = tg "set target disease";#xD; v.vp as vp -> vaccination.vaccine as coding, coding.system = 'https://ec.europa.eu/health/documents/community-register/html/', coding.code = vp "set vaccine";#xD; v.mp as mp then {#xD; mp -> vaccination.brand as coding, coding.system = 'https://id.uvci.eu/valuesets/vaccine-medicinal-product.json', coding.code = mp "set default brand";#xD; mp -> c('https://ec.europa.eu/health/documents/community-register/html/', mp) as coded then {#xD; mp where coded.memberOf('http://smart.who.int/ddcc/ValueSet/vaccine-covid19-euur') -> vaccination.brand = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/vaccine-covid19-euur-to-icd11', 'Coding') "translate COVID19 brand";#xD; } "coding";#xD; };#xD; v.ma as ma -> vaccination.maholder as coding, coding.system = 'https://id.uvci.eu/valuesets/vaccine-mah-manf.json', coding.code = ma "set maholder";#xD; v.dt as date -> vaccination.date = date "set date";#xD; v.dn as dose -> vaccination.dose = dose "set dose";#xD; v.sd as totalDoses -> vaccination.totalDoses = totalDoses "set totalDoses";#xD; v.co as co -> vaccination.country as coding, coding.code = co, coding.system = 'urn:iso:std:iso:3166' "set country";#xD; }#xD; #xD; group TtoCoreDataSetTR(source t, target test) {#xD; t.tg as tg then {#xD; tg -> test.pathogen as coding, coding.system = 'http://snomed.info/sct', coding.code = tg "set default pathogen";#xD; tg -> c('http://snomed.info/sct', tg) as coded then {#xD; tg where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-pathogen-covid19-snomed') -> test.pathogen = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-pathogen-snomed-to-icd11', 'Coding') "translate COVID19 pathogen";#xD; } "coding";#xD; };#xD; t.tt as tt then {#xD; tt -> test.type as coding, coding.system = 'http://loinc.org', coding.code = tt "set default type";#xD; tt -> c('http://loinc.org', tt) as coded then {#xD; tt where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-type-covid19-loinc') -> test.type = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-type-covid19-loinc-to-icd11', 'Coding') "translate COVID19 type";#xD; } "coding";#xD; };#xD; t.nm as nm -> test.brand as coding, coding.system = 'https://id.uvci.eu/valuesets/test-manf.json', coding.code = nm "set brand";#xD; t.ma as ma -> test.manufacturer as coding, coding.system = 'https://covid-19-diagnostics.jrc.ec.europa.eu/devices', coding.code = ma "set manufacturer";#xD; t.sc as date -> test.date = date "set date";#xD; t.tr as tr then {#xD; tr -> test.result as coding, coding.system = 'http://snomed.info/sct', coding.code = tr "set default result";#xD; tr -> c('http://snomed.info/sct', tr) as coded then {#xD; tr where coded.memberOf('http://smart.who.int/ddcc/ValueSet/lab-test-qual-result-snomed') -> test.result = translate(coded, 'http://smart.who.int/ddcc/ConceptMap/lab-test-qual-result-snomed-to-icd11', 'Coding') "translate COVID19 result";#xD; } "coding";#xD; };#xD; t.tc as tc -> test.centre as coding, coding.code = tc "set centre";#xD; t.co as co -> test.country as coding, coding.code = co, coding.system = 'urn:iso:std:iso:3166' "set country";#xD; }#xD; #xD;
Structure map transforming CertDCC logical model to bundle of Core Data Set logical model