Skip to content

Commit 6163d5d

Browse files
committed
Added in structuremap for D1 and D13. Refactored to reuse duplicated FML code. Added some representative examples for D13.
1 parent c4d2197 commit 6163d5d

17 files changed

+636
-257
lines changed

input/fsh/examples/IMMZ.C.Patient.1.fsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Usage: #example
99
* given[+] = "Thabo"
1010
* given[+] = "Mbulelo"
1111
* gender = #male
12-
* birthDate = "1942-06-18"
12+
* birthDate = "2020-06-18"
1313
* address.text = "123 Main Street, Cape Town, Western Cape, 8001, ZA"
1414
* telecom[immzPhone]
1515
* system = #phone
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Instance: IMMZ.C.Patient.2
2+
InstanceOf: IMMZPatient
3+
Usage: #example
4+
5+
* identifier.value = "12345-ZA"
6+
* name[immzName]
7+
* text = "Zanele Mbeki"
8+
* family = "Mbeki"
9+
* given[+] = "Zanele"
10+
* gender = #male
11+
* birthDate = "1998-09-22"
12+
* address.text = "123 Main Street, Cape Town, Western Cape, 8001, ZA"
13+
* telecom[immzPhone]
14+
* system = #phone
15+
* value = "+27 21 465 8000"

input/fsh/examples/IMMZ.D1.QuestionnaireResponse.BCG.fsh

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ Usage: #example
77
* subject = Reference(IMMZ.C.Patient.1)
88

99
* insert QRItem( Coding, typeOfDose, IMMZ.D#DE259 "Primary series" )
10-
* insert QRItem( Boolean, completedThePrimaryVaccinationSeries, false )
10+
* insert QRItem( Boolean, completedThePrimaryVaccinationSeries, true )
1111
* insert QRItem( Boolean, completedTheBoosterSeries, false )
12+
* insert QRItem( Date, dateWhenPrimaryVaccinationSeriesWasCompleted, "2020-07-01" )
1213
* insert QRItem( Coding, hivStatus, IMMZ.D#DE206 "HIV-negative" )
1314
* insert QRItem( Boolean, pretermBirth, false )
1415
* insert QRItem( Boolean, immunocompromised, false )

input/fsh/examples/IMMZ.D1.QuestionnaireResponse.DTP.fsh

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ Usage: #example
44
* status = #completed
55
* authored = "2025-01-13T19:20:20.913Z"
66
* questionnaire = Canonical(QIMMZD1)
7-
* subject = Reference(IMMZ.C.Patient.1)
7+
* subject = Reference(IMMZ.C.Patient.2)
88

99
* insert QRItem( Coding, typeOfDose, IMMZ.D#DE259 "Primary series" )
10-
* insert QRItem( Boolean, completedThePrimaryVaccinationSeries, false )
11-
* insert QRItem( Boolean, completedTheBoosterSeries, false )
10+
* insert QRItem( Boolean, completedThePrimaryVaccinationSeries, true )
11+
* insert QRItem( Boolean, completedTheBoosterSeries, true )
1212
* insert QRItem( Coding, hivStatus, IMMZ.D#DE206 "HIV-negative" )
1313
* insert QRItem( Boolean, pretermBirth, false )
1414
* insert QRItem( Boolean, immunocompromised, false )
1515
* insert QRItem( Coding, vaccineType, IMMZ.Z#DE24 "DTP-containing vaccines" )
1616
* insert QRItem( DateTime, dateAndTimeOfVaccination, "2020-08-05")
1717
* insert QRItem( Date, contactDate, "2020-08-05" )
18+
* insert QRItem( Integer, ancContactNumber, 5 )
1819
* insert QRItem( Integer, doseNumber, 1 )
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Instance: Example.IMMZ.D13.QuestionnaireResponse.BCG
2+
InstanceOf: QuestionnaireResponse
3+
Usage: #example
4+
* status = #completed
5+
* authored = "2025-01-30T19:20:20.913Z"
6+
* questionnaire = Canonical(QIMMZD13)
7+
* subject = Reference(IMMZ.C.Patient.1)
8+
9+
* insert QRItem( Coding, typeOfDose, IMMZ.D#DE259 "Primary series" )
10+
* insert QRItem( Boolean, completedThePrimaryVaccinationSeries, true )
11+
* insert QRItem( Boolean, completedTheBoosterSeries, false )
12+
* insert QRItem( Date, dateWhenPrimaryVaccinationSeriesWasCompleted, "2020-07-01" )
13+
* insert QRItem( Coding, hivStatus, IMMZ.D#DE206 "HIV-negative" )
14+
* insert QRItem( Coding, vaccineType, IMMZ.Z#DE1 "BCG vaccines" )
15+
* insert QRItem( DateTime, dateAndTimeOfVaccination, "2020-07-01")
16+
* insert QRItem( Date, contactDate, "2020-07-01" )
17+
* insert QRItem( Integer, doseNumber, 1 )
18+
* insert QRItem( Coding, immunizationEventStatus, IMMZ.D#DE2 "Completed" )
19+
* insert QRItem( Coding, vaccineBrand, IMMZ.Ex#brand "Example Brand" )
20+
* insert QRItem( Boolean, liveVaccine, true )
21+
* insert QRItem( Coding, countryOfVaccination, urn:iso:std:iso:3166#ZAF "South Africa" )
22+
* insert QRItem( Coding, administrativeArea, urn:iso:std:iso:3166-2#ZA-WC "Western Cape" )
23+
* insert QRItem( Coding, vaccineManufacturer, IMMZ.Ex#manufacturer "Example Manufacturer" )
24+
* insert QRItem( String, vaccineBatchNumber, "148734" )
25+
* insert QRItem( Coding, vaccineMarketAuthorizationHolder, IMMZ.Ex#marketauth "Example Market Authorization Holder" )
26+
* insert QRItem( Date, expirationDate, "2022-01-01" )
27+
* insert QRItem( Quantity, doseQuantity, 0.05 'mL')
28+
* insert QRItem( String, healthWorkerIdentifier, "8723487" )
29+
* insert QRItem( Decimal, totalDosesInSeries, 1 )
30+
* insert QRItem( Coding, diseaseTargeted, IMMZ.D#DE139 "Tuberculosis" )
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Instance: Example.IMMZ.D13.QuestionnaireResponse.Measles.2
2+
InstanceOf: QuestionnaireResponse
3+
Usage: #example
4+
* status = #completed
5+
* authored = "2025-01-30T19:20:20.913Z"
6+
* questionnaire = Canonical(QIMMZD13)
7+
* subject = Reference(IMMZ.C.Patient.1)
8+
9+
* insert QRItem( Coding, typeOfDose, IMMZ.D#DE259 "Primary series" )
10+
* insert QRItem( Boolean, completedThePrimaryVaccinationSeries, false )
11+
* insert QRItem( Boolean, completedTheBoosterSeries, false )
12+
* insert QRItem( Coding, hivStatus, IMMZ.D#DE205 "HIV-positive" )
13+
* insert QRItem( Coding, vaccineType, IMMZ.Z#DE9 "Measles-containing vaccines" )
14+
* insert QRItem( DateTime, dateAndTimeOfVaccination, "2021-03-01")
15+
* insert QRItem( Date, contactDate, "2021-03-01" )
16+
* insert QRItem( Integer, doseNumber, 1 )
17+
* insert QRItem( Coding, immunizationEventStatus, IMMZ.D#DE4 "Not done" )
18+
* insert QRItem( Coding, reasonVaccineWasNotAdministered, IMMZ.D#DE17 "Immunization not carried out for other reasons" )
19+
* insert QRItem( Coding, vaccineBrand, IMMZ.Ex#brand "Example Brand" )
20+
* insert QRItem( Coding, countryOfVaccination, urn:iso:std:iso:3166#ZAF "South Africa" )
21+
* insert QRItem( Coding, vaccineManufacturer, IMMZ.Ex#manufacturer "Example Manufacturer" )
22+
* insert QRItem( Coding, vaccineMarketAuthorizationHolder, IMMZ.Ex#marketauth "Example Market Authorization Holder" )
23+
* insert QRItem( String, healthWorkerIdentifier, "8723487" )
24+
* insert QRItem( Decimal, totalDosesInSeries, 2 )
25+
* insert QRItem( Coding, diseaseTargeted, IMMZ.D#DE129 "Measles" )
26+
* insert QRItem( Date, dueDateOfNextDose, "2021-04-01" )
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Instance: Example.IMMZ.D13.QuestionnaireResponse.Measles
2+
InstanceOf: QuestionnaireResponse
3+
Usage: #example
4+
* status = #completed
5+
* authored = "2025-01-30T19:20:20.913Z"
6+
* questionnaire = Canonical(QIMMZD13)
7+
* subject = Reference(IMMZ.C.Patient.1)
8+
9+
* insert QRItem( Coding, typeOfDose, IMMZ.D#DE259 "Primary series" )
10+
* insert QRItem( Boolean, completedThePrimaryVaccinationSeries, false )
11+
* insert QRItem( Boolean, completedTheBoosterSeries, false )
12+
* insert QRItem( Coding, hivStatus, IMMZ.D#DE205 "HIV-positive" )
13+
* insert QRItem( Coding, vaccineType, IMMZ.Z#DE9 "Measles-containing vaccines" )
14+
* insert QRItem( DateTime, dateAndTimeOfVaccination, "2021-04-01")
15+
* insert QRItem( Date, contactDate, "2021-04-01" )
16+
* insert QRItem( Integer, doseNumber, 1 )
17+
* insert QRItem( Coding, immunizationEventStatus, IMMZ.D#DE2 "Completed" )
18+
* insert QRItem( Coding, vaccineBrand, IMMZ.Ex#brand "Example Brand" )
19+
* insert QRItem( Boolean, liveVaccine, true )
20+
* insert QRItem( Coding, countryOfVaccination, urn:iso:std:iso:3166#ZAF "South Africa" )
21+
* insert QRItem( Coding, administrativeArea, urn:iso:std:iso:3166-2#ZA-WC "Western Cape" )
22+
* insert QRItem( Coding, vaccineManufacturer, IMMZ.Ex#manufacturer "Example Manufacturer" )
23+
* insert QRItem( String, vaccineBatchNumber, "454981" )
24+
* insert QRItem( Coding, vaccineMarketAuthorizationHolder, IMMZ.Ex#marketauth "Example Market Authorization Holder" )
25+
* insert QRItem( Date, expirationDate, "2024-01-01" )
26+
* insert QRItem( Quantity, doseQuantity, 0.5 'mL')
27+
* insert QRItem( String, healthWorkerIdentifier, "8723487" )
28+
* insert QRItem( Decimal, totalDosesInSeries, 2 )
29+
* insert QRItem( Coding, diseaseTargeted, IMMZ.D#DE129 "Measles" )
30+
* insert QRItem( Date, dueDateOfNextDose, "2021-10-01" )

input/fsh/models/IMMZD13.fsh

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Description: "Data elements for the IMMZ.D13.Update client record Data Dictiona
109109
* obeys IMMZ-D-statusNotDone-1
110110
* ^code[+] = IMMZ.D#DE5
111111
* ^code[+] = $ICD11#QC04 "Immunization not carried out"
112-
* vaccineBrand 1..1 code "Vaccine brand" "The brand or trade name used to refer to the vaccine received"
112+
* vaccineBrand 1..1 Coding "Vaccine brand" "The brand or trade name used to refer to the vaccine received"
113113
* vaccineBrand from IMMZ.D.DE18 (example)
114114
* ^code[+] = IMMZ.D#DE18
115115
* liveVaccine 0..1 boolean "Live vaccine" "Uses a living but weakened version of the virus or one that is very similar"
@@ -139,7 +139,7 @@ Description: "Data elements for the IMMZ.D13.Update client record Data Dictiona
139139
* ^code[+] = $LNC#82745-1 "Doses of vaccine given per symptom onset"
140140
* healthWorkerIdentifier 0..1 string "Health worker identifier" "The person, organization or role of the entity that performed the act of giving the vaccine to the client. The implementing system can choose to populate this field using data from a health worker registry or health-care facility registry"
141141
* ^code[+] = IMMZ.D#DE35
142-
* totalDosesInSeries 0..1 decimal "Total doses in series" "The recommended number of doses for immunity according to the national immunization schedule (which may be based on product, age, etc.)"
142+
* totalDosesInSeries 0..1 integer "Total doses in series" "The recommended number of doses for immunity according to the national immunization schedule (which may be based on product, age, etc.)"
143143
* obeys IMMZ-D-reqGTZero-1
144144
* ^code[+] = IMMZ.D#DE125
145145
* diseaseTargeted 0..* Coding "Disease targeted" "Vaccine-preventable disease being targeted"

input/maps/IMMZ.C4.QRToLM.fml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ map "http://smart.who.int/immunizations/StructureMap/IMMZ.C4.QRToLM" = "IMMZ.C4.
44
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
55
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZC4" alias immz as target
66

7-
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.QRToLM"
7+
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.Helpers"
88

99

1010
group QRespToIMMZC ( source qr : QResp, target immz : IMMZC) {

input/maps/IMMZ.D1.LMToBundle.fml

+7-116
Original file line numberDiff line numberDiff line change
@@ -6,131 +6,22 @@ uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
66
// uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as produced
77
// uses "http://hl7.org/fhir/StructureDefinition/RelatedPerson" alias RelatedPerson as produced
88

9-
group IMMZD1ToBundle (source immz : IMMZD1, target bundle: Bundle) {
10-
11-
immz -> bundle.type = "transaction" "SetBundleType";
12-
13-
immz.patient as patient then {
14-
15-
immz.vaccineType as vaccineCode -> uuid() as iid,
16-
bundle.entry as entry,
17-
entry.fullUrl = append("urn:uuid:", iid),
18-
entry.request as request,
19-
request.method = "PUT",
20-
request.url = append("Immunization/", iid),
21-
entry.resource = create("Immunization") as imm then {
22-
23-
vaccineCode -> imm.vaccineCode = vaccineCode "SetVaccineCode";
24-
immz.typeOfDose as typeOfDose -> imm.protocolApplied as pa then {
25-
typeOfDose.code as code -> pa.series = code "SetSeriesToCode"; // if display is missing
26-
typeOfDose.display as display -> pa.series = display "SetSeriesToDisplay";
27-
immz.doseNumber as doseNumber -> pa.doseNumber = doseNumber "SetDoseNumber";
28-
} "protocolApplied";
29-
30-
} "MakeImmunization";
31-
32-
immz.birthDose as content -> uuid() as oid,
33-
bundle.entry as entry,
34-
entry.fullUrl = append("urn:uuid:", oid),
35-
entry.request as request,
36-
request.method = "PUT",
37-
request.url = append("Observation/", oid),
38-
entry.resource = create("Observation") as obs,
39-
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE263', 'Birth dose') as code
40-
then MakeObservation( patient, code, content, obs ) "birthDose";
9+
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.Helpers"
4110

42-
immz.completedThePrimaryVaccinationSeries as content -> uuid() as oid,
43-
bundle.entry as entry,
44-
entry.fullUrl = append("urn:uuid:", oid),
45-
entry.request as request,
46-
request.method = "PUT",
47-
request.url = append("Observation/", oid),
48-
entry.resource = create("Observation") as obs,
49-
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE203', 'Completed the primary vaccination series') as code
50-
then MakeObservation( patient, code, content, obs ) "completedThePrimaryVaccinationSeries";
51-
52-
immz.completedTheBoosterSeries as content -> uuid() as oid,
53-
bundle.entry as entry,
54-
entry.fullUrl = append("urn:uuid:", oid),
55-
entry.request as request,
56-
request.method = "PUT",
57-
request.url = append("Observation/", oid),
58-
entry.resource = create("Observation") as obs,
59-
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE257', 'Completed the booster series') as code
60-
then MakeObservation( patient, code, content, obs ) "completedTheBoosterSeries";
61-
62-
immz.dateWhenPrimaryVaccinationSeriesWasCompleted as content -> uuid() as oid,
63-
bundle.entry as entry,
64-
entry.fullUrl = append("urn:uuid:", oid),
65-
entry.request as request,
66-
request.method = "PUT",
67-
request.url = append("Observation/", oid),
68-
entry.resource = create("Observation") as obs,
69-
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE242', 'Date when primary vaccination series was completed') as code
70-
then MakeObservation( patient, code, content, obs ) "dateWhenPrimaryVaccinationSeriesWasCompleted";
71-
72-
} "GetPatient";
7311

12+
group IMMZD1ToBundle (source immz : IMMZD1, target bundle: Bundle) {
7413

75-
/*
7614
immz -> bundle.type = "transaction" "SetBundleType";
7715

78-
immz -> uuid() as pid,
79-
bundle.entry as entry,
80-
entry.fullUrl = append("urn:uuid:", pid),
81-
entry.request as request,
82-
request.method = "PUT",
83-
request.url = append("Patient/", pid),
84-
entry.resource = create("Patient") as patient
85-
then {
86-
87-
immz -> patient.id = pid "SetId";
88-
89-
immz.uniqueId as id -> patient.identifier as identifier then {
90-
id -> identifier.value = id "SetIdentifierValue";
91-
} "SetIdentifier";
92-
93-
immz -> patient.name as pname then {
94-
immz.name as fullName -> pname.text = fullName "SetFullName";
95-
immz.firstName as firstName -> pname.given = firstName "SetFirstName";
96-
immz.familyName as familyName -> pname.family = familyName "SetFamilyName";
97-
}"SetName";
16+
immz.patient as patient -> uuid() as immid then {
9817

99-
immz.sex as sex -> patient.gender = translate(sex, 'http://smart.who.int/immunizations/ConceptMap/IMMZ.C.ConceptMap', 'code') "SetGender";
18+
immz then MakeImmunization( patient, immid, immz, bundle ) "MakeImmunization";
10019

101-
immz.dateOfBirth as birthDate -> patient.birthDate = birthDate "SetBirthDate";
20+
immz then D1andD13Observations( patient, immid, immz, bundle ) "MakeD1andD13Observations";
10221

103-
immz.contactPhoneNumber as phone -> patient.telecom as telecom then {
104-
phone as content -> telecom.value = content, telecom.system = 'phone' "SetPhoneValue";
105-
} "SetPhone";
22+
immz then D1Observations( patient, immid, immz, bundle ) "MakeD1Observations";
10623

107-
immz.address as address -> patient.address as taddress then {
108-
address as content -> taddress.text = content "SetAddressText";
109-
} "SetAddress";
110-
111-
immz.caregiversMultiple as caregiver -> uuid() as rpid,
112-
bundle.entry as entry,
113-
entry.fullUrl = append("urn:uuid:", rpid),
114-
entry.request as request,
115-
request.method = "PUT",
116-
request.url = append("RelatedPerson/", rpid),
117-
entry.resource = create("RelatedPerson") as person
118-
then {
119-
caregiver -> person.id = rpid "SetId";
120-
caregiver -> person.patient as patient, patient.reference = append("Patient/", pid ) "setPatient";
121-
caregiver -> person.name as pname then {
122-
caregiver.caregiversFullName as fullName -> pname.text = fullName "SetFullName";
123-
caregiver.caregiversFirstName as firstName -> pname.given = firstName "SetFirstName";
124-
caregiver.caregiversFamilyName as familyName -> pname.family = familyName "SetFamilyName";
125-
} "SetCaregiverName";
126-
} "CreateRelatedPerson";
24+
} "GetPatient";
12725

128-
} "CreatePatient";
129-
*/
13026
}
13127

132-
group MakeObservation( source patient : Reference, source code : Coding, source value, target obs ) {
133-
patient -> obs.subject = patient "SetSubject";
134-
code -> obs.code = code "SetCode";
135-
value -> obs.value = value "SetValue";
136-
}

0 commit comments

Comments
 (0)