Skip to content

Commit

Permalink
updated patient-register structure-maps
Browse files Browse the repository at this point in the history
  • Loading branch information
owais-vd committed Oct 19, 2023
1 parent af86ed0 commit 7e7a147
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 86 deletions.
2 changes: 1 addition & 1 deletion input/maps/IMMZCLMToPatient.fml
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
22 changes: 11 additions & 11 deletions input/maps/IMMZCQRToLM.fml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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";
Expand All @@ -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";
Expand Down
86 changes: 12 additions & 74 deletions input/maps/IMMZCQRToPatient.fml
Original file line number Diff line number Diff line change
@@ -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";
}
*/
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";
}

0 comments on commit 7e7a147

Please sign in to comment.