Title: IMMZD18STyphoidTy21aLogic Id: IMMZD18STyphoidTy21aLogic Version: 0.2.0 Url: IMMZD18STyphoidTy21aLogic 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.D18.S.Typhoid.Ty21a schedule table in the Immunization CPG Related Artifacts: Dependencies WHOCommon IMMZCommon IMMZConcepts IMMZEncounterElements IMMZD2DTTyphoidEncounterElements Parameters: Name Type Min Max In/Out Today date 0 1 In Patient Patient 0 1 Out The primary series has been completed boolean 0 1 Out Typhoid Ty21a primary series boolean 0 1 Out Typhoid Ty21a primary series Due Date date 0 1 Out Typhoid Ty21a primary series Create string 0 1 Out Typhoid Ty21a primary series Overdue Resource 0 1 Out Typhoid Ty21a primary series Expiration Resource 0 1 Out Typhoid booster dose(s) repeat 3-doses series boolean 0 1 Out Typhoid booster dose(s) repeat 3-doses series Due Date date 0 1 Out Typhoid booster dose(s) repeat 3-doses series Overdue date 0 1 Out Typhoid booster dose(s) repeat 3-doses series Create string 0 1 Out Typhoid booster dose(s) repeat 3-doses series Expiration Resource 0 1 Out The booster series has been completed boolean 0 1 Out Test Validation Resource 0 1 Out Content: text/cql /* * Library: IMMZD18STyphoidTy21aLogic (IMMZ.D18.S.Typhoid.Ty21a schedule) * Schedule Table: Live attenuated Ty21a vaccine, 3-dose schedule */ library IMMZD18STyphoidTy21aLogic 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 IMMZD2DTTyphoidEncounterElements called Encounter parameter Today Date default Today() context Patient /* @output: Typhoid Ty21a primary series @description: Provision of the typhoid Ty21a, 3-dose oral primary series immunization @trigger: Child's birth @pseudo: @triggerDate: "Date of birth" */ define "Typhoid Ty21a primary series": Encounter."No typhoid primary series doses were administered" and not "The primary series has been completed" /* @output: Typhoid Ty21a primary series Create @create: Ty21a – 3-doses to be administered orally every second day from 6 years of age. */ define "Typhoid Ty21a primary series Create": if "Typhoid Ty21a primary series" then 'Ty21a – 3-doses to be administered orally every second day from 6 years of age.' + ' Due Date: ' + ToString("Typhoid Ty21a primary series Due Date") else '' /* @dynamicValue: Typhoid Ty21a primary series Due Date @pseudocode: "Date of birth" + 6 years */ define "Typhoid Ty21a primary series Due Date": if "Typhoid Ty21a primary series" then Patient.birthDate + 6 years else null /* @dynamicValue: Typhoid Ty21a primary series Overdue @pseudocode: To be determined by Member States; however, there is no recommended overdue date and individuals are always eligible to be vaccinated. */ define "Typhoid Ty21a primary series Overdue": null /* @dynamicValue: Typhoid Ty21a primary series Expiration @pseudocode: To be determined by Member States; however, there is no recommended expiration date and individuals are always eligible to be vaccinated. */ define "Typhoid Ty21a primary series Expiration": null /* @complete: The primary series has been completed @pseudocode: "Completed the primary vaccination series" = TRUE (where "Vaccine type" = "Typhoid vaccines") */ define "The primary series has been completed": Encounter."Primary series is complete" /* @output: Typhoid booster dose(s) repeat 3-doses series @description: Provision of the typhoid booster dose(s): revaccination @trigger: The primary series has been completed @pseudo: "Completed the primary vaccination series" = TRUE (where "Vaccine type" = "Typhoid vaccines") @triggerDate: Latest "Date and time of vaccination" (where "Vaccine type" = "Typhoid vaccines") */ define "Typhoid booster dose(s) repeat 3-doses series": "The primary series has been completed" /* @output: Typhoid booster dose(s) repeat 3-doses series Create @create: Revaccination (3-doses) is recommended every 3–7 years for Ty21a. */ define "Typhoid booster dose(s) repeat 3-doses series Create": if "Typhoid booster dose(s) repeat 3-doses series" then 'Revaccination (3-doses) is recommended every 3–7 years for Ty21a.' + ' Due Date: ' + ToString("Typhoid booster dose(s) repeat 3-doses series Due Date") + ' Overdue: ' + ToString("Typhoid booster dose(s) repeat 3-doses series Overdue") else '' /* @dynamicValue: Typhoid booster dose(s) repeat 3-doses series Due Date @pseudocode: Latest "Date and time of vaccination" (where "Vaccine type" = "Typhoid vaccines") + 3 years */ define "Typhoid booster dose(s) repeat 3-doses series Due Date": if "Typhoid booster dose(s) repeat 3-doses series" then Encounter."Date of Latest Typhoid Dose" + 3 years else null /* @dynamicValue: Typhoid booster dose(s) repeat 3-doses series Overdue @pseudocode: Latest "Date and time of vaccination" (where "Vaccine type" = "Typhoid vaccines") + 7 years */ define "Typhoid booster dose(s) repeat 3-doses series Overdue": if "Typhoid booster dose(s) repeat 3-doses series" then Encounter."Date of Latest Typhoid Dose" + 7 years else null /* @dynamicValue: Typhoid booster dose(s) repeat 3-doses series Expiration @pseudocode: To be determined by Member States; however, there is no recommended expiration date and individuals are always eligible to be vaccinated. */ define "Typhoid booster dose(s) repeat 3-doses series Expiration": null /* @complete: The booster series has been completed @pseudocode: "Completed the booster series" = TRUE (where "Vaccine type" = "Typhoid vaccines") */ define "The booster series has been completed": Encounter."Date of Latest Typhoid Dose" is not null and duration in years between Encounter."Date of Latest Typhoid Dose" and Today < 3 /* @test: Test expected results based on example patients */ define "Test Validation": case when Patient.id = 'Typhoid30.1' then "Typhoid Ty21a primary series" when Patient.id = 'Typhoid31.3' then "Typhoid Ty21a primary series" when Patient.id = 'Typhoid32.3' then "Typhoid Ty21a primary series" when Patient.id = 'Typhoid33.3' then "Typhoid booster dose(s) repeat 3-doses series" when Patient.id = 'Typhoid34.4' then "Typhoid booster dose(s) repeat 3-doses series" when Patient.id = 'Typhoid35.4' then "Typhoid booster dose(s) repeat 3-doses series" else 'No test case set' end Content: application/elm+xml Encoded data (64040 characters)
This library defines decision support logic for the IMMZ.D18.S.Typhoid.Ty21a schedule table in the Immunization CPG
Typhoid booster dose(s) repeat 3-doses series
Typhoid booster dose(s) repeat 3-doses series Due Date
Typhoid booster dose(s) repeat 3-doses series Overdue
Typhoid booster dose(s) repeat 3-doses series Create
Typhoid booster dose(s) repeat 3-doses series Expiration