diff --git a/input/maps/IMMZCLMToPatient.fml b/input/maps/IMMZCLMToPatient.fml index bbf54dba3f..ab5c0988d8 100644 --- a/input/maps/IMMZCLMToPatient.fml +++ b/input/maps/IMMZCLMToPatient.fml @@ -14,7 +14,7 @@ group IMMZCToPatient ( immzc -> patient.name as pname then NameToHumanName( immzc, pname ) "SetName"; - immzc.sex as sex -> patient.gender = translate(sex, 'http://smart.who.int/ig/smart-immunizations-measles/ConceptMap/IMMZCSexToAdministrativeGender', 'code') "SetGender"; + // immzc.sex as sex -> patient.gender = translate(sex, 'http://smart.who.int/ig/smart-immunizations-measles/ConceptMap/IMMZCSexToAdministrativeGender', 'code') "SetGender"; immzc.birthDate as birthDate -> patient.birthDate = birthDate "SetBirthDate"; diff --git a/input/maps/IMMZCQRToLM.fml b/input/maps/IMMZCQRToLM.fml index d0ff17de77..b592e42ef8 100644 --- a/input/maps/IMMZCQRToLM.fml +++ b/input/maps/IMMZCQRToLM.fml @@ -7,12 +7,10 @@ group QRespToIMMZC ( source qr : QResp, target immzc : IMMZC) { qr.item as item then { item.answer first as answer where item.linkId = 'uniqueId' then { - answer as content -> immzc.uniqueId = content "SetIdentifier"; + answer.value as content -> immzc.uniqueId = content "SetIdentifier"; } "FirstAnswerForIdentifier"; - item where item.linkId = 'name' then NameToIMMZC( item, immzc ) "SetNames"; - - item where item.linkId = 'caregiver' -> immzc.caregiver as caregiver then NameToIMMZC( item, caregiver ) "SetNames"; + item as name where item.linkId = 'name' then NameToIMMZC( name, immzc ) "SetNames"; item.answer first as answer where item.linkId = 'sex' then { answer.value as coding then { @@ -21,25 +19,27 @@ group QRespToIMMZC ( source qr : QResp, target immzc : IMMZC) { } "FirstAnswerForIdentifier"; item.answer first as answer where item.linkId = 'birthDate' then { - answer as content -> immzc.birthDate = content "SetBirthDate2"; + answer.value as content -> immzc.birthDate = content "SetBirthDate2"; } "FirstAnswerForBirthDate"; item.answer as caregiver where item.linkId = 'caregiver' -> immzc.caregiver as caretgt then NameToIMMZC( caregiver, caretgt ) "SetCaregiver"; item.answer first as answer where item.linkId = 'phone' then { - answer as content -> immzc.phone = content "SetPhone"; + answer.value as content -> immzc.phone = content "SetPhone"; } "FirstAnswerForPhone"; + /* item.answer first as answer where item.linkId = 'administrativeArea' then { answer.value as coding -> immzc.administrativeArea as area then { coding -> area.coding = coding "SetCodingValue"; coding.display as display -> area.text = display "SetDisplay"; } "SetCoding"; } "FirstAnswerForAdministrativeArea"; - + */ + item.answer first as answer where item.linkId = 'healthWorker' then { - answer as content -> immzc.healthWorker = content "SetHealthWorker"; + answer.value as content -> immzc.healthWorker = content "SetHealthWorker"; } "FirstAnswerForHealthWorker"; } "processItems"; @@ -50,15 +50,15 @@ group NameToIMMZC( source name, target immzc) { name.item as item then { item.answer first as answer where item.linkId = 'fullName' then { - answer as content -> immzc.name = content "SetFullName"; + answer.value as content -> immzc.name = content "SetFullName"; } "FirstAnswerForFullName"; item.answer first as answer where item.linkId = 'firstName' then { - answer as content -> immzc.firstName = content "SetFirstName"; + answer.value as content -> immzc.firstName = content "SetFirstName"; } "FirstAnswerForFirstName"; item.answer first as answer where item.linkId = 'familyName' then { - answer as content -> immzc.familyName = content "SetFamilyName"; + answer.value as content -> immzc.familyName = content "SetFamilyName"; } "FirstAnswerForFamilyName"; } "processNameItems"; diff --git a/input/maps/IMMZCQRToPatient.fml b/input/maps/IMMZCQRToPatient.fml index a7ee1bdae7..18f09f43da 100644 --- a/input/maps/IMMZCQRToPatient.fml +++ b/input/maps/IMMZCQRToPatient.fml @@ -1,84 +1,22 @@ -map "http://smart.who.int/ig/smart-immunizations-measles/StructureMap/IMMZCQRToPatient" = "IMMZCQRToPatient" +map "http://smart.who.int/ig/smart-immunizations-measles/StructureMap/ee569d2c-3299-4a0d-bd5d-4f88af814ecd" = "IMMZCQRToPatient" uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source uses "http://smart.who.int/ig/smart-immunizations-measles/StructureDefinition/IMMZCRegisterClient" alias IMMZC as source -uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target +uses "http://hl7.org/fhir/StructureDefinition/Bundle" as target imports "http://smart.who.int/ig/smart-immunizations-measles/StructureMap/IMMZCQRToLM" imports "http://smart.who.int/ig/smart-immunizations-measles/StructureMap/IMMZCLMToPatient" group QRestToIMMZC ( source qr : QResp, - target patient: Patient + target bundle: Bundle ) { - qr -> create("http://smart.who.int/ig/smart-immunizations-measles/StructureDefinition/IMMZCRegisterClient") as model - then{ - qr -> model then QRespToIMMZC( qr, model) "QRtoLM"; - qr -> patient then IMMZCToPatient( model, patient ) "LMtoPatient"; - } "QRtoPatient"; -} - -/* -group QRespToIMMZC ( - source qr : QResp, - target patient : Patient -) { - qr.item as item then { - - item.answer first as answer where item.linkId = 'uniqueId' -> patient.identifier as identifier then { - answer.valueString as content -> identifier.value = content "set identifier"; - } "firstAnswerForIdentifier"; - - item as name where item.linkId = 'name' -> patient.name as pname then NameToHumanName( name, pname ) "setNames"; - - item.answer first as answer where item.linkId = 'sex' then { - answer.valueCoding as coding then { - coding.code as content -> patient.gender = translate(content, - 'http://smart.who.int/ig/smart-immunizations-measles/ConceptMap/IMMZCSexToAdministrativeGender', - 'code') "setSex"; - } "processCoding"; - } "firstAnswerForIdentifier2"; - - item.answer first as answer where item.linkId = 'birthDate' then { - answer.valueDate as content -> patient.birthDate = content "set birthDate"; - } "firstAnswerForBirthDate"; - - item as caregiver where item.linkId = 'caregiver' -> patient.contact as contact, contact.name as hname - then NameToHumanName( caregiver, hname ) "set caregiver"; - - item.answer first as answer where item.linkId = 'phone' -> patient.telecom as telecom then { - answer.valueString as content -> telecom.value = content, telecom.system = 'phone' "setPhone"; - } "firstAnswerForPhone"; - - item.answer first as answer where item.linkId = 'administrativeArea' -> patient.address as address then { - answer.valueCoding first as coding -> address then { - coding.code as content -> address.text = content "setAddressToCode"; - coding.display as content -> address.text = content "setAddressToDisplay"; - } "setAddressText"; - } "firstAnswerForAdministrativeArea"; - - } "processItems"; - -} - -group NameToHumanName( - source name, - target hname -) { - name.item as item then { - - item.answer first as answer where item.linkId = 'fullName' then { - answer.valueString as content -> hname.text = content "SeFfullName"; - } "firstAnswerForFullName"; - - item.answer first as answer where item.linkId = 'firstName' then { - answer.valueString as content -> hname.given = content "SetFirstName"; - } "firstAnswerForFirstName"; - - item.answer first as answer where item.linkId = 'familyName' then { - answer.valueString as content -> hname.family = content "SetFamilyName"; - } "firstAnswerForFamilyName"; - - } "processNameItems"; -} -*/ \ No newline at end of file + qr -> bundle.id = uuid() "rule_bundle_id"; + qr -> bundle.type = 'collection' "rule_bundle_type"; + qr -> bundle.entry as entry, entry.resource = create('Patient') as patient, + create("http://smart.who.int/ig/smart-immunizations-measles/StructureDefinition/IMMZCRegisterClient") as model + then{ + qr -> model then QRespToIMMZC( qr, model) "QRtoLM"; + qr -> patient then IMMZCToPatient( model, patient ) "LMtoPatient"; + } "QRtoPatient"; +} \ No newline at end of file