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

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

This library defines decision support logic for the IMMZ.D18.S.BCG schedule table in the Immunization CPG

Title: IMMZD18DTBCGLogic
Id: IMMZD18SBCGLogic
Version: 0.2.0
Url: IMMZD18DTBCGLogic
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.BCG schedule table in the Immunization CPG

Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Todaydate01In
PatientPatient01Out
One BCG dose from the primary series was administered. The primary series has been completedboolean01Out
Bacille Calmette–Guérin (BCG) dose 1boolean01Out
Bacille Calmette–Guérin (BCG) dose 1 Due Datedate01Out
Bacille Calmette–Guérin (BCG) dose 1 Createstring01Out
Bacille Calmette–Guérin (BCG) dose 1 OverdueResource01Out
Bacille Calmette–Guérin (BCG) dose 1 ExpirationResource01Out
Test ValidationResource01Out
Content: text/cql

/*
 * Library: IMMZD18SBCGLogic (IMMZ.D18.S.BCG schedule)
 * Schedule Table: IMMZ.D18.S.BCG schedule
 */
library IMMZD18SBCGLogic

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 IMMZD2DTBCGEncounterElements called Encounter

parameter Today Date default Today()

context Patient


/*
@output: Bacille Calmette–Guérin (BCG) dose 1
@description: Provision of the BCG dose
@trigger: Child's birth
@triggerDate: "Date of birth"
*/
define "Bacille Calmette–Guérin (BCG) dose 1":
  not "One BCG dose from the primary series was administered. The primary series has been completed"

/*
@output: Bacille Calmette–Guérin (BCG) dose 1 Create
@create: BCG dose should be provided if the client has not received any BCG doses and is in a high incidence of tuberculosis (TB) and/or high leprosy burden. It should also be provided after a negative test result for tuberculin skin test (TST) or interferon-gamma release assay (IGRA) tests. The client should also receive vaccination if they are infected with HIV, on antiretroviral therapy (ART) and clinically well and immunologically stable. This dose also applies to neonates born to women with an unknown HIV status, as well as neonates with an unknown HIV status who were born to women infected with HIV.
*/
define "Bacille Calmette–Guérin (BCG) dose 1 Create":
  if "Bacille Calmette–Guérin (BCG) dose 1" 
  then 'BCG dose should be provided if the client has not received any BCG doses and is in a high incidence of tuberculosis (TB) and/or high leprosy burden. It should also be provided after a negative test result for tuberculin skin test (TST) or interferon-gamma release assay (IGRA) tests. The client should also receive vaccination if they are infected with HIV, on antiretroviral therapy (ART) and clinically well and immunologically stable. This dose also applies to neonates born to women with an unknown HIV status, as well as neonates with an unknown HIV status who were born to women infected with HIV.' + '
Due Date: ' + ToString("Bacille Calmette–Guérin (BCG) dose 1 Due Date")
  else ''

/*
@dynamicValue: Bacille Calmette–Guérin (BCG) dose 1 Due Date
@pseudocode: "Date of birth"
*/
define "Bacille Calmette–Guérin (BCG) dose 1 Due Date":
  Patient.birthDate

/*
@dynamicValue: Bacille Calmette–Guérin (BCG) dose 1 Overdue
@pseudocode: To be determined by Member States; however, there is no recommended overdue date and individuals are always eligible to be vaccinated
*/
define "Bacille Calmette–Guérin (BCG) dose 1 Overdue":
  null

/*
@dynamicValue: Bacille Calmette–Guérin (BCG) dose 1 Expiration
@pseudocode: To be determined by Member States; however, there is no recommended expiration date and individuals are always eligible to be vaccinated
*/
define "Bacille Calmette–Guérin (BCG) dose 1 Expiration":
  null

/*
@complete: One BCG dose from the primary series was administered. The primary series has been completed
@pseudocode: "Completed the primary vaccination series" = TRUE (where "Vaccine type" = "BCG vaccines")
*/
define "One BCG dose from the primary series was administered. The primary series has been completed":
  Encounter."One BCG primary series dose was administered"


/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  case
    when Patient.id = 'BCG07.0126' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG08.0126' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG09.012346' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG10.012346' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG11.01234' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG12.0123' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG13.01256' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG14.01256' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG15.0125' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG16.0125' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG17.01234' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG18.01237' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG19.0123467' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG20.0123467' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG21.0123' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG22.01256' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG23.01256' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG24.0125' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG25.0125' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG26.01234' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG27.01237' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG28.0123467' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG29.0123467' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG30.0123' then "Bacille Calmette–Guérin (BCG) dose 1"
    when Patient.id = 'BCG31.0' then not "Bacille Calmette–Guérin (BCG) dose 1" 
      and "One BCG dose from the primary series was administered. The primary series has been completed"
    else 'No test case set'
  end
Content: application/elm+xml
Encoded data (104224 characters)