Title: IMMZD5DTMeaslesContraindicationsLogic Id: IMMZD5DTMeaslesContraindicationsLogic Version: 0.2.0 Url: IMMZD5DTMeaslesContraindicationsLogic Status: draft Type: system: http://terminology.hl7.org/CodeSystem/library-type code: logic-library Date: 2026-03-03 13:07:11+0000 Publisher: WHO Description: This library defines decision support logic for the IMMZ.D5.DT.Measles contraindications decision table in the Immunization CPG Related Artifacts: Dependencies IMMZD5DTMeaslesEncounterElements Parameters: Name Type Min Max In/Out Today date 0 1 In Patient Patient 0 1 Out Draft Medication Request ID for Measles dose id 0 1 Out Measles vaccination contraindicated Case 1 boolean 0 1 Out Measles vaccination contraindicated Case 2 boolean 0 1 Out Measles vaccination contraindicated boolean 0 1 Out Measles vaccination contraindicated Guidance string 0 1 Out Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note boolean 0 1 Out Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note Guidance string 0 1 Out Clinical judgement required. Create a clinical note Case 1 boolean 0 1 Out Clinical judgement required. Create a clinical note Case 2 boolean 0 1 Out Clinical judgement required. Create a clinical note boolean 0 1 Out Clinical judgement required. Create a clinical note Guidance string 0 1 Out Guidance string 0 1 Out Has Guidance boolean 0 1 Out Test Validation Resource 0 1 Out Content: text/cql /* * Library: IMMZD5DTMeaslesContraindicationsLogic (IMMZ.D5.DT.Measles contraindications) * Rule: Check for contraindications before administering the vaccine(s) due * Decision Table: IMMZ.D5.DT.Measles contraindications * Trigger: IMMZ.D5 Determine vaccine(s) to be administered based on contraindications */ library IMMZD5DTMeaslesContraindicationsLogic using FHIR version '4.0.1' include FHIRHelpers version '4.0.1' include IMMZD5DTMeaslesEncounterElements called Encounter parameter Today Date default Today() context Patient /* @dynamicValue: Draft Medication Request ID for Measles dose */ define "Draft Medication Request ID for Measles dose": First(Encounter."Draft Medication Request for Measles dose").id /* @dynamicValue: Guidance */ define "Guidance": case when "Measles vaccination contraindicated" then "Measles vaccination contraindicated Guidance" when "Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note" then "Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note Guidance" when "Clinical judgement required. Create a clinical note" then "Clinical judgement required. Create a clinical note Guidance" else '' end define "Has Guidance": "Guidance" is not null and "Guidance" != '' /* @output: Measles vaccination contraindicated Case 1 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Measles vaccination contraindicated Case 1": Encounter."The client is pregnant" /* @output: Measles vaccination contraindicated Case 2 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Measles vaccination contraindicated Case 2": Encounter."The client is severely immunosuppressed" /* @output: Measles vaccination contraindicated @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Measles vaccination contraindicated": "Measles vaccination contraindicated Case 1" or "Measles vaccination contraindicated Case 2" /* @output: Measles vaccination contraindicated Guidance @guidance = Do not vaccinate client with measles as measles vaccination is contraindicated for pregnant client. @guidance = Do not vaccinate client with measles as measles vaccination is contraindicated for severely immunosuppressed client. */ define "Measles vaccination contraindicated Guidance": case when "Measles vaccination contraindicated Case 1" then 'Do not vaccinate client with measles as measles vaccination is contraindicated for pregnant client.' when "Measles vaccination contraindicated Case 2" then 'Do not vaccinate client with measles as measles vaccination is contraindicated for severely immunosuppressed client.' else '' end /* @output: Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note @pseudocode: "Immunization recommendation status" = "Further evaluation needed" */ define "Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note": Encounter."The client has history of anaphylactic reactions" /* @output: Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note Guidance @guidance: Do not vaccinate client with measles if client has history of anaphylactic reaction to any component of the vaccine (e.g. neomycin or gelatin). */ define "Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note Guidance": 'Do not vaccinate client with measles if client has history of anaphylactic reaction to any component of the vaccine (e.g. neomycin or gelatin).' /* @output: Clinical judgement required. Create a clinical note Case 1 @pseudocode: "Immunization recommendation status" = "Further evaluation needed" */ define "Clinical judgement required. Create a clinical note Case 1": Encounter."The client has history of severe allergic reactions" /* @output: Clinical judgement required. Create a clinical note Case 2 @pseudocode: "Immunization recommendation status" = "Further evaluation needed" */ define "Clinical judgement required. Create a clinical note Case 2": Encounter."The client has a symptomatic HIV infection" /* @output: Clinical judgement required. Create a clinical note @pseudocode: "Immunization recommendation status" = "Further evaluation needed" */ define "Clinical judgement required. Create a clinical note": "Clinical judgement required. Create a clinical note Case 1" or "Clinical judgement required. Create a clinical note Case 2" /* @output: Clinical judgement required. Create a clinical note Guidance @guidance = Do not vaccinate client with measles if client has history of severe allergic reactions to any component of the vaccine (e.g. neomycin or gelatin). @guidance = Client has symptomatic HIV infection. Measles vaccination may be considered if the client is not severely immunosuppressed according to conventional definitions, consider risks of vaccination and make a clinical judgement. */ define "Clinical judgement required. Create a clinical note Guidance": case when "Clinical judgement required. Create a clinical note Case 1" then 'Do not vaccinate client with measles if client has history of severe allergic reactions to any component of the vaccine (e.g. neomycin or gelatin).' when "Clinical judgement required. Create a clinical note Case 2" then 'Client has symptomatic HIV infection. Measles vaccination may be considered if the client is not severely immunosuppressed according to conventional definitions, consider risks of vaccination and make a clinical judgement.' else '' end /* @test: Test expected results based on example patients */ define "Test Validation": case when Patient.id = 'Measles56.1' then "Measles vaccination contraindicated Case 1" and "Guidance" = 'Do not vaccinate client with measles as measles vaccination is contraindicated for pregnant client.' when Patient.id = 'Measles57.1' then "Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note" and "Guidance" = 'Do not vaccinate client with measles if client has history of anaphylactic reaction to any component of the vaccine (e.g. neomycin or gelatin).' when Patient.id = 'Measles58.1' then "Clinical judgement required. Create a clinical note Case 1" and "Guidance" = 'Do not vaccinate client with measles if client has history of severe allergic reactions to any component of the vaccine (e.g. neomycin or gelatin).' when Patient.id = 'Measles59.1' then "Measles vaccination contraindicated Case 2" and "Guidance" = 'Do not vaccinate client with measles as measles vaccination is contraindicated for severely immunosuppressed client.' when Patient.id = 'Measles60.1' then "Clinical judgement required. Create a clinical note Case 2" and "Guidance" = 'Client has symptomatic HIV infection. Measles vaccination may be considered if the client is not severely immunosuppressed according to conventional definitions, consider risks of vaccination and make a clinical judgement.' else 'No test case set' end Content: application/elm+xml Encoded data (66136 characters)
This library defines decision support logic for the IMMZ.D5.DT.Measles contraindications decision table in the Immunization CPG
Draft Medication Request ID for Measles dose
Measles vaccination contraindicated Case 1
Measles vaccination contraindicated Case 2
Measles vaccination contraindicated Guidance
Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note
Measles vaccination could be contraindicated. Clinical judgement required. Create a clinical note Guidance
Clinical judgement required. Create a clinical note Case 1
Clinical judgement required. Create a clinical note Case 2
Clinical judgement required. Create a clinical note
Clinical judgement required. Create a clinical note Guidance