IMMZD5DTBCGContraindications
type: PlanDefinition
node role: treeRoot
id:
  v: IMMZD5DTBCGContraindications
meta:
  profile:
    v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-recommendationdefinition
    l: cpg-recommendationdefinition
  profile:
    v: http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareableplandefinition
    l: crmi-shareableplandefinition
  profile:
    v: http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishableplandefinition
    l: crmi-publishableplandefinition
text:
  status:
    v: extensions
  div:
    v: Id: IMMZD5DTBCGContraindications Url: IMMZ.D5.DT.BCG contraindications Version: 1.0.0 Title: IMMZ.D5.DT.BCG contraindications Status: draft Type: system: http://terminology.hl7.org/CodeSystem/plan-definition-type code: eca-rule Date: 2026-03-31 13:54:17+0000 Publisher: WHO Description: IMMZ.D5.DT.BCG contraindications IMMZ.D5.DT.BCG contraindications Knowledge Capability: computable Related Artifacts: References WHO recommendations for routine immunization - summary tables (January 2025) Libraries: IMMZD5DTBCGContraindicationsLogic Actions: Check for contraindications before administering the vaccine(s) due: Contraindication for BCG immunization If: Applicability: BCG vaccination is contraindicated (BCG vaccination is contraindicated) Then: Definition: IMMZD5DTMR Dynamic Values: id: (Draft Medication Request ID for BCG dose) medication: (Concept { codes: { Code { system: 'http://smart.who.int/immunizations/CodeSystem/IMMZ.Z', code: 'DE1', display: 'BCG vaccines' } }, display: 'BCG vaccines' }) Check for contraindications before administering the vaccine(s) due: Contraindication for BCG immunization If: Applicability: Bacille Calmette–Guérin (BCG) vaccination is contraindicated (Bacille Calmette–Guérin (BCG) vaccination is contraindicated) Then: Definition: IMMZD5DTMR Dynamic Values: id: (Draft Medication Request ID for BCG dose) medication: (Concept { codes: { Code { system: 'http://smart.who.int/immunizations/CodeSystem/IMMZ.Z', code: 'DE1', display: 'BCG vaccines' } }, display: 'BCG vaccines' }) Check for Guidance for the patient regarding IMMZ.D5.DT.BCG contraindications.: Show Guidance for the patient regarding IMMZ.D5.DT.BCG contraindications. If: Applicability: Has Guidance (Has Guidance) Then: Definition: IMMZ.D2.DT.CR Dynamic Values: status: ('active') payload.contentString: (Guidance) category.coding: (Code { system: 'http://terminology.hl7.org/CodeSystem/communication-category', code: 'alert' }) priority: (Code { system: 'http://hl7.org/fhir/request-priori…
contained: Library
  id:
    v: effective-data-requirements
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
        l: IMMZ.D
      code:
        v: DE161
      display:
        v: Potential contraindications
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
        l: IMMZ.D
      code:
        v: DE162
      display:
        v: Currently pregnant
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://terminology.hl7.org/CodeSystem/condition-clinical
        l: condition-clinical
      code:
        v: active
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://terminology.hl7.org/CodeSystem/condition-clinical
        l: condition-clinical
      code:
        v: recurrence
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://terminology.hl7.org/CodeSystem/condition-clinical
        l: condition-clinical
      code:
        v: relapse
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      type: https://loinc.org/rdf/82810-3
      system:
        v: http://loinc.org
        l: loinc.org
      code:
        v: 82810-3
      display:
        v: Pregnancy status
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      type: LA15173-0
      system:
        v: http://loinc.org
        l: loinc.org
      code:
        v: LA15173-0
      display:
        v: Pregnant
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
        l: IMMZ.D
      code:
        v: DE167
      display:
        v: Severe allergic reactions
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
        l: IMMZ.D
      code:
        v: DE164
      display:
        v: Exposed to immunosuppressive treatment
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
      l: cqf-directReferenceCode
    value: Coding
      system:
        v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
        l: IMMZ.D
      code:
        v: DE187
      display:
        v: Immunodeficiency syndromes
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: IMMZElements
    extension:
      url:
        v: name
        l: name
      value: String
        v: Potential contraindications
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: /* @internal: Potential contraindications observations */ define "Potential contraindications": ([Observation: Concepts."Potential contraindications"]).complete()
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 0
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: IMMZElements
    extension:
      url:
        v: name
        l: name
      value: String
        v: CI Currently pregnant Observation
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: /* @internal: Observation for currently pregnant */ define "CI Currently pregnant Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Currently pregnant"
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 1
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: IMMZEncounterElements
    extension:
      url:
        v: name
        l: name
      value: String

String
v: CI Currently pregnant Observation

url:
  v: statement
  l: statement
value: String
  v: /* @internal: Observation for currently pregnant */ define "CI Currently pregnant Observation": Elements."CI Currently pregnant Observation" O where O.encounter.references(EncounterId) or O.effective.toInterval() starts same day or after Today - 9 months

url:
  v: displaySequence
  l: displaySequence
value: Integer
  v: 2

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Currently pregnant Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for currently pregnant */ define "CI Currently pregnant Condition": [Condition: Concepts."CI-Currently pregnant"]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 3
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Currently pregnant Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for currently pregnant */ define "CI Currently pregnant Condition": Elements."CI Currently pregnant Condition" C where C.prevalenceInterval() includes Today
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 4
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Pregnancy Status Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Pregnancy Status Observation": [Observation: Concepts."Pregnancy status"] O where O.status in { 'final', 'amended', 'corrected' }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 5
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Pregnant Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Pregnant Observation": "Pregnancy Status Observation" O where O.value ~ Concepts."Pregnant"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 6
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Pregnant Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Pregnant Observation": Elements."Pregnant Observation" O where O.encounter.references(EncounterId) or O.effective.toInterval() starts same day or after AsOf - 9 months
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 7
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client is pregnant
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client is pregnant @pseudocode: "Potential contraindications" = "Currently pregnant" */ define "The client is pregnant": exists "CI Currently pregnant Observation" or exists "CI Currently pregnant Condition" or exists WE."Pregnant Observation"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 8
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client is pregnant
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client is pregnant @pseudocode: "Potential contraindications" = "Currently pregnant" @code: The client is pregnant-52 @decision: IMMZ.D5.DT.BCG contraindications */ define "The client is pregnant": Encounter."The client is pregnant"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 9
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: Bacille Calmette–Guérin (BCG) vaccination is contraindicated
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: Bacille Calmette–Guérin (BCG) vaccination is contraindicated @pseudocode: '"Immunization recommendation status" = "Contraindicated" */ define "Bacille Calmette–Guérin (BCG) vaccination is contraindicated": Encounter."The client is pregnant"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 10
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: Bacille Calmette–Guérin (BCG) vaccination is contraindicated Guidance
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: Bacille Calmette–Guérin (BCG) vaccination is contraindicated Guidance @guidance: Do not vaccinate client with BCG as BCG vaccination is not recommended during pregnancy */ define "Bacille Calmette–Guérin (BCG) vaccination is contraindicated Guidance": 'Do not vaccinate client with BCG as BCG vaccination is not recommended during pregnancy'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 11
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Severe allergic reactions Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Observation for Severe allergic reactions */ define "CI Severe allergic reactions Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Severe allergic reactions"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 12
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Severe allergic reactions Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Observation for Severe allergic reactions */ define "CI Severe allergic reactions Observation": Elements."CI Severe allergic reactions Observation".encounterOrOnBefore(EncounterId, Today)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 13
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Severe allergic reactions Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for Severe allergic reactions */ define "CI Severe allergic reactions Condition": [Condition: Concepts."CI-Severe allergic reactions"]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 14
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Severe allergic reactions Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for Severe allergic reactions */ define "CI Severe allergic reactions Condition": Elements."CI Severe allergic reactions Condition" C where C.prevalenceInterval() includes Today
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 15
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client has history of severe allergic reactions
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client has history of severe allergic reactions @pseudocode: "Potential contraindications" = "Severe allergic reactions" */ define "The client has history of severe allergic reactions": exists "CI Severe allergic reactions Observation" or exists "CI Severe allergic reactions Condition"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 16
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client has history of severe allergic reactions
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client has history of severe allergic reactions @pseudocode: '"Potential contraindications" = "Severe allergic reactions" @code: The client has history of severe allergic reactions-60 @decision: IMMZ.D5.DT.BCG contraindications */ define "The client has history of severe allergic reactions": Encounter."The client has history of severe allergic reactions"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 17
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 1
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 1 @pseudocode: '"Immunization recommendation status" = "Further evaluation needed" */ define "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 1": Encounter."The client has history of severe allergic reactions"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 18
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Exposed to immunosuppressive treatment Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Observation for Exposed to immunosuppressive treatment */ define "CI Exposed to immunosuppressive treatment Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Exposed to immunosuppressive treatment"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 19
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Exposed to immunosuppressive treatment Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Observation for Exposed to immunosuppressive treatment */ define "CI Exposed to immunosuppressive treatment Observation": Elements."CI Exposed to immunosuppressive treatment Observation".encounterOrOnBefore(EncounterId, Today)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 20
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Exposed to immunosuppressive treatment Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for Exposed to immunosuppressive treatment */ define "CI Exposed to immunosuppressive treatment Condition": [Condition: Concepts."CI-Exposed to immunosuppressive treatment"]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 21
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Exposed to immunosuppressive treatment Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for Exposed to immunosuppressive treatment */ define "CI Exposed to immunosuppressive treatment Condition": Elements."CI Exposed to immunosuppressive treatment Condition" C where C.prevalenceInterval() includes Today
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 22
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client is exposed to immunosuppressive treatment
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client is exposed to immunosuppressive treatment @pseudocode: "Potential contraindications" = "Exposed to immunosuppressive treatment" */ define "The client is exposed to immunosuppressive treatment": exists "CI Exposed to immunosuppressive treatment Observation" or exists "CI Exposed to immunosuppressive treatment Condition"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 23
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client is exposed to immunosuppressive treatment
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client is exposed to immunosuppressive treatment @pseudocode: "Potential contraindications" = "Exposed to immunosuppressive treatment" @code: The client is exposed to immunosuppressive treatment-72 @decision: IMMZ.D5.DT.BCG contraindications */ define "The client is exposed to immunosuppressive treatment": Encounter."The client is exposed to immunosuppressive treatment"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 24
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Current Patient Age In Years
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /** * @dataElement Patient age in years */ define "Current Patient Age In Years": AgeInYearsAt(Today)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 25
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Client's age is more than or equal to 1 year
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: Client's age is more than or equal to 1 year @pseudocode: "Age" ≥ 1 year @code: Client's age is more than or equal to 1 year-14 @decision: IMMZ.D5.DT.BCG contraindications */ define "Client's age is more than or equal to 1 year": Encounter."Current Patient Age In Years" >= 1
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 26
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 2
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 2 @pseudocode: '"Immunization recommendation status" = "Further evaluation needed" */ define "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 2": Encounter."The client is exposed to immunosuppressive treatment" and Encounter."Client's age is more than or equal to 1 year"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 27
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note.
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. @pseudocode: '"Immunization recommendation status" = "Further evaluation needed" */ define "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note.": "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 1" or "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 2"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 28
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Guidance
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Guidance @guidance = Do not vaccinate client with BCG if the client had previous allergic reaction to any component of the vaccine @guidance = Do not vaccinate client with BCG if client is exposed to or receives immunosuppressive treatment */ define "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Guidance": case when "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 1" then 'Do not vaccinate client with BCG if the client had previous allergic reaction to any component of the vaccine' when "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Case 2" then 'Do not vaccinate client with BCG if client is exposed to or receives immunosuppressive treatment' else '' end
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 29
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Immunodeficiency syndromes Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Observation for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Immunodeficiency syndromes"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 30
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Immunodeficiency syndromes Observation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Observation for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Observation": Elements."CI Immunodeficiency syndromes Observation".encounterOrOnBefore(EncounterId, Today)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 31
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Immunodeficiency syndromes Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Condition": [Condition: Concepts."CI-Immunodeficiency syndromes"]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 32
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: CI Immunodeficiency syndromes Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Condition for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Condition": Elements."CI Immunodeficiency syndromes Condition" C where C.prevalenceInterval() includes Today
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 33
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client has immunodeficiency syndromes
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client has immunodeficiency syndromes @pseudocode: "Potential contraindications" = "Immunodeficiency syndromes" */ define "The client has immunodeficiency syndromes": exists "CI Immunodeficiency syndromes Observation" or exists "CI Immunodeficiency syndromes Condition"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 34
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: The client has immunodeficiency syndromes
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: The client has immunodeficiency syndromes @pseudocode: "Potential contraindications" = "Immunodeficiency syndromes" @code: The client has immunodeficiency syndromes-60 @decision: IMMZ.D5.DT.BCG contraindications */ define "The client has immunodeficiency syndromes": Encounter."The client has immunodeficiency syndromes"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 35
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination is contraindicated Case 1
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination is contraindicated Case 1 @pseudocode: '"Immunization recommendation status" = "Contraindicated" */ define "BCG vaccination is contraindicated Case 1": Encounter."The client has immunodeficiency syndromes"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 36
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Client's age is less than 1 year
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @input: Client's age is less than 1 year @pseudocode: "Age" < 1 year @code: Client's age is less than 1 year-14 @decision: IMMZ.D5.DT.BCG contraindications */ define "Client's age is less than 1 year": Encounter."Current Patient Age In Years" < 1
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 37
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination is contraindicated Case 2
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination is contraindicated Case 2 @pseudocode: '"Immunization recommendation status" = "Contraindicated" */ define "BCG vaccination is contraindicated Case 2": Encounter."The client is exposed to immunosuppressive treatment" and Encounter."Client's age is less than 1 year"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 38
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination is contraindicated
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination is contraindicated @pseudocode: '"Immunization recommendation status" = "Contraindicated" */ define "BCG vaccination is contraindicated": "BCG vaccination is contraindicated Case 1" or "BCG vaccination is contraindicated Case 2"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 39
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: BCG vaccination is contraindicated Guidance
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @output: BCG vaccination is contraindicated Guidance @guidance = Do not vaccinate client with BCG as BCG vaccination is contraindicated for clients with immunodeficiency syndromes @guidance = Do not vaccinate client with BCG as BCG vaccination is contraindicated for clients undergoing immunosuppressive treatment */ define "BCG vaccination is contraindicated Guidance": case when "BCG vaccination is contraindicated Case 1" then 'Do not vaccinate client with BCG as BCG vaccination is contraindicated for clients with immunodeficiency syndromes' when "BCG vaccination is contraindicated Case 2" then 'Do not vaccinate client with BCG as BCG vaccination is contraindicated for clients undergoing immunosuppressive treatment' else '' end
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 40
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: Guidance
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @dynamicValue: Guidance */ define "Guidance": case when "Bacille Calmette–Guérin (BCG) vaccination is contraindicated" then "Bacille Calmette–Guérin (BCG) vaccination is contraindicated Guidance" when "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note." then "BCG vaccination could be contraindicated. Clinical judgement is required. Create a clinical note. Guidance" when "BCG vaccination is contraindicated" then "BCG vaccination is contraindicated Guidance" else '' end
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 41
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Draft Medication Request for Patient
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @dataElement: Draft Medication Request for Patient */ define "Draft Medication Request for Patient": [MedicationRequest] MR where MR.status = 'draft' and MR.intent = 'proposal' sort by date from (authoredOn as FHIR.dateTime) desc
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 42
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Draft Medication Request for Patient
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @dataElement: Draft Medication Request for Patient */ define "Draft Medication Request for Patient": Elements."Draft Medication Request for Patient" MR where MR.encounter.references(EncounterId) or MR.authoredOn.toInterval() same day or before Today sort by date from (authoredOn as FHIR.dateTime) desc
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 43
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGEncounterElements
extension:
  url:
    v: name
    l: name
  value: String
    v: Draft Medication Request for BCG dose
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @internal: Draft Medication Request for BCG dose */ define "Draft Medication Request for BCG dose": Encounter."Draft Medication Request for Patient" MR where MR.medication in Concepts."BCG vaccines"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 44
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: Draft Medication Request ID for BCG dose
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @dynamicValue: Draft Medication Request ID for BCG dose */ define "Draft Medication Request ID for BCG dose": First(Encounter."Draft Medication Request for BCG dose").id
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 45
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZD5DTBCGContraindicationsLogic
extension:
  url:
    v: name
    l: name
  value: String
    v: Has Guidance
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Has Guidance": "Guidance" is not null and "Guidance" != ''
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 46
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: complete
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define fluent function complete(observations List<Observation>): observations O where O.status in { 'final', 'amended', 'corrected' }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 47
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value ObservationStatus): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 48
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToConcept
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToConcept(concept FHIR.CodeableConcept): if concept is null then null else System.Concept { codes: concept.coding C return ToCode(C), display: concept.text.value }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 49
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToCode
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToCode(coding FHIR.Coding): if coding is null then null else System.Code { code: coding.code.value, system: coding.system.value, version: coding.version.value, display: coding.display.value }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 50
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: references
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @description: Returns true if the given reference is to the given resourceId @comment: Returns true if the `resourceId` parameter exactly equals the tail of the given reference. NOTE: This function assumes resources from the same source server. */ define fluent function references(reference FHIR.Reference, resourceId String): resourceId = Last(Split(reference.reference, '/'))
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 51
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value string): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 52
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: toInterval
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* From FHIRCommon 4.1.0: */ /* @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval @comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible representations for timing-valued elements in FHIR, allowing this function to be used across any resource. The input can be provided as a dateTime, Period, Timing, instant, string, Age, or Range. The intent of this function is to provide a clear and concise mechanism to treat single elements that have multiple possible representations as intervals so that logic doesn't have to account for the variability. More complex calculations (such as medication request period or dispense period calculation) need specific guidance and consideration. That guidance may make use of this function, but the focus of this function is on single element calculations where the semantics are unambiguous. If the input is a dateTime, the result a DateTime Interval beginning and ending on that dateTime. If the input is a Period, the result is a DateTime Interval. If the input is a Timing, an error is raised indicating a single interval cannot be computed from a Timing. If the input is an instant, the result is a DateTime Interval beginning and ending on that instant. If the input is a string, an error is raised indicating a single interval cannot be computed from a string. If the input is an Age, the result is a DateTime Interval beginning when the patient was the given Age, and ending immediately prior to when the patient was the given Age plus one year. If the input is a Range, the result is a DateTime Interval beginning when the patient was the Age given by the low end of the Range, and ending immediately prior to when the patient was the Age given by the high end of the Range plus one year. NOTE: …
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 53
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToDateTime
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToDateTime(value dateTime): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 54
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToInterval
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToInterval(period FHIR.Period): if period is null then null else if period."start" is null then Interval(period."start".value, period."end".value] else Interval[period."start".value, period."end".value]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 55
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToDateTime
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToDateTime(value instant): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 56
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToDate
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToDate(value date): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 57
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToQuantity
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToQuantity(quantity FHIR.Quantity): case when quantity is null then null when quantity.value is null then null when quantity.comparator is not null then Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.') when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org' or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) } else Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')') end
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 58
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToCalendarUnit
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToCalendarUnit(unit System.String): case unit when 'ms' then 'millisecond' when 's' then 'second' when 'min' then 'minute' when 'h' then 'hour' when 'd' then 'day' when 'wk' then 'week' when 'mo' then 'month' when 'a' then 'year' else unit end
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 59
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: prevalenceInterval
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @description: Returns an interval representing the normalized prevalence period of a given Condition resource. @comment: Uses the toInterval and toAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. */ define fluent function prevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()] else (end of condition.abatementInterval()) abatementDate return if abatementDate is null then Interval[start of condition.onset.toInterval(), abatementDate) else Interval[start of condition.onset.toInterval(), abatementDate]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 60
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: WHOCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: abatementInterval
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Was getting error on this for this particular choice set not being found /* @description: Returns an interval representing the normalized Abatement of a given Condition resource. @comment: NOTE: Due to the complexity of determining an interval from a String, this function will throw a run-time exception if used with a Condition instance that has a String as the abatement value. */ define fluent function abatementInterval(condition Condition): if condition.abatement is FHIR.dateTime then Interval[FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime), FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime)] else if condition.abatement is FHIR.Period then FHIRHelpers.ToInterval(condition.abatement as FHIR.Period) else if condition.abatement is FHIR.string then Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a String value is not supported') else if condition.abatement is FHIR.Age then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age) + 1 year) else if condition.abatement is FHIR.Range then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).low), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).high) + 1 year) else if condition.abatement is FHIR.boolean then Interval[end of condition.onset.toInterval(), condition.recordedDate) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 61
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: IMMZCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: encounterOrOnBefore
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /** * @description: Gets observation from an encounter or on or before a date */ define fluent function encounterOrOnBefore(observations List<Observation>, EncounterId String, beforeDate Date): observations O where (O.encounter.references(EncounterId) or O.effective.toInterval() starts same day or before beforeDate)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 62
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value MedicationRequestStatus): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 63
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value MedicationRequestIntent): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 64
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

