Skip to content

Commit

Permalink
Added in structuremaps for D1 Client History.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeaduncan committed Oct 18, 2023
1 parent 72c0e71 commit e37cd65
Show file tree
Hide file tree
Showing 11 changed files with 352 additions and 21 deletions.
16 changes: 2 additions & 14 deletions input/fsh/examples/IMMZ.C.QuestionnaireResponse.1.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,11 @@ Usage: #example
* item[+]
* linkId = "sex"
* text = "Sex"
* answer.valueCoding = IMMZ.C#DE6 "Male"
* answer.valueCoding = IMMZ.C#DE7 "Female"
* item[+]
* linkId = "birthDate"
* text = "Birth Date"
* answer.valueDate = "1993-08-12"
* item[+]
* linkId = "ageInWeeks"
* text = "Age in Weeks"
* answer.valueInteger = 1565
* item[+]
* linkId = "ageInMonths"
* text = "Age in Months"
* answer.valueInteger = 359
* item[+]
* linkId = "ageInYears"
* text = "Age in Years"
* answer.valueInteger = 29
* answer.valueDate = "2023-03-02"
* item[+]
* linkId = "caregiver"
* text = "Care giver name"
Expand Down
26 changes: 26 additions & 0 deletions input/fsh/examples/IMMZ.D1.QuestionnaireResponse.1.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Instance: Example.IMMZ.D1.QuestionnaireResponse.1
InstanceOf: QuestionnaireResponse
Usage: #example
* status = #completed
* authored = "2023-10-18T19:20:20.913Z"
* questionnaire = Canonical(QIMMZD1ClientHistoryMeasles)
* subject = Reference(patient123456)

* item[+]
* linkId = "dose0"
* answer.valueBoolean = false
* item[+]
* linkId = "completedPrimarySeries"
* answer.valueBoolean = false
* item[+]
* linkId = "hivStatus"
* answer.valueCoding = IMMZ.D1#DE12
* item[+]
* linkId = "pretermBirth"
* answer.valueBoolean = false
* item[+]
* linkId = "severelyImmunosuppressed"
* answer.valueBoolean = false



33 changes: 33 additions & 0 deletions input/fsh/examples/IMMZ.D1.QuestionnaireResponse.2.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Instance: Example.IMMZ.D1.QuestionnaireResponse.2
InstanceOf: QuestionnaireResponse
Usage: #example
* status = #completed
* authored = "2023-10-18T19:20:20.913Z"
* questionnaire = Canonical(QIMMZD1ClientHistoryMeasles)
* subject = Reference(patient654321)

* item[+]
* linkId = "dose0"
* answer.valueBoolean = false
* item[+]
* linkId = "completedPrimarySeries"
* answer.valueBoolean = false
* item[+]
* linkId = "hivStatus"
* answer.valueCoding = IMMZ.D1#DE12
* item[+]
* linkId = "pretermBirth"
* answer.valueBoolean = false
* item[+]
* linkId = "severelyImmunosuppressed"
* answer.valueBoolean = false
* item[+]
* linkId = "vaccineHistory"
* item[+]
* linkId = "vaccineType"
* answer.valueCoding = $ICD11#XM4AJ8
* item[+]
* linkId = "vaccineDate"
* answer.valueDate = "2023-04-05"


47 changes: 47 additions & 0 deletions input/fsh/examples/IMMZ.D1.QuestionnaireResponse.3.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Instance: Example.IMMZ.D1.QuestionnaireResponse.3
InstanceOf: QuestionnaireResponse
Usage: #example
* status = #completed
* authored = "2023-10-18T19:20:20.913Z"
* questionnaire = Canonical(QIMMZD1ClientHistoryMeasles)
* subject = Reference(patient654321)

* item[+]
* linkId = "dose0"
* answer.valueBoolean = false
* item[+]
* linkId = "completedPrimarySeries"
* answer.valueBoolean = true
* item[+]
* linkId = "dateSeriesCompleted"
* answer.valueDate = "2023-01-01"
* item[+]
* linkId = "hivStatus"
* answer.valueCoding = IMMZ.D1#DE11
* item[+]
* linkId = "pretermBirth"
* answer.valueBoolean = false
* item[+]
* linkId = "severelyImmunosuppressed"
* answer.valueBoolean = true
* item[+]
* linkId = "artStartDate"
* answer.valueDate = "2022-06-01"
* item[+]
* linkId = "vaccineHistory"
* item[+]
* linkId = "vaccineType"
* answer.valueCoding = $ICD11#XM4AJ8
* item[+]
* linkId = "vaccineDate"
* answer.valueDate = "2023-04-05"
* item[+]
* linkId = "vaccineHistory"
* item[+]
* linkId = "vaccineType"
* answer.valueCoding = $ICD11#XM4AJ8
* item[+]
* linkId = "vaccineDate"
* answer.valueDate = "2023-10-05"


Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Usage: #example
* text = "Test Patient"
* family = "Patient"
* given = "Test"
* gender = #male
* birthDate = "1993-08-12"
* gender = #female
* birthDate = "2023-03-02"
12 changes: 12 additions & 0 deletions input/fsh/examples/P654321.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Instance: patient654321
InstanceOf: Patient
Usage: #example

