Id: IMMZD5DTSeasonalInfluenzaContraindications Url: IMMZ.D5.DT.Seasonal influenza contraindications Version: 0.2.0 Title: IMMZ.D5.DT.Seasonal influenza contraindications Status: draft Type: system: http://terminology.hl7.org/CodeSystem/plan-definition-type code: eca-rule Date: 2026-03-25 23:30:34+0000 Publisher: WHO Description: IMMZ.D5.DT.Seasonal influenza contraindications IMMZ.D5.DT.Seasonal influenza contraindications Knowledge Capability: computable Related Artifacts: References WHO recommendations for routine immunization - summary tables (January 2025) Libraries: IMMZD5DTSeasonalInfluenzaContraindicationsLogic Actions: Check for Guidance for the patient regarding IMMZ.D5.DT.Seasonal influenza contraindications.: Show Guidance for the patient regarding IMMZ.D5.DT.Seasonal influenza 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-priority', code: 'routine' })
/* @internal: Potential contraindications observations */ define "Potential contraindications": ([Observation: Concepts."Potential contraindications"]).complete()
CI History of anaphylactic reactions Observation
/* @internal: Observation for History of anaphylactic reactions */ define "CI History of anaphylactic reactions Observation": "Potential contraindications" O where O.value ~ Concepts."CI-History of anaphylactic reactions"
/* @internal: Observation for History of anaphylactic reactions */ define "CI History of anaphylactic reactions Observation": Elements."CI History of anaphylactic reactions Observation".encounterOrOnBefore(EncounterId, Today)
CI History of anaphylactic reactions Condition
/* @internal: Condition for History of anaphylactic reactions */ define "CI History of anaphylactic reactions Condition": [Condition: Concepts."CI-History of anaphylactic reactions"]
/* @internal: Condition for History of anaphylactic reactions */ define "CI History of anaphylactic reactions Condition": Elements."CI History of anaphylactic reactions Condition" C where C.prevalenceInterval() includes Today
The client has history of anaphylactic reactions
/* @input: The client has history of anaphylactic reactions @pseudocode: "Potential contraindications" = "History of anaphylactic reactions" */ define "The client has history of anaphylactic reactions": exists "CI History of anaphylactic reactions Observation" or exists "CI History of anaphylactic reactions Condition"
The client has a history of anaphylactic reactions
/* @input: The client has a history of anaphylactic reactions @pseudocode: "Potential contraindications" = "History of anaphylactic reactions" @code: The client has a history of anaphylactic reactions-67 @decision: IMMZ.D5.DT.Seasonal influenza contraindications */ define "The client has a history of anaphylactic reactions": Encounter."The client has history of anaphylactic reactions"
Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 1
/* @output: Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 1 @pseudocode: '"Immunization recommendation status" = "Further evaluation needed" */ define "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 1": Encounter."The client has a history of anaphylactic reactions"
CI Severe allergic reactions Observation
/* @internal: Observation for Severe allergic reactions */ define "CI Severe allergic reactions Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Severe allergic reactions"
/* @internal: Observation for Severe allergic reactions */ define "CI Severe allergic reactions Observation": Elements."CI Severe allergic reactions Observation".encounterOrOnBefore(EncounterId, Today)
/* @internal: Condition for Severe allergic reactions */ define "CI Severe allergic reactions Condition": [Condition: Concepts."CI-Severe allergic reactions"]
/* @internal: Condition for Severe allergic reactions */ define "CI Severe allergic reactions Condition": Elements."CI Severe allergic reactions Condition" C where C.prevalenceInterval() includes Today
The client has history of severe allergic reactions
/* @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"
The client has a history of severe allergic reactions after a previous dose or to a vaccine component
/* @input: The client has a history of severe allergic reactions after a previous dose or to a vaccine component @pseudocode: "Potential contraindications" = "Severe allergic reactions" @code: The client has a history of severe allergic reactions after a previous dose or to a vaccine component-59 @decision: IMMZ.D5.DT.Seasonal influenza contraindications */ define "The client has a history of severe allergic reactions after a previous dose or to a vaccine component": Encounter."The client has history of severe allergic reactions"
Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 2
/* @output: Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 2 @pseudocode: '"Immunization recommendation status" = "Further evaluation needed" */ define "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 2": Encounter."The client has a history of severe allergic reactions after a previous dose or to a vaccine component"
Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note
/* @output: Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note @pseudocode: '"Immunization recommendation status" = "Further evaluation needed" */ define "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note": "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 1" or "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 2"
Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance
/* @output: Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance @guidance = Do not vaccinate client with seasonal influenza if client has had a severe allergic reaction (e.g. anaphylaxis) after a previous dose or to a vaccine component. @guidance = Do not vaccinate client with seasonal influenza if client has had a severe allergic reaction (e.g. anaphylaxis) after a previous dose or to a vaccine component. */ define "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance": case when "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 1" then 'Do not vaccinate client with seasonal influenza if client has had a severe allergic reaction (e.g. anaphylaxis) after a previous dose or to a vaccine component.' when "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Case 2" then 'Do not vaccinate client with seasonal influenza if client has had a severe allergic reaction (e.g. anaphylaxis) after a previous dose or to a vaccine component.' else '' end
/* @dynamicValue: Guidance */ define "Guidance": case when "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note" then "Seasonal influenza vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance" else '' end
define "Has Guidance": "Guidance" is not null and "Guidance" != ''
/** * @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)
/* @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, '/'))
define function ToString(value string): value.value
define fluent function complete(observations List<Observation>): observations O where O.status in { 'final', 'amended', 'corrected' }
define function ToString(value ObservationStatus): value.value
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 }
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 }
/* @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]
// 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
define function ToDateTime(value dateTime): value.value
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]
define function ToDate(value date): value.value
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
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
Code system ConditionClinicalStatusCodes
IMMZ.D5.DT.Seasonal influenza contraindications
IMMZ.D5.DT.Seasonal influenza contraindications IMMZ.D5.DT.Seasonal influenza contraindications
WHO recommendations for routine immunization - summary tables (January 2025)
Check for Guidance for the patient regarding IMMZ.D5.DT.Seasonal influenza contraindications.
Show Guidance for the patient regarding IMMZ.D5.DT.Seasonal influenza contraindications.
Code { system: 'http://terminology.hl7.org/CodeSystem/communication-category', code: 'alert' }
Code { system: 'http://hl7.org/fhir/request-priority', code: 'routine' }