Generated Narrative: StructureMap EUDCCtoDDCC #xD; map "http://smart.who.int/ddcc/StructureMap/CertDCCtoDDCC" = "EUDCCtoDDCC"#xD; #xD; uses "http://smart.who.int/ddcc/StructureDefinition/CertDCC" alias CWT as source#xD; uses "http://hl7.eu/fhir/ig/dcc/StructureDefinition/HC1" alias HC1 as source#xD; uses "http://hl7.eu/fhir/ig/dcc/StructureDefinition/PersonName" alias PersonName as source#xD; uses "http://hl7.eu/fhir/ig/dcc/StructureDefinition/v" alias VacEvent as source#xD; uses "http://hl7.eu/fhir/ig/dcc/StructureDefinition/t" alias TestEvent as source#xD; uses "http://hl7.eu/fhir/ig/dcc/StructureDefinition/r" alias RecEvent as source#xD; uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target#xD; #xD; group EUDCCtoDDCC(source src : CWT, target bundle : Bundle) {#xD; src -> bundle.type = 'transaction' "set bundle type";#xD; src -> bundle, bundle.entry as entry, entry.resource = create('Composition') as comp then {#xD; src.data as data then {#xD; data.cert as cert -> bundle then ExtractCert(cert, bundle, comp) "Certificate";#xD; } "Processing cert data";#xD; src -> bundle then ExtractComposition(src, comp) "Composition";#xD; } "Patient and Composition Create";#xD; }#xD; #xD; group ExtractCert(source src : HC1, target bundle : Bundle, target comp : Composition) {#xD; src -> comp, bundle.entry as entry, entry.resource = create('Patient') as patient, uuid() as pid then {#xD; src -> patient then ExtractPatient(src, pid, patient) "extract patient";#xD; src -> comp.subject as subj, subj.reference = append('Patient/', pid) "Set patient";#xD; src where (src.v.count() > 0) -> comp.section as section then {#xD; src -> section.code as code, code.coding as coding, coding.system = 'http://loinc.org', coding.code = '11369-6', coding.display = 'History of Immunization Narrative' "add section";#xD; src.v as vac -> comp, bundle.entry as entryImm, entryImm.resource = create('Immunization') as immunization, uuid() as iid, bundle.entry as entryOrg, entryOrg.resource = create('Organization') as org, uuid() as oid then {#xD; src -> immunization.id = iid "Immunization ID";#xD; src -> org.id = oid "Organization ID";#xD; src -> section.entry as entry, entry.reference = append('Immunization/', iid), section.author as author, author.reference = append('Organization/', oid) "add entry/author to section";#xD; src -> comp.author as author, author.reference = append('Organization/', oid) "Set org";#xD; src -> immunization.patient as subj, subj.reference = append('Patient/', pid) "Set patient";#xD; vac.is as is -> org.name = is "Set Organization name";#xD; src -> bundle then ExtractVaccine(vac, oid, immunization) "extract vaccine info";#xD; } "Immunization Create";#xD; } "Vaccination List";#xD; } "Patient Create";#xD; }#xD; #xD; group ExtractVaccine(source vac : VacEvent, source oid, target immunization : Immunization) {#xD; vac.dt as dt -> immunization.occurrence = dt "set occurrence date";#xD; vac.vp as vp -> immunization.vaccineCode as type, type.coding as coding, coding.system = 'http://snomed.info/sct', coding.code = vp "set vaccine coding";#xD; vac.ci as ci -> immunization.identifier as identif, identif.value = ci "set identifier ci";#xD; vac.mp as mp -> immunization.extension as ext, ext.value = create('Coding') as coding, ext.url = 'https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineBrand', coding.code = mp, coding.system = 'https://www.ema.europa.eu/en/medicines/human/EPAR/comirnaty' "set brand";#xD; vac.ma as ma -> immunization.extension as ext, ext.value = create('Coding') as coding, ext.url = 'https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineMarketAuthorization', coding.code = ma, coding.system = 'https://www.ema.europa.eu/en/medicines/human/EPAR/comirnaty' "set manufacturer extension";#xD; vac.co as co -> immunization.extension as ext, ext.value = create('Coding') as coding, ext.url = 'https://smart.who.int/ddcc/StructureDefinition/DDCCCountryOfVaccination', coding.code = co, coding.system = 'urn:iso:std:iso:3166' "set country";#xD; vac -> immunization.protocolApplied as protocolApplied then ExtractProtocolApplied(vac, oid, protocolApplied) "set protocol applied";#xD; }#xD; #xD; group ExtractProtocolApplied(source vac : VacEvent, source oid, target protocol : ProtocolApplied) {#xD; vac.dn as dn -> protocol.doseNumber = dn "set dose number";#xD; vac.sd as sd -> protocol.seriesDoses = sd "set series doses";#xD; vac.tg as tg -> protocol.targetDisease as codeable, codeable.coding as coding, coding.system = 'http://snomed.info/sct', coding.code = tg "set target disease type";#xD; oid -> protocol.authority as authority, authority.reference = append('Organization/', oid) "set authority";#xD; }#xD; #xD; group ExtractPatient(source src : HC1, source pid, target patient : Patient) {#xD; pid -> patient.id = pid "Patient ID";#xD; src.nam as name -> patient then ExtractPersonName(name, patient) "Patient";#xD; src.dob as birthDate -> patient.birthDate = birthDate "set birthDate";#xD; }#xD; #xD; group ExtractPersonName(source src : PersonName, target tgt : DDCCPatient) {#xD; src -> tgt.name = create('HumanName') as humanName then ExtractHumanName(src, humanName) "Human Name";#xD; src -> tgt.name = create('HumanName') as humanNameStd then ExtractStandardizedName(src, humanNameStd) "Human Name Std";#xD; }#xD; #xD; group ExtractHumanName(source src : PersonName, target tgt : HumanName) {#xD; src.gn as givenName -> tgt.given = givenName "Given Name";#xD; src.fn as familyName -> tgt.family = familyName "Family Name";#xD; src -> tgt.use = 'official' "Use";#xD; }#xD; #xD; group ExtractStandardizedName(source src : PersonName, target tgt : HumanName) {#xD; src.gnt as givenName -> tgt.given = givenName "Given Name Std";#xD; src.fnt as familyName -> tgt.family = familyName "Family Name Std";#xD; src -> tgt.use = 'official' "Use Std";#xD; }#xD; #xD; group ExtractComposition(source src : CWT, target composition : Composition) {#xD; src -> composition.title = 'International Certificate of Vaccination or Prophylaxis' "Title";#xD; src -> composition.category as category, category.coding as coding then {#xD; src -> coding.code = 'ddcc-vs' "Category";#xD; } "set category";#xD; src -> composition.type as type, type.coding as coding then {#xD; src -> coding.system = 'http://loinc.org', coding.code = '82593-5', coding.display = 'Immunization summary report' "set type coding";#xD; } "set type";#xD; src -> composition.event as event, event.period = create('Period') as period then ExtractPeriod(src, period) "Extract Period";#xD; }#xD; #xD; group ExtractPeriod(source src : CWT, target tgt : Period) {#xD; src.nbf as nbf -> tgt.start = nbf "Start notBefore";#xD; src.iat as iat -> tgt.start = iat "Start issuedAt";#xD; src.exp as exp -> tgt.end = exp "End expiration";#xD; }#xD; #xD;
International Certificate of Vaccination or Prophylaxis