* id = "P654321"
* identifier.value = "654321"
* name[+]
* text = "Test Patient"
* family = "Patient"
* given = "Test"
* gender = #female
* birthDate = "2022-04-01"
1 change: 1 addition & 0 deletions input/fsh/models/IMMZD1ClientHistoryMeasles.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Description: "Data elements for the IMMZ.D1 Capture Client History Data Diction

* ^name = "IMMZ_D1_Client_History_Measles"

* patient 1..1 Reference "Patient" "The patient who is being checked for contraindications."
* dose0 0..1 boolean "Dose 0 administered" "Indicates if the client has received a birth dose and/or supplementary dose"
* ^code[+] = IMMZ.D1#DE80
* completedPrimarySeries 0..1 boolean "Completed the primary vaccination series" "Indicates if the client has completed the primary vaccination series of a product/antigen. If the client has not yet completed their primary series, it means they may be expected to receive more doses to complete their vaccination regimen for the respective product/antigen."
Expand Down
104 changes: 104 additions & 0 deletions input/maps/IMMZ-D1-LMToResources.fml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
map "http://smart.who.int/ig/smart-immunizations/StructureMap/IMMZD1LMToResources" = "IMMZD1LMToResources"

uses "http://smart.who.int/ig/smart-immunizations/StructureDefinition/IMMZD1ClientHistoryMeasles" alias IMMZD1 as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target

group IMMZD1ToBundle (source immz : IMMZD1, target bundle: Bundle) {
immz -> bundle.type = 'collection' "SetCollection";

immz.patient as patient then {


immz.dose0 as content -> bundle.entry as entry, entry.resource = create('Observation') as obs then {
patient -> obs.subject = patient "SetPatient";
content -> obs.code as code then {
content -> code.coding as coding then {
content -> coding.system = 'http://smart.who.int/ig/smart-immunizations/CodeSystem/IMMZ.D1' "SetObsSystem";
content -> coding.code = 'DE80' "SetObsCode";
} "SetObsCoding";
} "SetObsCode";
content -> obs.value = content "SetValue";
} "SetDose0Observation";

immz.completedPrimarySeries as content -> bundle.entry as entry, entry.resource = create('Observation') as obs then {
patient -> obs.subject = patient "SetPatient";
content -> obs.code as code then {
content -> code.coding as coding then {
content -> coding.system = 'http://smart.who.int/ig/smart-immunizations/CodeSystem/IMMZ.D1' "SetObsSystem";
content -> coding.code = 'DE8' "SetObsCode";
} "SetObsCoding";
} "SetObsCode";
content -> obs.value = content "SetValue";
} "SetPrimarySeriesObservation";

immz.dateSeriesCompleted as content -> bundle.entry as entry, entry.resource = create('Observation') as obs then {
patient -> obs.subject = patient "SetPatient";
content -> obs.code as code then {
content -> code.coding as coding then {
content -> coding.system = 'http://smart.who.int/ig/smart-immunizations/CodeSystem/IMMZ.D1' "SetObsSystem";
content -> coding.code = 'DE81' "SetObsCode";
} "SetObsCoding";
} "SetObsCode";
content -> obs.value = content "SetValue";
} "SetDateSeriesObservation";

immz.hivStatus as content -> bundle.entry as entry, entry.resource = create('Observation') as obs then {
patient -> obs.subject = patient "SetPatient";
content -> obs.code as code then {
content -> code.coding as coding then {
content -> coding.system = 'http://smart.who.int/ig/smart-immunizations/CodeSystem/IMMZ.D1' "SetObsSystem";
content -> coding.code = 'DE10' "SetObsCode";
} "SetObsCoding";
} "SetObsCode";
content -> obs.valueCodeableConcept as code then {
content -> code.coding = content "SetCoding";
} "SetCodeableConcept";
} "SetHIVStatusObservation";

immz.pretermBirth as content -> bundle.entry as entry, entry.resource = create('Observation') as obs then {
patient -> obs.subject = patient "SetPatient";
content -> obs.code as code then {
content -> code.coding as coding then {
content -> coding.system = 'http://smart.who.int/ig/smart-immunizations/CodeSystem/IMMZ.D1' "SetObsSystem";
content -> coding.code = 'DE15' "SetObsCode";
} "SetObsCoding";
} "SetObsCode";
content -> obs.value = content "SetValue";
} "SetPretermBirthObservation";

immz.severelyImmunosuppressed as content -> bundle.entry as entry, entry.resource = create('Observation') as obs then {
patient -> obs.subject = patient "SetPatient";
content -> obs.code as code then {
content -> code.coding as coding then {
content -> coding.system = 'http://smart.who.int/ig/smart-immunizations/CodeSystem/IMMZ.D1' "SetObsSystem";
content -> coding.code = 'DE92' "SetObsCode";
} "SetObsCoding";
} "SetObsCode";
content -> obs.value = content "SetValue";
} "SetSeverelyImmunosuppressedObservation";

immz.artStartDate as content -> bundle.entry as entry, entry.resource = create('Observation') as obs then {
patient -> obs.subject = patient "SetPatient";
content -> obs.code as code then {
content -> code.coding as coding then {
content -> coding.system = 'http://smart.who.int/ig/smart-immunizations/CodeSystem/IMMZ.D1' "SetObsSystem";
content -> coding.code = 'DE49' "SetObsCode";
} "SetObsCoding";
} "SetObsCode";
content -> obs.value = content "SetValue";
} "SetARTDateObservation";

immz.vaccineHistory as history -> bundle.entry as entry, entry.resource = create('Immunization') as imm then {
patient -> imm.patient = patient "SetPatient";
history -> imm.status = 'completed' "SetStatus";

history.vaccineType as vaccine -> imm.vaccineCode as code then {
vaccine -> code.coding = vaccine "SetVaccineCoding";
} "SetVaccineType";
history.vaccineDate as date -> imm.occurrence = cast(date, 'dateTime') "SetDate";

} "SetVaccineHistoryObservation";

} "GetPatient";

}
57 changes: 57 additions & 0 deletions input/maps/IMMZ-D1-QRToLM.fml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
map "http://smart.who.int/ig/smart-immunizations/StructureMap/IMMZD1QRToLM" = "IMMZD1QRToLM"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
uses "http://smart.who.int/ig/smart-immunizations/StructureDefinition/IMMZD1ClientHistoryMeasles" alias IMMZD1 as target

