WHO Immunization Implementation Guide
0.2.0 - ci-build

WHO Immunization Implementation Guide, published by WHO. This guide is not an authorized publication; it is the continuous build for version 0.2.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/WorldHealthOrganization/smart-immunizations/tree/main and changes regularly. See the Directory of published versions
Built from commit 31220c5a.

Library: IMMZD5DTHPVContraindicationsLogic

Official URL: http://smart.who.int/immunizations/Library/IMMZD5DTHPVContraindicationsLogic Version: 0.2.0
Draft as of 2026-11-19 Computable Name: IMMZD5DTHPVContraindicationsLogic

This library defines decision support logic for the IMMZ.D5.DT.HPV contraindications decision table in the Immunization CPG

Title: IMMZD5DTHPVContraindicationsLogic
Id: IMMZD5DTHPVContraindicationsLogic
Version: 0.2.0
Url: IMMZD5DTHPVContraindicationsLogic
Status: draft
Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2026-11-19 08:43:48+0000
Publisher: WHO
Description:

This library defines decision support logic for the IMMZ.D5.DT.HPV contraindications decision table in the Immunization CPG

Related Artifacts:

Dependencies

Content: text/cql
/*
 * Library: IMMZD5DTHPVContraindicationsLogic (IMMZ.D5.DT.HPV contraindications)
 * Rule: Check for contraindications before administering the vaccine(s) due
 * Decision Table: IMMZ.D5.DT.HPV contraindications
 * Trigger: IMMZ.D5 Determine vaccine(s) to be administered based on contraindications
 */
library IMMZD5DTHPVContraindicationsLogic

using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'

include IMMZD5DTHPVEncounterElements called Encounter

parameter Today Date default Today()

context Patient

/*
  @dynamicValue: Draft Medication Request ID for HPV dose
  */
  define "Draft Medication Request ID for HPV dose":
    First(Encounter."Draft Medication Request for HPV dose").id


/*
@dynamicValue: Guidance
*/
define "Guidance":
  case 
    when "Human papillomavirus (HPV) vaccination is contraindicated" then "Human papillomavirus (HPV) vaccination is contraindicated Guidance"
    when "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note" then "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance" 
    else ''
  end
  
define "Has Guidance":
  "Guidance" is not null and "Guidance" != ''

/*
@output: Human papillomavirus (HPV) vaccination is contraindicated
@pseudocode: "Immunization recommendation status" = "Contraindicated"
*/
define "Human papillomavirus (HPV) vaccination is contraindicated":
  Encounter."The client is currently pregnant"

/*
@output: Human papillomavirus (HPV) vaccination is contraindicated Guidance
@guidance: Do not vaccinate client with HPV as HPV vaccination is contraindicated for pregnant client.
*/
define "Human papillomavirus (HPV) vaccination is contraindicated Guidance":
  'Do not vaccinate client with HPV as HPV vaccination is contraindicated for pregnant client.'

/*
@output: HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note
@pseudocode: "Immunization recommendation status" = "Further evaluation needed"
*/
define "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note":
  Encounter."The client has history of severe allergic reactions"

/*
@output: HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance
@guidance: Do not vaccinate client with HPV if client has history of a severe allergic reaction after a previous HPV vaccine dose, or to a component of the vaccine.
*/
define "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance":
  'Do not vaccinate client with HPV if client has history of a severe allergic reaction after a previous HPV vaccine dose, or to a component of the vaccine.'


/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  case
    when Patient.id = 'HPV45.1' then "Human papillomavirus (HPV) vaccination is contraindicated" and "Guidance" = 'Do not vaccinate client with HPV as HPV vaccination is contraindicated for pregnant client.'
    when Patient.id = 'HPV46.1' then "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note" and "Guidance" = 'Do not vaccinate client with HPV if client has history of a severe allergic reaction after a previous HPV vaccine dose, or to a component of the vaccine.'
    else 'No test case set'
  end
Content: application/elm+xml
Download (Library-IMMZD5DTHPVContraindicationsLogic.elm.xml)

CQL Source

/*
 * Library: IMMZD5DTHPVContraindicationsLogic (IMMZ.D5.DT.HPV contraindications)
 * Rule: Check for contraindications before administering the vaccine(s) due
 * Decision Table: IMMZ.D5.DT.HPV contraindications
 * Trigger: IMMZ.D5 Determine vaccine(s) to be administered based on contraindications
 */
library IMMZD5DTHPVContraindicationsLogic

using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'

include IMMZD5DTHPVEncounterElements called Encounter

parameter Today Date default Today()

context Patient

/*
  @dynamicValue: Draft Medication Request ID for HPV dose
  */
  define "Draft Medication Request ID for HPV dose":
    First(Encounter."Draft Medication Request for HPV dose").id


/*
@dynamicValue: Guidance
*/
define "Guidance":
  case 
    when "Human papillomavirus (HPV) vaccination is contraindicated" then "Human papillomavirus (HPV) vaccination is contraindicated Guidance"
    when "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note" then "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance" 
    else ''
  end
  
define "Has Guidance":
  "Guidance" is not null and "Guidance" != ''

/*
@output: Human papillomavirus (HPV) vaccination is contraindicated
@pseudocode: "Immunization recommendation status" = "Contraindicated"
*/
define "Human papillomavirus (HPV) vaccination is contraindicated":
  Encounter."The client is currently pregnant"

/*
@output: Human papillomavirus (HPV) vaccination is contraindicated Guidance
@guidance: Do not vaccinate client with HPV as HPV vaccination is contraindicated for pregnant client.
*/
define "Human papillomavirus (HPV) vaccination is contraindicated Guidance":
  'Do not vaccinate client with HPV as HPV vaccination is contraindicated for pregnant client.'

/*
@output: HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note
@pseudocode: "Immunization recommendation status" = "Further evaluation needed"
*/
define "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note":
  Encounter."The client has history of severe allergic reactions"

/*
@output: HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance
@guidance: Do not vaccinate client with HPV if client has history of a severe allergic reaction after a previous HPV vaccine dose, or to a component of the vaccine.
*/
define "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance":
  'Do not vaccinate client with HPV if client has history of a severe allergic reaction after a previous HPV vaccine dose, or to a component of the vaccine.'


/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  case
    when Patient.id = 'HPV45.1' then "Human papillomavirus (HPV) vaccination is contraindicated" and "Guidance" = 'Do not vaccinate client with HPV as HPV vaccination is contraindicated for pregnant client.'
    when Patient.id = 'HPV46.1' then "HPV vaccination could be contraindicated. Clinical judgement is required. Create a clinical note" and "Guidance" = 'Do not vaccinate client with HPV if client has history of a severe allergic reaction after a previous HPV vaccine dose, or to a component of the vaccine.'
    else 'No test case set'
  end

ELM Content

ELM binary data has been extracted to separate files: