{
  "resourceType": "Library",
  "id": "IMMZEncounterElements",
  "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-68e68cea-5840-42b9-b969-0215a66f5db1.html): Unable to Parse HTML - node 'code' has unexpected content ' ' (last text = 'library IMMZEncounterElements\n\nusing FHIR version '4.0.1'\n\ninclude FHIRHelpers version '4.0.1'\n\ninclude WHOConcepts\ninclude WHOCommon called WC\ninclude WHOEncounterElements called WE\n\ninclude IMMZConcepts called Concepts\ninclude IMMZCommon called Common\ninclude IMMZElements called Elements\n\nparameter Today Date default Today()\nparameter EncounterId String\n\ncontext Patient\n\n/**\n * @dataElement All Doses Administered to Patient\n */\ndefine &quot;Doses Administered to Patient&quot;:\n  Elements.&quot;Doses Administered to Patient&quot; I\n    where I.occurrence.toInterval() same day or before Today\n\n/*\n@dataElement: Draft Medication Request for Patient\n*/\ndefine &quot;Draft Medication Request for Patient&quot;:\n  Elements.&quot;Draft Medication Request for Patient&quot; MR\n    where MR.encounter.references(EncounterId) \n      or MR.authoredOn.toInterval() same day or before Today\n  \tsort by date from (authoredOn as FHIR.dateTime) desc\n\n/*\n@dataElement Live attenuated vaccines\n*/\ndefine &quot;Live Attenuated Vaccines&quot;:\n  Elements.&quot;Live Attenuated Vaccines&quot; I\n    where I.occurrence.toInterval() same day or before Today\n\n/*\n@dataElement Date and time of last live attenuated vaccine\n*/\ndefine &quot;Date of Latest Live Attenuated Vaccine&quot;:\n  date from start of &quot;Live Attenuated Vaccines&quot;.mostRecent().occurrence.toInterval()\n  \n/** \n * @dataElement Patient age in years\n */\ndefine &quot;Current Patient Age In Years&quot;:\n  AgeInYearsAt(Today)\n\n/** \n * @dataElement Patient age in months\n */\ndefine &quot;Current Patient Age In Months&quot;:\n  AgeInMonthsAt(Today)\n\n/** \n * @dataElement Patient age in weeks\n */\ndefine &quot;Current Patient Age In Weeks&quot;:\n  AgeInWeeksAt(Today)\n\n/** \n * @dataElement Patient age in days\n */\ndefine &quot;Current Patient Age In Days&quot;:\n  AgeInDaysAt(Today)\n\n/*\n@input: No live vaccine was administered\n@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Live vaccine&quot; = TRUE) IS NULL\n*/\ndefine &quot;No live vaccine was administered&quot;:\n  not exists(&quot;Live Attenuated Vaccines&quot;)\n\n/*\n@input: Live vaccine was administered in the last 4 weeks\n@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Live vaccine&quot; = TRUE) ' at line 529 column 98</b></p></div>"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/cqf-knowledgeCapability",
      "valueCode": "computable"
    }
  ],
  "url": "http://smart.who.int/immunizations/Library/IMMZEncounterElements",
  "version": "1.0.0",
  "name": "IMMZEncounterElements",
  "title": "IMMZEncounterElements",
  "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 encounter-based elements used throughout the Immunization CPG",
  "relatedArtifact": [
    {
      "type": "depends-on",
      "display": "Library WHOConcepts",
      "resource": "http://smart.who.int/immunizations/Library/WHOConcepts"
    },
    {
      "type": "depends-on",
      "display": "Library WC",
      "resource": "http://smart.who.int/immunizations/Library/WHOCommon"
    },
    {
      "type": "depends-on",
      "display": "Library WE",
      "resource": "http://smart.who.int/immunizations/Library/WHOEncounterElements"
    },
    {
      "type": "depends-on",
      "display": "Library Concepts",
      "resource": "http://smart.who.int/immunizations/Library/IMMZConcepts"
    },
    {
      "type": "depends-on",
      "display": "Library Common",
      "resource": "http://smart.who.int/immunizations/Library/IMMZCommon"
    },
    {
      "type": "depends-on",
      "display": "Library Elements",
      "resource": "http://smart.who.int/immunizations/Library/IMMZElements"
    }
  ],
  "parameter": [
    {
      "name": "Today",
      "use": "in",
      "min": 0,
      "max": "1",
      "type": "date"
    },
    {
      "name": "EncounterId",
      "use": "in",
      "min": 0,
      "max": "1",
      "type": "string"
    },
    {
      "name": "Patient",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Patient"
    },
    {
      "name": "Doses Administered to Patient",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Immunization"
    },
    {
      "name": "Draft Medication Request for Patient",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "MedicationRequest"
    },
    {
      "name": "Live Attenuated Vaccines",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Immunization"
    },
    {
      "name": "Date of Latest Live Attenuated Vaccine",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "date"
    },
    {
      "name": "Current Patient Age In Years",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "integer"
    },
    {
      "name": "Current Patient Age In Months",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "integer"
    },
    {
      "name": "Current Patient Age In Weeks",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "integer"
    },
    {
      "name": "Current Patient Age In Days",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "integer"
    },
    {
      "name": "No live vaccine was administered",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Live vaccine was administered in the last 4 weeks",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "No live vaccine was administered in the last 4 weeks",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Currently pregnant Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Currently pregnant Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is pregnant",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI History of anaphylactic reactions Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI History of anaphylactic reactions Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has history of anaphylactic reactions",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Severe allergic reactions Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Severe allergic reactions Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has history of severe allergic reactions",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Severely immunocompromised Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Severely immunocompromised Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is severely immunocompromised",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Severely immunosuppressed Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Severely immunosuppressed Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is severely immunosuppressed",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Symptomatic HIV infection Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Symptomatic HIV infection Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has a symptomatic HIV infection",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Immunodeficiency syndromes Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Immunodeficiency syndromes Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has immunodeficiency syndromes",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Exposed to immunosuppressive treatment Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Exposed to immunosuppressive treatment Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is exposed to immunosuppressive treatment",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Severe acute illness Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Severe acute illness Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client currently has a severe acute illness",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Prior history of intussusception Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Prior history of intussusception Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has prior history of intussusception",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Altered immunocompetence Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Altered immunocompetence Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has altered immunocompetence",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Spina bifida Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Spina bifida Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has spina bifida",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Bladder exstrophy Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Bladder exstrophy Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has bladder exstrophy",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Immunocompromised Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Client is immunocompromised",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Immunocompromised Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Immunocompromised Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is immunocompromised",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Planning to get pregnant in the next month Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Planning to get pregnant in the next month Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is planning to get pregnant in next month",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Receiving blood products Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Receiving blood products Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is receiving blood products",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI TB disease Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI TB disease Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has TB disease",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Breastfeeding Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Breastfeeding Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is lactating",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Acute gastroenteritis Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Acute gastroenteritis Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has acute gastroenteritis",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Moderate to severe fever Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Moderate to severe fever Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has moderate to severe fever",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Hypersensitivity to vaccine components Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Hypersensitivity to vaccine components Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has hypersensitivity to any component of the vaccine",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Taking antibiotics Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Taking antibiotics Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client is currently taking antibiotics",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "CI Chronic gastrointestinal disease Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "CI Chronic gastrointestinal disease Condition",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Condition"
    },
    {
      "name": "The client has chronic gastrointestinal disease",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client's HIV status is positive",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client's HIV status is negative or unknown",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Currently on ART Observation",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Observation"
    },
    {
      "name": "Client is currently receiving antiretroviral therapy",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client is currently not receiving antiretroviral therapy",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Immunologically stable Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Client is immunologically stable",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client is not immunologically stable",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "TB infection test result Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Client's TB infection test result is negative",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client's TB infection test result is positive",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client's TB infection test result is unknown (test not done or no result yet)",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Clinically well Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Client is not clinically well",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client is clinically well",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client is not immunocompromised",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Birth weight in grams Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Birth weight in grams Value",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "Quantity"
    },
    {
      "name": "Birth weight in grams",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "decimal"
    },
    {
      "name": "Client's weight at birth was over 2000 g",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client's weight at birth was below 2000 g",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Preterm birth Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Client was a premature infant at birth",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client was not a premature infant at birth",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Completed the primary vaccination series Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "At high risk for pneumococcal infection Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Client is at high risk for pneumococcal infection",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Client is not at high risk for pneumococcal infection",
      "use": "out",
      "min": 0,
      "max": "1",
      "type": "boolean"
    },
    {
      "name": "Date when primary vaccination series was completed Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    },
    {
      "name": "Completed the booster series Observation",
      "use": "out",
      "min": 0,
      "max": "*",
      "type": "Observation"
    }
  ],
  "dataRequirement": [
    {
      "type": "Observation",
      "profile": [
        "http://hl7.org/fhir/StructureDefinition/Observation"
      ],
      "codeFilter": [
        {
          "path": "code",
          "code": [
            {
              "system": "http://smart.who.int/immunizations/CodeSystem/IMMZ.D",
              "code": "DE209",
              "display": "Immunocompromised"
            }
          ]
        }
      ]
    }
  ],
  "content": [
    {
      "contentType": "text/cql",
      "url": "Library-IMMZEncounterElements.cql"
    },
    {
      "contentType": "application/elm+xml",
      "url": "Library-IMMZEncounterElements.elm.xml"
    }
  ]
}
