Title: IMMZD2DTHepatitisBEncounterElements Id: IMMZD2DTHepatitisBEncounterElements Version: 0.2.0 Url: IMMZD2DTHepatitisBEncounterElements 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 encounter-based elements for Hepatitis B used throughout the Immunization CPG Related Artifacts: Dependencies WHOConcepts WHOCommon WHOElements IMMZCommon IMMZConcepts IMMZEncounterElements IMMZD2DTHepatitisBElements Parameters: Name Type Min Max In/Out Today date 0 1 In EncounterId string 0 1 In HepBBirthDoseAgeLimitDays integer 0 1 In HepBLowerLimitWeeks integer 0 1 In Patient Patient 0 1 Out Hepatitis B Doses Administered to Patient Immunization 0 * Out Hepatitis B Primary Series Doses Administered to Patient Immunization 0 * Out Number of Hepatitis B Primary Series Doses Administered integer 0 1 Out Hepatitis B Dose 0 Doses Administered to Patient Immunization 0 * Out Number of Hepatitis B Dose 0 Doses Administered integer 0 1 Out Hepatitis B birth dose was not administered boolean 0 1 Out Client's age is less than {Member States defined upper limit} boolean 0 1 Out Client's age is more than {Member States defined upper limit} boolean 0 1 Out Hepatitis B birth dose was administered boolean 0 1 Out No hepatitis B primary series doses were administered boolean 0 1 Out Client's age is less than {Member States defined lower limit} boolean 0 1 Out Client's age is more than or equal to {Member States defined lower limit} boolean 0 1 Out One hepatitis B primary series dose was administered boolean 0 1 Out Date of Latest Hepatitis B Dose date 0 1 Out The latest hepatitis B dose was administered less than 4 weeks ago boolean 0 1 Out The latest hepatitis B dose was administered more than 4 weeks ago boolean 0 1 Out Two hepatitis B primary series doses were administered boolean 0 1 Out Client's weight at birth was over 2000 g boolean 0 1 Out Client was not a premature infant at birth boolean 0 1 Out Client's weight at birth was below 2000 g boolean 0 1 Out Client was a premature infant at birth boolean 0 1 Out Three hepatitis B primary series doses were administered boolean 0 1 Out One hepatitis B primary series doses were administered boolean 0 1 Out Number of Hepatitis B Doses Administered integer 0 1 Out No hepatitis B doses were administered boolean 0 1 Out Client's age is more than {Member States defined lower limit} boolean 0 1 Out One hepatitis B dose was administered boolean 0 1 Out Two hepatitis B doses were administered boolean 0 1 Out Date of First Hepatitis B Dose date 0 1 Out The first hepatitis B dose was administered less than 6 months ago boolean 0 1 Out The first hepatitis B dose was administered more than 6 months ago boolean 0 1 Out Three hepatitis B doses were administered boolean 0 1 Out Content: text/cql /* * Library: IMMZD2DTHepatitisBEncounterElements */ library IMMZD2DTHepatitisBEncounterElements using FHIR version '4.0.1' include FHIRHelpers version '4.0.1' include WHOConcepts include WHOCommon called WC include WHOElements called WE include IMMZCommon called Common include IMMZConcepts called Concepts include IMMZEncounterElements called Encounter include IMMZD2DTHepatitisBElements called HepatitisBElements parameter Today Date default Today() parameter EncounterId String parameter HepBBirthDoseAgeLimitDays Integer default 1 parameter HepBLowerLimitWeeks Integer default 4 context Patient /* @internal: Hepatitis B containing Doses Administered to Patient */ define "Hepatitis B Doses Administered to Patient": HepatitisBElements."Hepatitis B Doses Administered to Patient".onOrBefore(Today) /* @internal: Hepatitis B containing Doses Administered to Patient that are in the Primary series */ define "Hepatitis B Primary Series Doses Administered to Patient": HepatitisBElements."Hepatitis B Primary Series Doses Administered to Patient".onOrBefore(Today) /* @internal: Number of Hepatitis B Primary Series doses */ define "Number of Hepatitis B Primary Series Doses Administered": Count("Hepatitis B Primary Series Doses Administered to Patient") /* @input: Hepatitis B birth dose was not administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Birth dose" = TRUE) = 0 @code: Hepatitis B birth dose was not administered-117 @decision: IMMZ.D2.DT.Hepatitis B.Birth dose: Birth dose administration */ define "Hepatitis B birth dose was not administered": "Number of Hepatitis B Dose 0 Doses Administered" = 0 /* @input: Client's age is less than {Member States defined upper limit} @pseudocode: Today's date − "Date of birth" < Member States defined upper limit @code: Client's age is less than {Member States defined upper limit}-66 @decision: IMMZ.D2.DT.Hepatitis B.Birth dose: Birth dose administration */ define "Client's age is less than {Member States defined upper limit}": Encounter."Current Patient Age In Days" < HepBBirthDoseAgeLimitDays /* @input: Client's age is more than {Member States defined upper limit} @pseudocode: Today's date - "Date of birth" > Member States defined upper limit @code: Client's age is more than {Member States defined upper limit}-66 @decision: IMMZ.D2.DT.Hepatitis B.Birth dose: Birth dose administration */ define "Client's age is more than {Member States defined upper limit}": Encounter."Current Patient Age In Days" >= HepBBirthDoseAgeLimitDays /* @input: Hepatitis B birth dose was administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Birth dose" = TRUE) = 1 @code: Hepatitis B birth dose was administered-117 @decision: IMMZ.D2.DT.Hepatitis B.Birth dose: Birth dose administration */ define "Hepatitis B birth dose was administered": "Number of Hepatitis B Dose 0 Doses Administered" = 1 /* @input: No hepatitis B primary series doses were administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines"and "Type of dose" = "Primary series") = 0 @code: No hepatitis B primary series doses were administered-130 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start */ define "No hepatitis B primary series doses were administered": "Number of Hepatitis B Primary Series Doses Administered" = 0 /* @input: Client's age is less than {Member States defined lower limit} @pseudocode: Today's date − "Date of birth" < Member States defined lower limit @code: Client's age is less than {Member States defined lower limit}-66 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start */ define "Client's age is less than {Member States defined lower limit}": Encounter."Current Patient Age In Weeks" < HepBLowerLimitWeeks /* @input: Client's age is more than or equal to {Member States defined lower limit} @pseudocode: Today's date − "Date of birth" ≥ Member States defined lower limit @code: Client's age is more than or equal to {Member States defined lower limit}-66 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start */ define "Client's age is more than or equal to {Member States defined lower limit}": Encounter."Current Patient Age In Weeks" >= HepBLowerLimitWeeks /* @input: One hepatitis B primary series dose was administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Type of dose" = "Primary series") = 1 @code: One hepatitis B primary series dose was administered-131 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start */ define "One hepatitis B primary series dose was administered": "Number of Hepatitis B Primary Series Doses Administered" = 1 /* @input: The latest hepatitis B dose was administered less than 4 weeks ago @pseudocode: Today's date − latest "Date and time of vaccination" (where "Vaccine type" = "Hepatitis B-containing vaccines") < 4 weeks @code: The latest hepatitis B dose was administered less than 4 weeks ago-121 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "The latest hepatitis B dose was administered less than 4 weeks ago": "Date of Latest Hepatitis B Dose" is not null and duration in weeks between "Date of Latest Hepatitis B Dose" and Today < 4 /* @input: The latest hepatitis B dose was administered more than 4 weeks ago @pseudocode: Today's date − latest "Date and time of vaccination" (where "Vaccine type" = "Hepatitis B-containing vaccines") ≥ 4 weeks @code: The latest hepatitis B dose was administered more than 4 weeks ago-121 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "The latest hepatitis B dose was administered more than 4 weeks ago": not("The latest hepatitis B dose was administered less than 4 weeks ago") /* @input: Two hepatitis B primary series doses were administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Type of dose" = "Primary series") = 2 @code: Two hepatitis B primary series doses were administered-131 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start */ define "Two hepatitis B primary series doses were administered": "Number of Hepatitis B Primary Series Doses Administered" = 2 /* @input: Client's weight at birth was over 2000 g @pseudocode: "Birth weight in grams" ≥ 2000 @code: Client's weight at birth was over 2000 g-30 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start */ define "Client's weight at birth was over 2000 g": Encounter."Client's weight at birth was over 2000 g" /* @input: Client was not a premature infant at birth @pseudocode: "Preterm birth" ≠ TRUE @code: Client was not a premature infant at birth-22 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start */ define "Client was not a premature infant at birth": Encounter."Client was not a premature infant at birth" /* @input: Client's weight at birth was below 2000 g @pseudocode: "Birth weight in grams" < 2000 @code: Client's weight at birth was below 2000 g-30 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start */ define "Client's weight at birth was below 2000 g": Encounter."Client's weight at birth was below 2000 g" /* @input: Client was a premature infant at birth @pseudocode: "Preterm birth" = TRUE @code: Client was a premature infant at birth-22 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start */ define "Client was a premature infant at birth": Encounter."Client was a premature infant at birth" /* @input: Three hepatitis B primary series doses were administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Type of dose" = "Primary series") = 3 @code: Three hepatitis B primary series doses were administered-131 @decision: IMMZ.D2.DT.Hepatitis B.3 doses: 3-dose schedule (birth dose + 2 primary series doses), on-time start @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start */ define "Three hepatitis B primary series doses were administered": "Number of Hepatitis B Primary Series Doses Administered" = 3 /* @input: One hepatitis B primary series doses were administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Type of dose" = "Primary series") = 1 @code: One hepatitis B primary series doses were administered-131 @decision: IMMZ.D2.DT.Hepatitis B.4 doses: 4-dose schedule (birth dose + 3 primary series doses), on-time start */ define "One hepatitis B primary series doses were administered": "One hepatitis B primary series dose was administered" /* @input: No hepatitis B doses were administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines") = 0 @code: No hepatitis B doses were administered-93 @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "No hepatitis B doses were administered": "Number of Hepatitis B Doses Administered" = 0 /* @input: Client's age is more than {Member States defined lower limit} @pseudocode: Today's date − "Date of birth" > Member States defined lower limit @code: Client's age is more than {Member States defined lower limit}-66 @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "Client's age is more than {Member States defined lower limit}": Encounter."Current Patient Age In Days" >= HepBBirthDoseAgeLimitDays /* @input: One hepatitis B dose was administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines") = 1 @code: One hepatitis B dose was administered-93 @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "One hepatitis B dose was administered": "Number of Hepatitis B Doses Administered" = 1 /* @input: Two hepatitis B doses were administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines") = 2 @code: Two hepatitis B doses were administered-93 @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "Two hepatitis B doses were administered": "Number of Hepatitis B Doses Administered" = 2 /* @input: The first hepatitis B dose was administered less than 6 months ago @pseudocode: Today's date − "Date and time of vaccination" (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Dose number" = 1) < 6 months @code: The first hepatitis B dose was administered less than 6 months ago-137 @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "The first hepatitis B dose was administered less than 6 months ago": "Date of First Hepatitis B Dose" is not null and duration in months between "Date of First Hepatitis B Dose" and Today < 6 /* @input: The first hepatitis B dose was administered more than 6 months ago @pseudocode: Today's date − "Date and time of vaccination" (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Dose number" = 1) ≥ 6 months @code: The first hepatitis B dose was administered more than 6 months ago-137 @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "The first hepatitis B dose was administered more than 6 months ago": not("The first hepatitis B dose was administered less than 6 months ago") /* @input: Three hepatitis B doses were administered @pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines") = 3 @code: Three hepatitis B doses were administered-93 @decision: IMMZ.D2.DT.Hepatitis B.Delayed start: 3-dose schedule (no birth dose + 3 doses), delayed start */ define "Three hepatitis B doses were administered": "Number of Hepatitis B Doses Administered" = 3 /* @internal: Date of Latest Hepatitis B Dose */ define "Date of Latest Hepatitis B Dose": date from start of "Hepatitis B Doses Administered to Patient".mostRecent().occurrence.toInterval() /* @internal: Date of First Hepatitis B Dose */ define "Date of First Hepatitis B Dose": date from start of "Hepatitis B Doses Administered to Patient".earliest().occurrence.toInterval() /* @internal: Hepatitis B Dose 0 Doses Administered to Patient */ define "Hepatitis B Dose 0 Doses Administered to Patient": HepatitisBElements."Hepatitis B Dose 0 Doses Administered to Patient".onOrBefore(Today) /* @internal: Number of Hepatitis B Dose 0 Doses Administered */ define "Number of Hepatitis B Dose 0 Doses Administered": Count("Hepatitis B Dose 0 Doses Administered to Patient") /* @internal: Number of Hepatitis B Doses Administered */ define "Number of Hepatitis B Doses Administered": Count("Hepatitis B Doses Administered to Patient") Content: application/elm+xml Encoded data (97892 characters)
This library defines encounter-based elements for Hepatitis B used throughout the Immunization CPG
Hepatitis B Doses Administered to Patient
Hepatitis B Primary Series Doses Administered to Patient
Number of Hepatitis B Primary Series Doses Administered
Hepatitis B Dose 0 Doses Administered to Patient
Number of Hepatitis B Dose 0 Doses Administered
Hepatitis B birth dose was not administered
Client's age is less than {Member States defined upper limit}
Client's age is more than {Member States defined upper limit}
No hepatitis B primary series doses were administered
Client's age is less than {Member States defined lower limit}
Client's age is more than or equal to {Member States defined lower limit}
One hepatitis B primary series dose was administered
The latest hepatitis B dose was administered less than 4 weeks ago
The latest hepatitis B dose was administered more than 4 weeks ago
Two hepatitis B primary series doses were administered
Client's weight at birth was over 2000 g
Client was not a premature infant at birth
Client's weight at birth was below 2000 g
Three hepatitis B primary series doses were administered
One hepatitis B primary series doses were administered
Number of Hepatitis B Doses Administered
Client's age is more than {Member States defined lower limit}
The first hepatitis B dose was administered less than 6 months ago
The first hepatitis B dose was administered more than 6 months ago
Three hepatitis B doses were administered