v: EffectiveDataRequirements

v: active

coding:
  system:
    v: http://terminology.hl7.org/CodeSystem/library-type
    l: library-type
  code:
    v: module-definition

type:
  v: depends-on
display:
  v: FHIR model information
resource:
  v: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
  l: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo

type:
  v: depends-on
display:
  v: Library Encounter
resource:
  v: http://smart.who.int/immunizations/Library/IMMZD5DTBCGEncounterElements
  l: IMMZD5DTBCGEncounterElements

type:
  v: depends-on
display:
  v: Library Encounter
resource:
  v: http://smart.who.int/immunizations/Library/IMMZEncounterElements
  l: IMMZEncounterElements

type:
  v: depends-on
display:
  v: Library Elements
resource:
  v: http://smart.who.int/immunizations/Library/IMMZElements
  l: IMMZElements

type:
  v: depends-on
display:
  v: Library WC
resource:
  v: http://smart.who.int/immunizations/Library/WHOCommon
  l: WHOCommon

type:
  v: depends-on
display:
  v: Library FHIRHelpers
resource:
  v: http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
  l: http://fhir.org/guides/cqf/common/Library/FHIRHelpers

type:
  v: depends-on
display:
  v: Library Concepts
resource:
  v: http://smart.who.int/immunizations/Library/IMMZConcepts
  l: IMMZConcepts

type:
  v: depends-on
display:
  v: Library WE
resource:
  v: http://smart.who.int/immunizations/Library/WHOEncounterElements
  l: WHOEncounterElements

type:
  v: depends-on
display:
  v: Library Elements
resource:
  v: http://smart.who.int/immunizations/Library/WHOElements
  l: WHOElements

type:
  v: depends-on
display:
  v: Library Concepts
resource:
  v: http://smart.who.int/immunizations/Library/WHOConcepts
  l: WHOConcepts

type:
  v: depends-on
display:
  v: Library Common
resource:
  v: http://smart.who.int/immunizations/Library/IMMZCommon
  l: IMMZCommon

type:
  v: depends-on
display:
  v: Code system IMMZD
resource:
  v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
  l: IMMZ.D

type:
  v: depends-on
display:
  v: Code system ConditionClinicalStatusCodes
resource:
  v: http://terminology.hl7.org/CodeSystem/condition-clinical
  l: condition-clinical

type:
  v: depends-on
display:
  v: Code system LOINC
resource:
  v: http://loinc.org
  l: loinc.org

type:
  v: depends-on
display:
  v: Value set BCG vaccines
resource:
  v: http://smart.who.int/immunizations/ValueSet/IMMZ.Z.DE1
  l: IMMZ.Z.DE1

name:
  v: EncounterId
use:
  v: in
min:
  v: 0
max:
  v: 1
type:
  v: string

name:
  v: Today
use:
  v: in
min:
  v: 0
max:
  v: 1
type:
  v: date

name:
  v: AsOf
use:
  v: in
min:
  v: 0
max:
  v: 1
type:
  v: date

name:
  v: Guidance
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: string

name:
  v: BCG vaccination is contraindicated
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: boolean

name:
  v: Draft Medication Request ID for BCG dose
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: id

name:
  v: Has Guidance
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: boolean

name:
  v: Bacille Calmette–Guérin (BCG) vaccination is contraindicated
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: boolean

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: status
must support:
  v: encounter
must support:
  v: effective
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE161
    display:
      v: Potential contraindications

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: value
must support:
  v: status
must support:
  v: encounter
must support:
  v: effective
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE161
    display:
      v: Potential contraindications
code filter:
  path:
    v: value

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: status
must support:
  v: encounter
must support:
  v: effective
code filter:
  path:
    v: code
  code: https://loinc.org/rdf/82810-3
    system:
      v: http://loinc.org
      l: loinc.org
    code:
      v: 82810-3
    display:
      v: Pregnancy status

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: status
must support:
  v: value
must support:
  v: encounter
must support:
  v: effective
code filter:
  path:
    v: code
  code: https://loinc.org/rdf/82810-3
    system:
      v: http://loinc.org
      l: loinc.org
    code:
      v: 82810-3
    display:
      v: Pregnancy status
code filter:
  path:
    v: value

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: value
must support:
  v: status
must support:
  v: encounter
must support:
  v: effective
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE161
    display:
      v: Potential contraindications
code filter:
  path:
    v: value

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: value
must support:
  v: status
must support:
  v: encounter
must support:
  v: effective
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE161
    display:
      v: Potential contraindications
code filter:
  path:
    v: value

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: value
must support:
  v: status
must support:
  v: encounter
must support:
  v: effective
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE161
    display:
      v: Potential contraindications
code filter:
  path:
    v: value

type:
  v: Patient
profile:
  v: http://hl7.org/fhir/StructureDefinition/Patient
  l: Patient
must support:
  v: birthDate

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: abatement
must support:
  v: onset
must support:
  v: recordedDate
must support:
  v: clinicalStatus

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: code
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE162
    display:
      v: Currently pregnant

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: code
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE167
    display:
      v: Severe allergic reactions

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: code
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE164
    display:
      v: Exposed to immunosuppressive treatment

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: code
code filter:
  path:
    v: code
  code:
    system:
      v: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
      l: IMMZ.D
    code:
      v: DE187
    display:
      v: Immunodeficiency syndromes

type:
  v: MedicationRequest
profile:
  v: http://hl7.org/fhir/StructureDefinition/MedicationRequest
  l: MedicationRequest
must support:
  v: status
must support:
  v: intent
must support:
  v: encounter
must support:
  v: authoredOn
code filter:
  path:
    v: status
  code:
    code:
      v: draft
code filter:
  path:
    v: intent
  code:
    code:
      v: proposal

type:
  v: MedicationRequest
profile:
  v: http://hl7.org/fhir/StructureDefinition/MedicationRequest
  l: MedicationRequest
must support:
  v: id

type:
  v: MedicationRequest
profile:
  v: http://hl7.org/fhir/StructureDefinition/MedicationRequest
  l: MedicationRequest
must support:
  v: status
must support:
  v: intent
must support:
  v: encounter
must support:
  v: authoredOn
must support:
  v: medication
code filter:
  path:
    v: status
  code:
    code:
      v: draft
code filter:
  path:
    v: intent
  code:
    code:
      v: proposal
code filter:
  path:
    v: medication
  value set:
    v: http://smart.who.int/immunizations/ValueSet/IMMZ.Z.DE1
    l: IMMZ.Z.DE1

url:
  v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
  l: cpg-knowledgeCapability
value: Code
  v: computable

url:
  v: http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements
  l: crmi-effectiveDataRequirements
value: Canonical
  v: #effective-data-requirements
  l: effective-data-requirements

v: 1.0.0

v: IMMZD5DTBCGContraindications

v: IMMZ.D5.DT.BCG contraindications

coding:
  system:
    v: http://terminology.hl7.org/CodeSystem/plan-definition-type
    l: plan-definition-type
  code:
    v: eca-rule

v: draft

v: false

v: 2026-03-31T13:54:17+00:00

v: WHO

name:
  v: WHO
telecom:
  system:
    v: url
  value:
    v: http://who.int

v: IMMZ.D5.DT.BCG contraindications IMMZ.D5.DT.BCG contraindications

type:
  v: citation
citation:
  v: WHO recommendations for routine immunization - summary tables (January 2025)

title:
  v: Check for contraindications before administering the vaccine(s) due
description:
  v: Contraindication for BCG immunization
condition:
  kind:
    v: applicability
  expression:
    description:
      v: BCG vaccination is contraindicated
    language:
      v: text/cql-identifier
    expression:
      v: BCG vaccination is contraindicated
type:
  coding:
    system:
      v: http://terminology.hl7.org/CodeSystem/action-type
      l: action-type
    code:
      v: update
definition: Canonical
  v: http://smart.who.int/immunizations/ActivityDefinition/IMMZD5DTMR
  l: IMMZD5DTMR
dynamic value:
  path:
    v: id
  expression:
    description:
      v: Draft Medication Request ID for BCG dose
    language:
      v: text/cql-identifier
    expression:
      v: Draft Medication Request ID for BCG dose
dynamic value:
  path:
    v: medication
  expression:
    language:
      v: text/cql-expression
    expression:
      v: Concept { codes: { Code { system: 'http://smart.who.int/immunizations/CodeSystem/IMMZ.Z', code: 'DE1', display: 'BCG vaccines' } }, display: 'BCG vaccines' }

title:
  v: Check for contraindications before administering the vaccine(s) due
description:
  v: Contraindication for BCG immunization
condition:
  kind:
    v: applicability
  expression:
    description:
      v: Bacille Calmette–Guérin (BCG) vaccination is contraindicated
    language:
      v: text/cql-identifier
    expression:
      v: Bacille Calmette–Guérin (BCG) vaccination is contraindicated
type:
  coding:
    system:
      v: http://terminology.hl7.org/CodeSystem/action-type
      l: action-type
    code:
      v: update
definition: Canonical
  v: http://smart.who.int/immunizations/ActivityDefinition/IMMZD5DTMR
  l: IMMZD5DTMR
dynamic value:
  path:
    v: id
  expression:
    description:
      v: Draft Medication Request ID for BCG dose
    language:
      v: text/cql-identifier
    expression:
      v: Draft Medication Request ID for BCG dose
dynamic value:
  path:
    v: medication
  expression:
    language:
      v: text/cql-expression
    expression:
      v: Concept { codes: { Code { system: 'http://smart.who.int/immunizations/CodeSystem/IMMZ.Z', code: 'DE1', display: 'BCG vaccines' } }, display: 'BCG vaccines' }

title:
  v: Check for Guidance for the patient regarding IMMZ.D5.DT.BCG contraindications.
description:
  v: Show Guidance for the patient regarding IMMZ.D5.DT.BCG contraindications.
condition:
  kind:
    v: applicability
  expression:
    description:
      v: Has Guidance
    language:
      v: text/cql-identifier
    expression:
      v: Has Guidance
definition: Canonical
  v: http://smart.who.int/immunizations/ActivityDefinition/IMMZD2DTCR
  l: IMMZD2DTCR
dynamic value:
  path:
    v: status
  expression:
    language:
      v: text/cql-expression
    expression:
      v: 'active'
dynamic value:
  path:
    v: payload.contentString
  expression:
    language:
      v: text/cql-identifier
    expression:
      v: Guidance
dynamic value:
  path:
    v: category.coding
  expression:
    description:
      v: Category of communication
    language:
      v: text/cql-expression
    expression:
      v: Code { system: 'http://terminology.hl7.org/CodeSystem/communication-category', code: 'alert' }
dynamic value:
  path:
    v: priority
  expression:
    description:
      v: Alert priority
    language:
      v: text/cql-expression
    expression:
      v: Code { system: 'http://hl7.org/fhir/request-priority', code: 'routine' }