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: IMMZD18SHepatitisBBirthLogic

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

This library defines decision support logic for the IMMZ.D18.S.Hepatitis B.Birth dose schedule table in the Immunization CPG

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

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

code: logic-library

Date: 2025-09-17 23:03:28+0000
Publisher: WHO
Description:

This library defines decision support logic for the IMMZ.D18.S.Hepatitis B.Birth dose schedule table in the Immunization CPG

Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Todaydate01In
PatientPatient01Out
Hepatitis B birth dose was administeredboolean01Out
Hepatitis B birth doseboolean01Out
Hepatitis B birth dose Due Datedate01Out
Hepatitis B birth dose Overduedate01Out
Hepatitis B birth dose Createstring01Out
Hepatitis B birth dose ExpirationResource01Out
Test ValidationResource01Out
Content: text/cql

/*
 * Library: IMMZD18SHepatitisBBirthLogic (IMMZ.D18.S.Hepatitis B.Birth dose schedule)
 * Schedule Table: Birth dose schedule
 */
library IMMZD18SHepatitisBBirthLogic

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

include WHOCommon called WC

include IMMZCommon called Common
include IMMZConcepts called Concepts

include IMMZEncounterElements called IE
include IMMZD2DTHepatitisBEncounterElements called Encounter

parameter Today Date default Today()

context Patient


/*
@output: Hepatitis B birth dose
@description: Provision of hepatitis B birth dose
@trigger: Child's birth
@triggerDate: "Date of birth"
*/
define "Hepatitis B birth dose":
  not "Hepatitis B birth dose was administered"

/*
@output: Hepatitis B birth dose Create
@create: All infants should receive a first dose of the hepatitis B-containing vaccine as soon as possible after birth, ideally within 24 hours
*/
define "Hepatitis B birth dose Create":
  if "Hepatitis B birth dose" 
  then 'All infants should receive a first dose of the hepatitis B-containing vaccine as soon as possible after birth, ideally within 24 hours' + '
Due Date: ' + ToString("Hepatitis B birth dose Due Date") + '
Overdue: ' + ToString("Hepatitis B birth dose Overdue")
  else ''

/*
@dynamicValue: Hepatitis B birth dose Due Date
@pseudocode: "Date of birth"
*/
define "Hepatitis B birth dose Due Date":
  if "Hepatitis B birth dose" then Patient.birthDate
  else null

/*
@dynamicValue: Hepatitis B birth dose Overdue
@pseudocode: "Date of birth" + 24 hours
*/
define "Hepatitis B birth dose Overdue":
  if "Hepatitis B birth dose" then Patient.birthDate + 24 hours
  else null

/*
@dynamicValue: Hepatitis B birth dose Expiration
@pseudocode: To be determined by Member States
*/
define "Hepatitis B birth dose Expiration":
  null

/*
@complete: Hepatitis B birth dose was administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Birth Dose" = TRUE) = 1
*/
define "Hepatitis B birth dose was administered":
  Encounter."Hepatitis B birth dose was administered"


/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  case
    when Patient.id = '07.newborn' then "Hepatitis B birth dose"
    when Patient.id = '07.D1' then not "Hepatitis B birth dose"
    else 'No test case set'
  end
Content: application/elm+xml
Encoded data (32160 characters)