Title: IMMZD2DTDTPPregnantLogic Id: IMMZD2DTDTPPregnantLogic Version: 0.2.0 Url: IMMZD2DTDTPPregnantLogic Status: draft Experimental: true Type: system: http://terminology.hl7.org/CodeSystem/library-type code: logic-library Date: 2025-06-25 20:08:00+0000 Publisher: WHO Description: This library defines decision support logic for the IMMZ.D2.DT.DTP.Pregnancy decision table in the Immunization CPG Related Artifacts: Dependencies WHOCommon IMMZCommon WHOConcepts WHOElements IMMZD2DTDTPEncounterElements IMMZEncounterElements Parameters: Name Type Min Max In/Out Today date 0 1 In EncounterId string 0 1 In Patient Patient 0 1 Out Client should follow 'delayed or interrupted series' decision logic boolean 0 1 Out Client should follow 'delayed or interrupted series' decision logic Guidance string 0 1 Out Client should follow 'pregnancy starting with 3 doses' decision logic boolean 0 1 Out Client should follow 'pregnancy starting with 3 doses' decision logic Guidance string 0 1 Out Client should follow 'pregnancy starting with 4 doses' decision logic boolean 0 1 Out Client should follow 'pregnancy starting with 4 doses' decision logic Guidance string 0 1 Out Tetanus and diphtheria immunization schedule is complete Case 1 boolean 0 1 Out Tetanus and diphtheria immunization schedule is complete Case 2 boolean 0 1 Out Tetanus and diphtheria immunization schedule is complete boolean 0 1 Out Tetanus and diphtheria immunization schedule is complete Guidance string 0 1 Out Guidance string 0 1 Out Has Guidance boolean 0 1 Out Test Validation Resource 0 1 Out Content: text/cql /* * Library: IMMZD2DTDTPPregnantLogic (IMMZ.D2.DT.DTP.Pregnancy) * Rule: Determine if the client is due for a diphtheria–tetanus–pertussis (DTP) vaccination according to the national immunization schedule * Decision Table: Determine whether DTP-containing vaccines are needed for pregnant women * Trigger: IMMZ.D2 Determine required vaccination(s) if any */ library IMMZD2DTDTPPregnantLogic using FHIR version '4.0.1' include FHIRHelpers version '4.0.1' include WHOCommon called WC include IMMZCommon called IC include WHOConcepts called Concepts include WHOElements called WE include IMMZD2DTDTPEncounterElements called Encounter include IMMZEncounterElements called IE parameter Today Date default Today() parameter EncounterId String context Patient /* @dynamicValue: Guidance */ define "Guidance": case when "Client should follow 'delayed or interrupted series' decision logic" then "Client should follow 'delayed or interrupted series' decision logic Guidance" when "Client should follow 'pregnancy starting with 3 doses' decision logic" then "Client should follow 'pregnancy starting with 3 doses' decision logic Guidance" when "Client should follow 'pregnancy starting with 4 doses' decision logic" then "Client should follow 'pregnancy starting with 4 doses' decision logic Guidance" when "Tetanus and diphtheria immunization schedule is complete" then "Tetanus and diphtheria immunization schedule is complete Guidance" else '' end define "Has Guidance": "Guidance" is not null and "Guidance" != '' /* @output: Client should follow 'delayed or interrupted series' decision logic @pseudocode: */ define "Client should follow 'delayed or interrupted series' decision logic": Encounter."No DTP primary series doses were administered" and Encounter."Client is currently pregnant" /* @output: Client should follow 'delayed or interrupted series' decision logic Guidance @guidance: The client has a delayed start. Please follow the 'delayed or interrupted' schedule. */ define "Client should follow 'delayed or interrupted series' decision logic Guidance": 'The client has a delayed start. Please follow the \'delayed or interrupted\' schedule.' /* @output: Client should follow 'pregnancy starting with 3 doses' decision logic @pseudocode: */ define "Client should follow 'pregnancy starting with 3 doses' decision logic": Encounter."Three DTP primary series doses were administered" and Encounter."No tetanus and diphtheria booster dose was administered" and Encounter."Client is currently pregnant" /* @output: Client should follow 'pregnancy starting with 3 doses' decision logic Guidance @guidance: The client has received 3 tetanus-containing vaccine doses during childhood. Please follow the 'pregnancy starting with 3 doses' schedule. */ define "Client should follow 'pregnancy starting with 3 doses' decision logic Guidance": 'The client has received 3 tetanus-containing vaccine doses during childhood. Please follow the \'pregnancy starting with 3 doses\' schedule.' /* @output: Client should follow 'pregnancy starting with 4 doses' decision logic @pseudocode: */ define "Client should follow 'pregnancy starting with 4 doses' decision logic": Encounter."Three DTP primary series doses were administered" and Encounter."One tetanus and diphtheria booster dose was administered" and Encounter."Client is currently pregnant" /* @output: Client should follow 'pregnancy starting with 4 doses' decision logic Guidance @guidance: The client has received 4 tetanus-containing vaccines doses during childhood or pre-adulthood. Please follow the 'pregnancy starting with 4 doses' schedule. */ define "Client should follow 'pregnancy starting with 4 doses' decision logic Guidance": 'The client has received 4 tetanus-containing vaccines doses during childhood or pre-adulthood. Please follow the \'pregnancy starting with 4 doses\' schedule.' /* @output: Tetanus and diphtheria immunization schedule is complete Case 1 @pseudocode: "Immunization recommendation status" = "Complete" (where "Vaccine type" = "Tetanus and diphtheria-containing vaccines") */ define "Tetanus and diphtheria immunization schedule is complete Case 1": Encounter."Three DTP primary series doses were administered" and Encounter."Two tetanus and diphtheria booster doses were administered" /* @output: Tetanus and diphtheria immunization schedule is complete Case 2 @pseudocode: "Immunization recommendation status" = "Complete" (where "Vaccine type" = "Tetanus and diphtheria-containing vaccines") */ define "Tetanus and diphtheria immunization schedule is complete Case 2": Encounter."Three DTP primary series doses were administered" and Encounter."Three tetanus and diphtheria booster doses were administered" /* @output: Tetanus and diphtheria immunization schedule is complete @pseudocode: "Immunization recommendation status" = "Complete" (where "Vaccine type" = "Tetanus and diphtheria-containing vaccines") */ define "Tetanus and diphtheria immunization schedule is complete": "Tetanus and diphtheria immunization schedule is complete Case 1" or "Tetanus and diphtheria immunization schedule is complete Case 2" /* @output: Tetanus and diphtheria immunization schedule is complete Guidance @guidance: Tetanus and diphtheria immunization schedule is complete.Three DTP primary series doses and two tetanus and diphtheria booster doses were administered. There is no need for any additional tetanus and diphtheria doses. Check for any other vaccines due. @guidance: Tetanus and diphtheria immunization schedule is complete.Three DTP primary series doses and three tetanus and diphtheria booster doses were administered. There is no need for any additional tetanus and diphtheria doses. Check for any other vaccines due. */ define "Tetanus and diphtheria immunization schedule is complete Guidance": case when "Tetanus and diphtheria immunization schedule is complete Case 1" then 'Tetanus and diphtheria immunization schedule is complete.Three DTP primary series doses and two tetanus and diphtheria booster doses were administered. There is no need for any additional tetanus and diphtheria doses. Check for any other vaccines due.' when "Tetanus and diphtheria immunization schedule is complete Case 2" then 'Tetanus and diphtheria immunization schedule is complete.Three DTP primary series doses and three tetanus and diphtheria booster doses were administered. There is no need for any additional tetanus and diphtheria doses. Check for any other vaccines due.' else '' end /* @test: Test expected results based on example patients */ define "Test Validation": case when Patient.id = '54.DTP0PT' then "Client should follow 'delayed or interrupted series' decision logic" and "Guidance" = 'The client has a delayed start. Please follow the \'delayed or interrupted\' schedule.' when Patient.id = '55.DTP3Td0PT' then "Client should follow 'pregnancy starting with 3 doses' decision logic" and "Guidance" = 'The client has received 3 tetanus-containing vaccine doses during childhood. Please follow the \'pregnancy starting with 3 doses\' schedule.' when Patient.id = '56.DTP3Td1PT' then "Client should follow 'pregnancy starting with 4 doses' decision logic" and "Guidance" = 'The client has received 4 tetanus-containing vaccines doses during childhood or pre-adulthood. Please follow the \'pregnancy starting with 4 doses\' schedule.' when Patient.id = '57.DTP3Td2' then "Tetanus and diphtheria immunization schedule is complete Case 1" and "Guidance" = 'Tetanus and diphtheria immunization schedule is complete.Three DTP primary series doses and two tetanus and diphtheria booster doses were administered. There is no need for any additional tetanus and diphtheria doses. Check for any other vaccines due.' when Patient.id = '58.DTP3Td3' then "Tetanus and diphtheria immunization schedule is complete Case 2" and "Guidance" = 'Tetanus and diphtheria immunization schedule is complete.Three DTP primary series doses and three tetanus and diphtheria booster doses were administered. There is no need for any additional tetanus and diphtheria doses. Check for any other vaccines due.' else 'No test case set' end Content: application/elm+xml Encoded data (75248 characters)
This library defines decision support logic for the IMMZ.D2.DT.DTP.Pregnancy decision table in the Immunization CPG
Client should follow 'delayed or interrupted series' decision logic
Client should follow 'delayed or interrupted series' decision logic Guidance
Client should follow 'pregnancy starting with 3 doses' decision logic
Client should follow 'pregnancy starting with 3 doses' decision logic Guidance
Client should follow 'pregnancy starting with 4 doses' decision logic
Client should follow 'pregnancy starting with 4 doses' decision logic Guidance
Tetanus and diphtheria immunization schedule is complete Case 1
Tetanus and diphtheria immunization schedule is complete Case 2
Tetanus and diphtheria immunization schedule is complete
Tetanus and diphtheria immunization schedule is complete Guidance