Generated Narrative: StructureMap ICAOtoDDCC #xD; map "http://smart.who.int/ddcc/StructureMap/CertICAOtoDDCC" = "ICAOtoDDCC"#xD; #xD; uses "http://smart.who.int/ddcc/StructureDefinition/CertICAO" alias IJson as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/Data" alias Data as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/Header" alias Header as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/Message" alias Message as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/Patient" alias Patient as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/VaccinationEvent" alias VaccinationEvent as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/VaccinationDetails" alias VaccinationDetails as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/ServiceProvider" alias ServiceProvider as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/Contact" alias Contact as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/DateTimeTestReport" alias DateTimeTestReport as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/TestResult" alias TestResult as source#xD; uses "http://hl7.org/fhir/ig/icao/StructureDefinition/Signature" alias Signature as source#xD; uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target#xD; #xD; group ICAOtoDDCC(source src : IJson, target bundle : Bundle) {#xD; src.data as data -> bundle then ExtractData(data, bundle) "Base Rule";#xD; }#xD; #xD; group ExtractData(source src : Data, 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 -> bundle then ExtractCert(src, bundle, comp) "Certificate";#xD; src -> bundle then ExtractComposition(src, comp) "Composition";#xD; } "Patient and Composition Create";#xD; }#xD; #xD; group ExtractCert(source src : Data, 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.msg as msg -> patient then ExtractPatientFromMsg(msg, pid, patient) "extract patient";#xD; src -> comp.subject as subj, subj.reference = append('Patient/', pid) "Set patient";#xD; src.msg as msg where src.hdr.t = 'icao.vacc' -> comp, 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; msg.ve as vac -> comp then {#xD; vac.vd as vacDetails -> 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 author immunization 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; vacDetails.adm as adm -> org.name = adm "Set Organization name";#xD; src -> bundle then ExtractVaccine(vac, vacDetails, oid, immunization) "extract vaccine info";#xD; } "Imminization Create vac";#xD; } "Imminization Create msg";#xD; } "Immunization Create";#xD; } "Patient Create";#xD; }#xD; #xD; group ExtractVaccine(source vac : VaccinationEvent, source vacDetails : VaccinationDetails, source oid, target immunization : Immunization) {#xD; vacDetails.dvc as dvc -> immunization.occurrence = dvc "set occurrence date";#xD; vac.des as des -> immunization.vaccineCode as type, type.coding as coding, coding.system = 'http://hl7.org/fhir/sid/icd-11', coding.code = des "set vaccine coding";#xD; vac.nam as nam -> immunization.extension as ext, ext.value = create('Coding') as coding, ext.url = 'https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineBrand', coding.code = nam "set brand";#xD; vacDetails.ctr 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; vacDetails.lot as lot -> immunization.lotNumber = lot "set lot number";#xD; vac -> immunization.protocolApplied as protocolApplied then {#xD; vacDetails -> protocolApplied then {#xD; vac -> protocolApplied then ExtractProtocolApplied(vac, vacDetails, oid, protocolApplied) "set protocol applied";#xD; } "set protocol applied vacdetails";#xD; } "set protocol applied vac";#xD; }#xD; #xD; group ExtractProtocolApplied(source vac : VaccinationEvent, source vacDetails : VaccinationDetails, source oid, target protocol : ProtocolApplied) {#xD; vacDetails.seq as seq -> protocol.doseNumber = seq "set dose number";#xD; vac.dis as dis -> protocol.targetDisease as codeable, codeable.coding as coding, coding.system = 'http://hl7.org/fhir/sid/icd-11', coding.code = dis "set target disease type";#xD; oid -> protocol.authority as authority, authority.reference = append('Organization/', oid) "set authority";#xD; }#xD; #xD; group ExtractPatientFromMsg(source src : Message, source pid, target patient : Patient) {#xD; src.pid as patData -> patient then ExtractPatient(patData, pid, patient) "extract patient from msg";#xD; }#xD; #xD; group ExtractPatient(source src : Patient, source pid, target patient : Patient) {#xD; pid -> patient.id = pid "Patient ID";#xD; src.i as priorityIdentifier -> patient.identifier as identif, identif.value = priorityIdentifier "set priorityIdentifier";#xD; src.ai as additionalIdentifier -> patient.identifier as identif, identif.value = additionalIdentifier "set additionalIdentifier";#xD; src -> patient.identifier as identif then ExtractDocumentTypeNumber(src, identif) "Document Type Number";#xD; src.n as name -> patient.name = create('HumanName') as humanName, humanName.text = name "Patient Name";#xD; src.sex as gender -> patient then ExtractGender(gender, patient) "Patient Gender";#xD; src.dob as birthDate -> patient.birthDate = birthDate "set birthDate";#xD; }#xD; #xD; group ExtractGender(source gender, target patient : Patient) {#xD; gender where (gender = 'M') -> patient.gender = 'male' "set male";#xD; gender where (gender = 'F') -> patient.gender = 'female' "set female";#xD; }#xD; #xD; group ExtractDocumentTypeNumber(source src : Patient, 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 ExtractComposition(source src : Data, target composition : Composition) {#xD; src.msg as msg -> composition then {#xD; msg.ucti as ucti -> composition.identifier as identif, identif.value = ucti "set comp test identifier";#xD; } "set comp vaccine identifier parent";#xD; src.msg as msg -> composition then {#xD; msg.uvci as uvci -> composition.identifier as identif, identif.value = uvci "set comp vaccine identifier";#xD; } "set comp vaccine identifier parent";#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; }#xD; #xD;
AC - Crew Member Certificate (Doc 9303-5)
International Certificate of Vaccination or Prophylaxis