group QRespToIMMZD1 ( source qr : QResp, target immz : IMMZD1) {

qr.subject as patient -> immz.patient = patient "SetPatient";

qr.item as item then {

item.answer first as answer where item.linkId = 'dose0' then {
answer.value as content -> immz.dose0 = content "SetDose0";
} "FirstAnswerForDose0";

item.answer first as answer where item.linkId = 'completedPrimarySeries' then {
answer.value as content -> immz.completedPrimarySeries = content "SetCompletedPrimarySeries";
} "FirstAnswerForCompletedPrimarySeries";

item.answer first as answer where item.linkId = 'dateSeriesCompleted' then {
answer.value as content -> immz.dateSeriesCompleted = content "SetDateSeriesCompleted";
} "FirstAnswerDateSeriesCompleted";

item.answer first as answer where item.linkId = 'hivStatus' then {
answer.value as coding -> immz.hivStatus = coding "SetHIVStatus";
} "FirstAnswerForHIVStatus";

item.answer first as answer where item.linkId = 'pretermBirth' then {
answer.value as content -> immz.pretermBirth = content "SetPretermBirth";
} "FirstAnswerForPretermBirth";

item.answer first as answer where item.linkId = 'severelyImmunosuppressed' then {
answer.value as content -> immz.severelyImmunosuppressed = content "SetSeverelyImmunosuppressed";
} "FirstAnswerForSeverelyImmunosuppressed";


item.answer first as answer where item.linkId = 'artStartDate' then {
answer.value as content -> immz.artStartDate = content "SetARTStartDated";
} "FirstAnswerARTStartDate";

item as history where item.linkId = 'vaccineHistory' -> immz.vaccineHistory as vaccine then {
history.item as entry then {
entry.answer as answer where entry.linkId = 'vaccineType' then {
answer.value as coding -> vaccine.vaccineType = coding "SetVaccineType";
} "AnswerForVaccineType";

entry.answer as answer where entry.linkId = 'vaccineDate' then {
answer.value as content -> vaccine.vaccineDate = content "SetVaccineDate";
} "AnswerForVaccineDate";

} "HistoryLoop";

} "ForVaccineHistory";

} "processItems";

}
19 changes: 19 additions & 0 deletions input/maps/IMMZ-D1-QRToResources.fml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
map "http://smart.who.int/ig/smart-immunizations/StructureMap/IMMZD1QRToResources" = "IMMZD1QRToResources"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
uses "http://smart.who.int/ig/smart-immunizations/StructureDefinition/IMMZD1ClientHistoryMeasles" alias IMMZD1 as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target

imports "http://smart.who.int/ig/smart-immunizations/StructureMap/IMMZD1QRToLM"
imports "http://smart.who.int/ig/smart-immunizations/StructureMap/IMMZD1LMToResources"

group QRespToBundle (
source qr : QResp,
target bundle: Bundle
) {
qr -> create("http://smart.who.int/ig/smart-immunizations/StructureDefinition/IMMZD1ClientHistoryMeasles") as model
then{
qr -> model then QRespToIMMZD1( qr, model) "QRtoLM";
qr -> bundle then IMMZD1ToBundle( model, bundle ) "LMtoBundle";
} "QRtoBundle";
}
Loading

0 comments on commit e37cd65

Please sign in to comment.