{
  "resourceType": "Library",
  "id": "IMMZD18SHepatitisB3DosesLogic",
  "meta": {
    "profile": [
      "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary",
      "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary",
      "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library",
      "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-module"
    ]
  },
  "text": {
    "status": "extensions",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b style=\"color: maroon\">Exception parsing generated Narrative (see /tmp/liquid-ca89c321-aef6-4784-b471-caac5bc580df.html): Unable to Parse HTML - node 'code' has unexpected content ' ' (last text = '/*\n * Library: IMMZD18SHepatitisB3DosesLogic (IMMZ.D18.S.Hepatitis B.3-dose schedule)\n * Schedule Table: 3-dose schedule (birth dose + 2 primary series doses), on-time start\n */\nlibrary IMMZD18SHepatitisB3DosesLogic\n\nusing FHIR version '4.0.1'\ninclude FHIRHelpers version '4.0.1'\n\ninclude WHOCommon called WC\n\ninclude IMMZCommon called Common\ninclude IMMZConcepts called Concepts\n\ninclude IMMZEncounterElements called IE\ninclude IMMZD2DTHepatitisBEncounterElements called Encounter\n\nparameter Today Date default Today()\n\n\ncontext Patient\n\n\n/*\n@output: Hepatitis B dose 1\n@description: Provision of hepatitis B dose 1\n@trigger: Child's birth\n@pseudo: \n@triggerDate: &quot;Date of birth&quot;\n*/\ndefine &quot;Hepatitis B dose 1&quot;:\n  not &quot;First hepatitis B dose from the primary series was administered&quot;\n    and not &quot;Second hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was over 2000 g and was not a premature infant&quot;\n    and not &quot;Third hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was less than 2000 g and was a premature infant&quot;\n\n\n/*\n@output: Hepatitis B dose 1 Create\n@create: The following option is considered appropriate: a 3-dose schedule with the first dose (monovalent) being given at birth and the second and third (monovalent or as part of a combined vaccine) given at the same time as the first and third doses of DTP-containing vaccine.\nThe interval between doses should be at least 4 weeks.\n*/\ndefine &quot;Hepatitis B dose 1 Create&quot;:\n  if &quot;Hepatitis B dose 1&quot;\n  then 'The following option is considered appropriate: a 3-dose schedule with the first dose (monovalent) being given at birth and the second and third (monovalent or as part of a combined vaccine) given at the same time as the first and third doses of DTP-containing vaccine.\nThe interval between doses should be at least 4 weeks.' + '\nDue Date: ' + ToString(&quot;Hepatitis B dose 1 Due Date&quot;)\n  else ''\n\n\n/*\n@dynamicValue: Hepatitis B dose 1 Due Date\n@pseudocode: &quot;Date of birth&quot; + Member States defined lower limit\n*/\ndefine &quot;Hepatitis B dose 1 Due Date&quot;:\n  if &quot;Hepatitis B dose 1&quot; then Patient.birthDate + (Encounter.HepBLowerLimitWeeks * 1 weeks)\n  else null\n\n\n/*\n@dynamicValue: Hepatitis B dose 1 Overdue\n@pseudocode: To be determined by Member States; however, there is no recommended overdue date.\n*/\ndefine &quot;Hepatitis B dose 1 Overdue&quot;:\n  null\n\n\n/*\n@dynamicValue: Hepatitis B dose 1 Expiration\n@pseudocode: To be determined by Member States; however, there is no recommended expiration date and individuals are always eligible to be vaccinated.\n*/\ndefine &quot;Hepatitis B dose 1 Expiration&quot;:\n  null\n\n  \n/*\n@complete: First hepatitis B dose from the primary series was administered\n@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;Hepatitis B-containing vaccines&quot; and &quot;Type of dose&quot;= &quot;Primary series&quot;) = 1\n*/\ndefine &quot;First hepatitis B dose from the primary series was administered&quot;:\n  Encounter.&quot;One hepatitis B primary series dose was administered&quot;\n\n\n\n/*\n@output: Hepatitis B dose 2\n@description: Provision of hepatitis B dose 2\n@trigger: First hepatitis B dose from the primary series was administered\n@pseudo: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;Hepatitis B-containing vaccines&quot; and &quot;Type of dose&quot;= &quot;Primary series&quot;) = 1\n@triggerDate: Latest &quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;Hepatitis B-containing vaccines&quot;)\n*/\ndefine &quot;Hepatitis B dose 2&quot;:\n  &quot;First hepatitis B dose from the primary series was administered&quot;\n    and not &quot;Second hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was over 2000 g and was not a premature infant&quot;\n    and not &quot;Third hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was less than 2000 g and was a premature infant&quot;\n\n\n/*\n@output: Hepatitis B dose 2 Create\n@create: The following option is considered appropriate: a 3-dose schedule with the first dose (monovalent) being given at birth and the second and third (monovalent or as part of a combined vaccine) given at the same time as the first and third doses of DTP-containing vaccine.\nThe interval between doses should be at least 4 weeks.\n*/\ndefine &quot;Hepatitis B dose 2 Create&quot;:\n  if &quot;Hepatitis B dose 2&quot;\n  then 'The following option is considered appropriate: a 3-dose schedule with the first dose (monovalent) being given at birth and the second and third (monovalent or as part of a combined vaccine) given at the same time as the first and third doses of DTP-containing vaccine.\nThe interval between doses should be at least 4 weeks.' + '\nDue Date: ' + ToString(&quot;Hepatitis B dose 2 Due Date&quot;)\n  else ''\n\n\n/*\n@dynamicValue: Hepatitis B dose 2 Due Date\n@pseudocode: Latest &quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;Hepatitis B-containing vaccines&quot;) + 4 weeks\n*/\ndefine &quot;Hepatitis B dose 2 Due Date&quot;:\n  if &quot;Hepatitis B dose 2&quot; then Encounter.&quot;Date of Latest Hepatitis B Dose&quot; + 4 weeks\n  else null\n\n\n/*\n@dynamicValue: Hepatitis B dose 2 Overdue\n@pseudocode: To be determined by Member States; however, there is no recommended overdue date.\n*/\ndefine &quot;Hepatitis B dose 2 Overdue&quot;:\n  null\n\n\n/*\n@dynamicValue: Hepatitis B dose 2 Expiration\n@pseudocode: To be determined by Member States; however, there is no recommended expiration date and individuals are always eligible to be vaccinated.\n*/\ndefine &quot;Hepatitis B dose 2 Expiration&quot;:\n  null\n\n  \n/*\n@complete: Second hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was over 2000 g and was not a premature infant\n@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;Hepatitis B-containing vaccines&quot; and &quot;Type of dose&quot;= &quot;Primary series&quot;) = 2\n&quot;Completed the primary vaccination series&quot; = TRUE (where &quot;Vaccine type&quot; = &quot;Hepatitis B-containing vaccines&quot;)\n*/\ndefine &quot;Second hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was over 2000 g and was not a premature infant&quot;:\n  Encounter.&quot;Two hepatitis B primary series doses were administered&quot;\n\n\n\n/*\n@output: Hepatitis B dose 3\n@description: Provision of hepatitis B dose 3 for low-birth-weight and premature infants\n@trigger: Second hepatitis B dose from the primary series was administered. Client's weight at birth was less than 2000 g or client was a premature infant\n@pseudo: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;Hepatitis B-containing vaccines&quot;) = 2 and (&quot;Birth weight in grams&quot; ' at line 356 column 134</b></p></div>"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/cqf-knowledgeCapability",
      "valueCode": "computable"
    }
  ],
  "url": "http://smart.who.int/immunizations/Library/IMMZD18SHepatitisB3DosesLogic",
  "version": "1.0.0",
  "name": "IMMZD18SHepatitisB3DosesLogic",
  "title": "IMMZD18SHepatitisB3DosesLogic",
  "status": "draft",
  "experimental": false,
  "type": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/library-type",
        "code": "logic-library"
      }
    ]
  },
  "date": "2026-10-02T09:24:37+00:00",
  "publisher": "WHO",
  "contact": [
    {
      "name": "WHO",
      "telecom": [
        {
          "system": "url",
          "value": "http://who.int"
        }
      ]
    }
  ],
  "description": "This library defines decision support logic for the IMMZ.D18.S.Hepatitis B.3-dose schedule table in the Immunization CPG",
  "relatedArtifact": [
    {
      "type": "depends-on",
      "display": "Library WC",
      "resource": "http://smart.who.int/immunizations/Library/WHOCommon"
    },
    {
      "type": "depends-on",
      "display": "Library Common",
      "resource": "http://smart.who.int/immunizations/Library/IMMZCommon"
    },
    {
      "type": "depends-on",
      "display": "Library Concepts",
      "resource": "http://smart.who.int/immunizations/Library/IMMZConcepts"
    },
    {
      "type": "depends-on",
      "display": "Library IE",
      "resource": "http://smart.who.int/immunizations/Library/IMMZEncounterElements"
    },
    {
      "type": "depends-on",
      "display": "Library Encounter",
      "resource": "http://smart.who.int/immunizations/Library/IMMZD2DTHepatitisBEncounterElements"
    }
  ],
  "parameter": [
    {
      "name": "Today",
      "use": "in",
      "min": 0,
      "max": "1",
      "type": "date"
    },
    {
      "name": "Patient",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Patient"
    },
    {
      "name": "First hepatitis B dose from the primary series was administered",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Second hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was over 2000 g and was not a premature infant",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Third hepatitis B dose from the primary series was administered. The primary series has been completed for client whose weight at birth was less than 2000 g and was a premature infant",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Hepatitis B dose 1",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Hepatitis B dose 1 Due Date",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "date"
    },
    {
      "name": "Hepatitis B dose 1 Create",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "string"
    },
    {
      "name": "Hepatitis B dose 1 Overdue",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Resource"
    },
    {
      "name": "Hepatitis B dose 1 Expiration",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Resource"
    },
    {
      "name": "Hepatitis B dose 2",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Hepatitis B dose 2 Due Date",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "date"
    },
    {
      "name": "Hepatitis B dose 2 Create",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "string"
    },
    {
      "name": "Hepatitis B dose 2 Overdue",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Resource"
    },
    {
      "name": "Hepatitis B dose 2 Expiration",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Resource"
    },
    {
      "name": "Hepatitis B dose 3",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Hepatitis B dose 3 Due Date",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "date"
    },
    {
      "name": "Hepatitis B dose 3 Create",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "string"
    },
    {
      "name": "Hepatitis B dose 3 Overdue",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Resource"
    },
    {
      "name": "Hepatitis B dose 3 Expiration",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Resource"
    },
    {
      "name": "Test Validation",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Resource"
    }
  ],
  "content": [
    {
      "contentType": "text/cql",
      "url": "Library-IMMZD18SHepatitisB3DosesLogic.cql"
    },
    {
      "contentType": "application/elm+xml",
      "url": "Library-IMMZD18SHepatitisB3DosesLogic.elm.xml"
    }
  ]
}
