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/ and changes regularly. See the Directory of published versions

Library: IMMZD2DTHepatitisBBirthLogic

Official URL: http://smart.who.int/immunizations/Library/IMMZD2DTHepatitisBBirthLogic Version: 0.2.0
Draft as of 2025-08-08 Computable Name: IMMZD2DTHepatitisBBirthLogic

This library defines decision support logic for the IMMZ.D2.DT.Hepatitis B.Birth dose decision table in the Immunization CPG

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

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

code: logic-library

Date: 2025-08-08 19:12:11+0000
Publisher: WHO
Description:

This library defines decision support logic for the IMMZ.D2.DT.Hepatitis B.Birth dose decision table in the Immunization CPG

Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Todaydate01In
PatientPatient01Out
Client is due for hepatitis B monovalent vaccineboolean01Out
Client is due for hepatitis B monovalent vaccine Guidancestring01Out
Client should follow delayed-start decision logicboolean01Out
Client should follow delayed-start decision logic Guidancestring01Out
Client is not due for the hepatitis B birth doseboolean01Out
Client is not due for the hepatitis B birth dose Guidancestring01Out
Guidancestring01Out
Has Guidanceboolean01Out
Test ValidationResource01Out
Content: text/cql

/*
 * Library: IMMZD2DTHepatitisBBirthLogic (IMMZ.D2.DT.Hepatitis B.Birth dose)
 * Rule: Determine if the client is due for a hepatitis B vaccination according to the national immunization schedule
 * Decision Table: Birth dose administration
 * Trigger: IMMZ.D2 Determine required vaccination(s) if any
 */
library IMMZD2DTHepatitisBBirthLogic

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

include IMMZD2DTHepatitisBEncounterElements called Encounter

parameter Today Date default Today()

context Patient


/*
@dynamicValue: Guidance
*/
define "Guidance":
  case
    when "Client is due for hepatitis B monovalent vaccine" then "Client is due for hepatitis B monovalent vaccine Guidance"
    when "Client should follow delayed-start decision logic" then "Client should follow delayed-start decision logic Guidance"
    when "Client is not due for the hepatitis B birth dose" then "Client is not due for the hepatitis B birth dose Guidance"
    else ''
  end

define "Has Guidance":
  "Guidance" is not null and "Guidance" != ''

/*
@output: Client is due for hepatitis B monovalent vaccine
@pseudocode: "Immunization recommendation status" = "Due" (where "Type of hepatitis B dose" = "Hepatitis B monovalent vaccine")
*/
define "Client is due for hepatitis B monovalent vaccine":
  Encounter."Hepatitis B birth dose was not administered"
    and Encounter."Client's age is less than {Member States defined upper limit}"

/*
@output: Client is due for hepatitis B monovalent vaccine Guidance
@guidance: Should vaccinate client with hepatitis B birth dose, as a monovalent dose. Check for contraindications.
*/
define "Client is due for hepatitis B monovalent vaccine Guidance":
  'Should vaccinate client with hepatitis B birth dose, as a monovalent dose. Check for contraindications.'

/*
@output: Client should follow delayed-start decision logic
@pseudocode: 
*/
define "Client should follow delayed-start decision logic":
  Encounter."Hepatitis B birth dose was not administered"
    and Encounter."Client's age is more than {Member States defined upper limit}"

/*
@output: Client should follow delayed-start decision logic Guidance
@guidance: The client has a delayed start. Please follow the delayed start schedule.
*/
define "Client should follow delayed-start decision logic Guidance":
  'The client has a delayed start. Please follow the delayed start schedule.'

/*
@output: Client is not due for the hepatitis B birth dose
@pseudocode: "Immunization recommendation status" = "Not due"
*/
define "Client is not due for the hepatitis B birth dose":
  Encounter."Hepatitis B birth dose was administered"

/*
@output: Client is not due for the hepatitis B birth dose Guidance
@guidance: Hepatitis B birth dose was already administered. Check hepatitis B immunization schedule.
*/
define "Client is not due for the hepatitis B birth dose Guidance":
  'Hepatitis B birth dose was already administered. Check hepatitis B immunization schedule.'


/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  case
    when Patient.id = '08.Alt1d' then "Client is due for hepatitis B monovalent vaccine" and "Guidance" = 'Should vaccinate client with hepatitis B birth dose, as a monovalent dose. Check for contraindications.'
    when Patient.id = '09.Agt1d' then "Client should follow delayed-start decision logic" and "Guidance" = 'The client has a delayed start. Please follow the delayed start schedule.'
    when Patient.id = '10.D1' then "Client is not due for the hepatitis B birth dose" and "Guidance" = 'Hepatitis B birth dose was already administered. Check hepatitis B immunization schedule.'
    else 'No test case set'
  end
Content: application/elm+xml
Encoded data (40708 characters)