Skip to content

Commit f557d16

Browse files
committed
Added in structuremap for IMMZD5 since it is used with the CQL.
1 parent ec891a3 commit f557d16

9 files changed

+177
-30
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Instance: Example.IMMZ.D5.QuestionnaireResponse.1
2+
InstanceOf: QuestionnaireResponse
3+
Usage: #example
4+
* status = #completed
5+
* authored = "2025-01-31T19:20:20.913Z"
6+
* questionnaire = Canonical(QIMMZD5)
7+
* subject = Reference(IMMZ.C.Patient.2)
8+
9+
* insert QRItem( Coding, potentialContraindications, IMMZ.D#DE162 "Currently pregnant" )
10+
* insert QRItem( Coding, potentialContraindications, IMMZ.D#DE167 "Severe allergic reactions" )
11+
12+

input/fsh/models/IMMZD5.fsh

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,13 @@ Description: "Data elements for the IMMZ.D5.Determine vaccine(s) to be administ
2020
* patient 1..1 Reference "Patient" "The patient."
2121
* potentialContraindications 1..* Coding "Potential contraindications" "Specific situations or medical conditions for which it is advised or recommended to avoid or delay administering a particular vaccine"
2222
* potentialContraindications from IMMZ.D.DE161 (required)
23-
* ^code[+] = IMMZ.D#DE161
23+
* ^code[+] = IMMZ.D#DE161
24+
25+
Mapping: IMMZD5.to.Observation
26+
Source: IMMZD5
27+
Target: "http://smart.who.int/immunizations/StructureDefinition/IMMZObservation"
28+
Title: "Mapping from the IMMZ.D5 to the IMMZObservation profile"
29+
30+
* -> "Observation"
31+
* patient -> "Observation.subject"
32+
* potentialContraindications -> "Observation.valueCodeableConcept"

input/fsh/profiles/IMMZObservation.fsh

+7
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@ Description: "Observation Profile for the Immunizations SMART Guidelines. From
2020

2121
* code from IMMZ.D.Observation (required)
2222

23+
* partOf ^slicing.discriminator[+].type = #type
24+
* partOf ^slicing.discriminator[=].path = "$this"
25+
* partOf ^slicing.rules = #open
26+
* partOf contains immzPartOf 0..*
27+
28+
* partOf[immzPartOf] only Reference(IMMZImmunization)
29+
2330
* value[x] only boolean or Quantity or CodeableConcept or integer or dateTime

input/maps/IMMZ.D13.QRToBundle.fml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ map "http://smart.who.int/immunizations/StructureMap/IMMZ.D13.QRToBundle" = "IMM
22
// Immunization Administer Vaccine - Transform QuestionnaireResponse to Immunization resources
33

44
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
5-
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZD13" alias IMMZD1 as source
5+
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZD13" alias IMMZD13 as source
66
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
77

88
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.D13.QRToLM"

input/maps/IMMZ.D5.LMToBundle.fml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
map "http://smart.who.int/immunizations/StructureMap/IMMZ.D5.LMToBundle" = "IMMZ.D5.LMToBundle"
2+
// Immunization Administer Vaccine - Transform Logical Model to Immunization resources
3+
4+
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZD5" alias IMMZD5 as source
5+
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
6+
// uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as produced
7+
// uses "http://hl7.org/fhir/StructureDefinition/RelatedPerson" alias RelatedPerson as produced
8+
9+
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.Helpers"
10+
11+
12+
group IMMZD5ToBundle (source immz : IMMZD5, target bundle: Bundle) {
13+
14+
immz -> bundle.type = "transaction" "SetBundleType";
15+
16+
immz.patient as patient then {
17+
18+
immz.potentialContraindications as content ->
19+
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE161', 'Potential contraindications') as code,
20+
c( 'http://terminology.hl7.org/CodeSystem/observation-category', 'survey', 'Survey' ) as survey
21+
then MakeObservation( patient, code, survey, content, bundle ) "potentialContraindications";
22+
23+
} "GetPatient";
24+
}
25+

input/maps/IMMZ.D5.QRToBundle.fml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
map "http://smart.who.int/immunizations/StructureMap/IMMZ.D5.QRToBundle" = "IMMZ.D5.QRToBundle"
2+
// Immunization Administer Vaccine - Transform QuestionnaireResponse to Immunization resources
3+
4+
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
5+
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZD5" alias IMMZD5 as source
6+
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
7+
8+
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.D5.QRToLM"
9+
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.D5.LMToBundle"
10+
11+
group QRespToBundle (
12+
source qr : QResp,
13+
target bundle: Bundle
14+
) {
15+
qr -> create("http://smart.who.int/immunizations/StructureDefinition/IMMZD5") as model
16+
then{
17+
qr -> model then QRespToIMMZD5( qr, model) "QRtoLM";
18+
qr -> bundle then IMMZD5ToBundle( model, bundle ) "LMtoBundle";
19+
} "QRtoBundle";
20+
}
21+

input/maps/IMMZ.D5.QRToLM.fml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
map "http://smart.who.int/immunizations/StructureMap/IMMZ.D5.QRToLM" = "IMMZ.D5.QRToLM"
2+
// Immunization Administer Vaccine - Transform QuestionnaireResponse to Logical Model
3+
4+
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
5+
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZD5" alias IMMZD5 as target
6+
7+
imports "http://smart.who.int/immunizations/StructureMap/IMMZ.Helpers"
8+
9+
10+
group QRespToIMMZD5 ( source qr : QResp, target immz : IMMZD5) {
11+
12+
qr.subject as subject -> immz.patient = subject "setPatient";
13+
14+
qr.item as item where item.linkId = 'potentialContraindications' -> immz.potentialContraindications as field
15+
then ItemToCoding(item, field) "potentialContraindications";
16+
17+
}

input/maps/IMMZ.Helpers.fml

+44-26
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ group D13Questions(
193193

194194
}
195195

196-
group MakeObservation(
196+
group MakeImmzObservation(
197197
source patient : Reference,
198198
source immid,
199199
source code : Coding,
@@ -217,15 +217,33 @@ group MakeObservation(
217217
} "CreateObservation";
218218
}
219219

220+
group MakeObservation(
221+
source patient : Reference,
222+
source code : Coding,
223+
source cat : Coding,
224+
source value,
225+
target bundle : Bundle ) {
226+
value -> uuid() as oid,
227+
bundle.entry as entry,
228+
entry.fullUrl = append("urn:uuid:", oid),
229+
entry.request as request,
230+
request.method = "PUT",
231+
request.url = append("Observation/", oid),
232+
entry.resource = create("Observation") as obs
233+
then {
234+
value -> obs.id = oid "SetId";
235+
patient -> obs.subject = patient "SetSubject";
236+
code -> obs.code = code "SetCode";
237+
value -> obs.value = value "SetValue";
238+
cat -> obs.category = cat "SetCategory";
239+
} "CreateObservation";
240+
}
241+
220242
group TypeOfVaccineDose ( source typeof : Coding, target ext : Extension ) {
221243
typeof -> ext.url = 'http://smart.who.int/immunizations/StructureDefinition/IMMZTypeOfDose' "SetURL";
222244
typeof -> ext.value = typeof "SetValue";
223245
}
224246

225-
group VaccineBrand( source value : Coding, target ext : Extension ) {
226-
227-
}
228-
229247
group MakeImmunization(
230248
source patient : Reference,
231249
source immid,
@@ -310,31 +328,31 @@ group D1andD13Observations(
310328

311329
immz.birthDose as content ->
312330
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE263', 'Birth dose') as code
313-
then MakeObservation( patient, immid, code, survey, content, bundle ) "birthDose";
331+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "birthDose";
314332

315333
immz.completedThePrimaryVaccinationSeries as content ->
316334
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE203', 'Completed the primary vaccination series') as code
317-
then MakeObservation( patient, immid, code, survey, content, bundle ) "completedThePrimaryVaccinationSeries";
335+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "completedThePrimaryVaccinationSeries";
318336

319337
immz.completedTheBoosterSeries as content ->
320338
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE257', 'Completed the booster series') as code
321-
then MakeObservation( patient, immid, code, survey, content, bundle ) "completedTheBoosterSeries";
339+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "completedTheBoosterSeries";
322340

323341
immz.dateWhenPrimaryVaccinationSeriesWasCompleted as content ->
324342
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE242', 'Date when primary vaccination series was completed') as code
325-
then MakeObservation( patient, immid, code, survey, content, bundle ) "dateWhenPrimaryVaccinationSeriesWasCompleted";
343+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "dateWhenPrimaryVaccinationSeriesWasCompleted";
326344

327345
immz.hivStatus as content ->
328346
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE204', 'HIV status') as code
329-
then MakeObservation( patient, immid, code, survey, content, bundle ) "hivStatus";
347+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "hivStatus";
330348

331349
immz.contactDate as content ->
332350
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE201', 'Contact date') as code
333-
then MakeObservation( patient, immid, code, survey, content, bundle ) "contactDate";
351+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "contactDate";
334352

335353
immz.ancContactNumber as content ->
336354
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE202', 'ANC contact number') as code
337-
then MakeObservation( patient, immid, code, survey, content, bundle ) "ancContactNumber";
355+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "ancContactNumber";
338356

339357
} "DefineCategory";
340358

@@ -349,62 +367,62 @@ group D1Observations(
349367
immz -> c( 'http://terminology.hl7.org/CodeSystem/observation-category', 'survey', 'Survey' ) as survey then {
350368
immz.pretermBirth as content ->
351369
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE208', 'Preterm birth') as code
352-
then MakeObservation( patient, immid, code, survey, content, bundle ) "pretermBirth";
370+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "pretermBirth";
353371

354372
immz.immunocompromised as content ->
355373
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE209', 'Immunocompromised') as code
356-
then MakeObservation( patient, immid, code, survey, content, bundle ) "immunocompromised";
374+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "immunocompromised";
357375

358376
immz.currentlyOnArt as content ->
359377
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE210', 'Currently on ART') as code
360-
then MakeObservation( patient, immid, code, survey, content, bundle ) "currentlyOnArt";
378+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "currentlyOnArt";
361379

362380
immz.typeOfTbInfectionTestPerformed as content ->
363381
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE243', 'Type of TB infection test performed') as code
364-
then MakeObservation( patient, immid, code, survey, content, bundle ) "typeOfTbInfectionTestPerformed";
382+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "typeOfTbInfectionTestPerformed";
365383

366384
immz.tbInfectionTestResult as content ->
367385
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE246', 'TB infection test result') as code
368-
then MakeObservation( patient, immid, code, survey, content, bundle ) "tbInfectionTestResult";
386+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "tbInfectionTestResult";
369387

370388
immz.immunologicallyStable as content ->
371389
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE249', 'Immunologically stable') as code
372-
then MakeObservation( patient, immid, code, survey, content, bundle ) "immunologicallyStable";
390+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "immunologicallyStable";
373391

374392
immz.clinicallyWell as content ->
375393
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE250', 'Clinically well') as code
376-
then MakeObservation( patient, immid, code, survey, content, bundle ) "clinicallyWell";
394+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "clinicallyWell";
377395

378396
immz.birthWeightInGrams as value -> create("Quantity") as content, content.system = 'http://unitsofmeasure.org', content.code = 'g', content.unit = 'g', content.value = value,
379397
c( 'http://loinc.org', '8339-4', 'Birth weight Measured') as bwloinc,
380398
c( 'http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE211', 'Birth weight in grams') as bwdak,
381399
create("CodeableConcept") as code, code.coding = bwloinc, code.coding = bwdak,
382400
c( 'http://terminology.hl7.org/CodeSystem/observation-category', 'vital-signs', 'Vital Signs' ) as vital
383-
then MakeObservation( patient, immid, code, vital, content, bundle ) "birthWeightInGrams";
401+
then MakeImmzObservation( patient, immid, code, vital, content, bundle ) "birthWeightInGrams";
384402

385403
immz.artStartDate as content ->
386404
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE215', 'ART start date') as code
387-
then MakeObservation( patient, immid, code, survey, content, bundle ) "artStartDate";
405+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "artStartDate";
388406

389407
immz.highRiskOfPneumococcalInfection as content ->
390408
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE251', 'High risk of pneumococcal infection') as code
391-
then MakeObservation( patient, immid, code, survey, content, bundle ) "highRiskOfPneumococcalInfection";
409+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "highRiskOfPneumococcalInfection";
392410

393411
immz.ageInMonthsWhenClientReceivedFirstMeningococcalDose as value -> create("Quantity") as content, content.unit = 'mo', content.value = value,
394412
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE236', 'Age in months when client received first meningococcal dose') as code
395-
then MakeObservation( patient, immid, code, survey, content, bundle ) "ageInMonthsWhenClientReceivedFirstMeningococcalDose";
413+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "ageInMonthsWhenClientReceivedFirstMeningococcalDose";
396414

397415
immz.vnaLevel as value -> create("Quantity") as content, content.system = 'http://unitsofmeasure.org', content.code = '[IU]/mL', content.unit = '[IU]/mL', content.value = value,
398416
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE240', 'VNA level') as code
399-
then MakeObservation( patient, immid, code, survey, content, bundle ) "vnaLevel";
417+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "vnaLevel";
400418

401419
immz.riskOfOccupationalExposureToRabiesVirus as content ->
402420
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE253', 'Risk of occupational exposure to rabies virus') as code
403-
then MakeObservation( patient, immid, code, survey, content, bundle ) "riskOfOccupationalExposureToRabiesVirus";
421+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "riskOfOccupationalExposureToRabiesVirus";
404422

405423
immz.dengueSerostatus as content ->
406424
c('http://smart.who.int/immunizations/CodeSystem/IMMZ.D', 'DE241', 'Dengue serostatus') as code
407-
then MakeObservation( patient, immid, code, survey, content, bundle ) "dengueSerostatus";
425+
then MakeImmzObservation( patient, immid, code, survey, content, bundle ) "dengueSerostatus";
408426

409427
} "DefineCategory";
410428
}

tools/maps.http

+40-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ POST {{host}}/StructureMap/$transform?source=http://smart.who.int/immunizations/
8181
Accept: application/fhir+json;fhirVersion=4.0
8282
Content-Type: application/fhir+json;fhirVersion=4.0
8383

84-
< ../fsh-generated/resources/QuestionnaireResponse-Example.IMMZ.D1.QuestionnaireResponse.DTP.json
84+
< ../fsh-generated/resources/QuestionnaireResponse-Example.IMMZ.D1.QuestionnaireResponse.BCG.json
8585

8686

8787
### Post the StructureMap with transform included
@@ -119,4 +119,42 @@ POST {{host}}/StructureMap/$transform?source=http://smart.who.int/immunizations/
119119
Accept: application/fhir+json;fhirVersion=4.0
120120
Content-Type: application/fhir+json;fhirVersion=4.0
121121

122-
< ../fsh-generated/resources/QuestionnaireResponse-Example.IMMZ.D13.QuestionnaireResponse.Measles.json
122+
< ../fsh-generated/resources/QuestionnaireResponse-Example.IMMZ.D13.QuestionnaireResponse.BCG.json
123+
124+
125+
### Post the StructureMap with transform included
126+
PUT {{host}}/StructureMap/IMMZ.D5.QRToLM HTTP/1.1
127+
Accept: application/fhir+json;fhirVersion=4.0
128+
Content-Type: text/fhir-mapping
129+
130+
< ../input/maps/IMMZ.D5.QRToLM.fml
131+
132+
### Post the StructureMap with transform included
133+
PUT {{host}}/StructureMap/IMMZ.D5.LMToBundle HTTP/1.1
134+
Accept: application/fhir+json;fhirVersion=4.0
135+
Content-Type: text/fhir-mapping
136+
137+
< ../input/maps/IMMZ.D5.LMToBundle.fml
138+
139+
### Post the StructureMap with transform included
140+
PUT {{host}}/StructureMap/IMMZ.D5.QRToBundle HTTP/1.1
141+
Accept: application/fhir+json;fhirVersion=4.0
142+
Content-Type: text/fhir-mapping
143+
144+
< ../input/maps/IMMZ.D5.QRToBundle.fml
145+
146+
### Test Transform of QR to LM
147+
### after running _getonce
148+
POST {{host}}/StructureMap/$transform?source=http://smart.who.int/immunizations/StructureMap/IMMZ.D5.QRToLM
149+
Accept: application/fhir+json;fhirVersion=4.0
150+
Content-Type: application/fhir+json;fhirVersion=4.0
151+
152+
< ../fsh-generated/resources/QuestionnaireResponse-Example.IMMZ.D5.QuestionnaireResponse.1.json
153+
154+
### Test Transform of QR to LM
155+
### after running _genonce
156+
POST {{host}}/StructureMap/$transform?source=http://smart.who.int/immunizations/StructureMap/IMMZ.D5.QRToBundle
157+
Accept: application/fhir+json;fhirVersion=4.0
158+
Content-Type: application/fhir+json;fhirVersion=4.0
159+
160+
< ../fsh-generated/resources/QuestionnaireResponse-Example.IMMZ.D5.QuestionnaireResponse.1.json

0 commit comments

Comments
 (0)