Id: IMMZD5DTRubellaContraindications Url: IMMZ.D5.DT.Rubella contraindications Version: 1.0.0 Title: IMMZ.D5.DT.Rubella 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.Rubella contraindications IMMZ.D5.DT.Rubella contraindications Knowledge Capability: computable Related Artifacts: References WHO recommendations for routine immunization - summary tables (January 2025) Libraries: IMMZD5DTRubellaContraindicationsLogic Actions: Check for contraindications before administering the vaccine(s) due: Contraindication for rubella immunization If: Applicability: Rubella vaccination is contraindicated (Rubella vaccination is contraindicated) Then: Definition: IMMZD5DTMR Dynamic Values: id: (Draft Medication Request ID for Rubella dose) medication: (Concept { codes: { Code { system: 'http://smart.who.int/immunizations/CodeSystem/IMMZ.Z', code: 'DE17', display: 'Rubella-containing vaccines' } }, display: 'Rubella-containing vaccines' }) Check for Guidance for the patient regarding IMMZ.D5.DT.Rubella contraindications.: Show Guidance for the patient regarding IMMZ.D5.DT.Rubella 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' })
Planning to get pregnant in the next month
/* @internal: Potential contraindications observations */ define "Potential contraindications": ([Observation: Concepts."Potential contraindications"]).complete()
/* @internal: Observation for currently pregnant */ define "CI Currently pregnant Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Currently pregnant"
/* @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
/* @internal: Condition for currently pregnant */ define "CI Currently pregnant Condition": [Condition: Concepts."CI-Currently pregnant"]
/* @internal: Condition for currently pregnant */ define "CI Currently pregnant Condition": Elements."CI Currently pregnant Condition" C where C.prevalenceInterval() includes Today
define "Pregnancy Status Observation": [Observation: Concepts."Pregnancy status"] O where O.status in { 'final', 'amended', 'corrected' }
define "Pregnant Observation": "Pregnancy Status Observation" O where O.value ~ Concepts."Pregnant"
define "Pregnant Observation": Elements."Pregnant Observation" O where O.encounter.references(EncounterId) or O.effective.toInterval() starts same day or after AsOf - 9 months
/* @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"
/* @input: The client is currently pregnant @pseudocode: "Potential contraindications" = "Currently pregnant" @code: The client is currently pregnant-52 @decision: IMMZ.D5.DT.Rubella contraindications */ define "The client is currently pregnant": Encounter."The client is pregnant"
Rubella vaccination is contraindicated Case 1
/* @output: Rubella vaccination is contraindicated Case 1 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Rubella vaccination is contraindicated Case 1": Encounter."The client is currently pregnant"
/* @internal: Observation for Receiving blood products */ define "CI Receiving blood products Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Receiving blood products"
/* @internal: Observation for Receiving blood products */ define "CI Receiving blood products Observation": Elements."CI Receiving blood products Observation".encounterOrOnBefore(EncounterId, Today)
/* @internal: Condition for Receiving blood products */ define "CI Receiving blood products Condition": [Condition: Concepts."CI-Receiving blood products"]
/* @internal: Condition for Receiving blood products */ define "CI Receiving blood products Condition": Elements."CI Receiving blood products Condition" C where C.prevalenceInterval() includes Today
/* @input: The client is receiving blood products @pseudocode: "Potential contraindications" = "Receiving blood products" */ define "The client is receiving blood products": exists "CI Receiving blood products Observation" or exists "CI Receiving blood products Condition"
/* @input: The client is receiving blood products @pseudocode: "Potential contraindications" = "Receiving blood products" @code: The client is receiving blood products-58 @decision: IMMZ.D5.DT.Rubella contraindications */ define "The client is receiving blood products": Encounter."The client is receiving blood products"
Rubella vaccination is contraindicated Case 2
/* @output: Rubella vaccination is contraindicated Case 2 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Rubella vaccination is contraindicated Case 2": Encounter."The client is receiving blood products"
CI Symptomatic HIV infection Observation
/* @internal: Observation for Symptomatic HIV infection */ define "CI Symptomatic HIV infection Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Symptomatic HIV infection"
/* @internal: Observation for Symptomatic HIV infection */ define "CI Symptomatic HIV infection Observation": Elements."CI Symptomatic HIV infection Observation".encounterOrOnBefore(EncounterId, Today)
/* @internal: Condition for Symptomatic HIV infection */ define "CI Symptomatic HIV infection Condition": [Condition: Concepts."CI-Symptomatic HIV infection"]
/* @internal: Condition for Symptomatic HIV infection */ define "CI Symptomatic HIV infection Condition": Elements."CI Symptomatic HIV infection Condition" C where C.prevalenceInterval() includes Today
The client has a symptomatic HIV infection
/* @input: The client has a symptomatic HIV infection @pseudocode: "Potential contraindications" = "Symptomatic HIV infection" */ define "The client has a symptomatic HIV infection": exists "CI Symptomatic HIV infection Observation" or exists "CI Symptomatic HIV infection Condition"
The client has symptomatic HIV infection
/* @input: The client has symptomatic HIV infection @pseudocode: "Potential contraindications" = "Symptomatic HIV infection" @code: The client has symptomatic HIV infection-59 @decision: IMMZ.D5.DT.Rubella contraindications */ define "The client has symptomatic HIV infection": Encounter."The client has a symptomatic HIV infection"
Rubella vaccination is contraindicated Case 3
/* @output: Rubella vaccination is contraindicated Case 3 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Rubella vaccination is contraindicated Case 3": Encounter."The client has symptomatic HIV infection"
/* @internal: Observation for TB disease */ define "CI TB disease Observation": "Potential contraindications" O where O.value ~ Concepts."CI-TB disease"
/* @internal: Observation for TB disease */ define "CI TB disease Observation": Elements."CI TB disease Observation".encounterOrOnBefore(EncounterId, Today)
/* @internal: Condition for TB disease */ define "CI TB disease Condition": [Condition: Concepts."CI-TB disease"]
/* @internal: Condition for TB disease */ define "CI TB disease Condition": Elements."CI TB disease Condition" C where C.prevalenceInterval() includes Today
/* @input: The client has TB disease @pseudocode: "Potential contraindications" = "TB disease" */ define "The client has TB disease": exists "CI TB disease Observation" or exists "CI TB disease Condition"
/* @input: The client has TB disease @pseudocode: "Potential contraindications" = "TB disease" @code: The client has TB disease-44 @decision: IMMZ.D5.DT.Rubella contraindications */ define "The client has TB disease": Encounter."The client has TB disease"
Rubella vaccination is contraindicated Case 4
/* @output: Rubella vaccination is contraindicated Case 4 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Rubella vaccination is contraindicated Case 4": Encounter."The client has TB disease"
CI Immunodeficiency syndromes Observation
/* @internal: Observation for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Immunodeficiency syndromes"
/* @internal: Observation for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Observation": Elements."CI Immunodeficiency syndromes Observation".encounterOrOnBefore(EncounterId, Today)
/* @internal: Condition for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Condition": [Condition: Concepts."CI-Immunodeficiency syndromes"]
/* @internal: Condition for Immunodeficiency syndromes */ define "CI Immunodeficiency syndromes Condition": Elements."CI Immunodeficiency syndromes Condition" C where C.prevalenceInterval() includes Today
The client has immunodeficiency syndromes
/* @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"
/* @input: The client has immunodeficiency syndromes @pseudocode: "Potential contraindications" = "Immunodeficiency syndromes" @code: The client has immunodeficiency syndromes-60 @decision: IMMZ.D5.DT.Rubella contraindications */ define "The client has immunodeficiency syndromes": Encounter."The client has immunodeficiency syndromes"
Rubella vaccination is contraindicated Case 5
/* @output: Rubella vaccination is contraindicated Case 5 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Rubella vaccination is contraindicated Case 5": Encounter."The client has immunodeficiency syndromes"
CI Exposed to immunosuppressive treatment Observation
/* @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"
/* @internal: Observation for Exposed to immunosuppressive treatment */ define "CI Exposed to immunosuppressive treatment Observation": Elements."CI Exposed to immunosuppressive treatment Observation".encounterOrOnBefore(EncounterId, Today)
CI Exposed to immunosuppressive treatment Condition
/* @internal: Condition for Exposed to immunosuppressive treatment */ define "CI Exposed to immunosuppressive treatment Condition": [Condition: Concepts."CI-Exposed to immunosuppressive treatment"]
/* @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
The client is exposed to immunosuppressive treatment
/* @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"
/* @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.Rubella contraindications */ define "The client is exposed to immunosuppressive treatment": Encounter."The client is exposed to immunosuppressive treatment"
Rubella vaccination is contraindicated Case 6
/* @output: Rubella vaccination is contraindicated Case 6 @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Rubella vaccination is contraindicated Case 6": Encounter."The client is exposed to immunosuppressive treatment"
/* @output: Rubella vaccination is contraindicated @pseudocode: "Immunization recommendation status" = "Contraindicated" */ define "Rubella vaccination is contraindicated": "Rubella vaccination is contraindicated Case 1" or "Rubella vaccination is contraindicated Case 2" or "Rubella vaccination is contraindicated Case 3" or "Rubella vaccination is contraindicated Case 4" or "Rubella vaccination is contraindicated Case 5" or "Rubella vaccination is contraindicated Case 6"
Rubella vaccination is contraindicated Guidance
/* @output: Rubella vaccination is contraindicated Guidance @guidance = Do not vaccinate client with rubella as rubella vaccination is contraindicated for pregnant client. @guidance = Do not vaccinate client with rubella as rubella vaccination is contraindicated until at least 3 months after stopping receiving blood products. @guidance = Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients with symptomatic HIV infection. @guidance = Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients with active TB. @guidance = Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients with severe immunodeficiency. @guidance = Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients receiving or exposed to immunosuppressive therapy. */ define "Rubella vaccination is contraindicated Guidance": case when "Rubella vaccination is contraindicated Case 1" then 'Do not vaccinate client with rubella as rubella vaccination is contraindicated for pregnant client.' when "Rubella vaccination is contraindicated Case 2" then 'Do not vaccinate client with rubella as rubella vaccination is contraindicated until at least 3 months after stopping receiving blood products.' when "Rubella vaccination is contraindicated Case 3" then 'Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients with symptomatic HIV infection.' when "Rubella vaccination is contraindicated Case 4" then 'Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients with active TB.' when "Rubella vaccination is contraindicated Case 5" then 'Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients with severe immunodeficiency.' when "Rubella vaccination is contraindicated Case 6" then 'Do not vaccinate client with rubella as rubella vaccination is contraindicated for clients receiving or exposed to immunosuppressive therapy.' else '' end
CI Planning to get pregnant in the next month Observation
/* @internal: Observation for Planning to get pregnant in the next month */ define "CI Planning to get pregnant in the next month Observation": "Potential contraindications" O where O.value ~ Concepts."CI-Planning to get pregnant in the next month"
/* @internal: Observation for Planning to get pregnant in the next month */ define "CI Planning to get pregnant in the next month Observation": Elements."CI Planning to get pregnant in the next month Observation".encounterOrOnBefore(EncounterId, Today)
CI Planning to get pregnant in the next month Condition
/* @internal: Condition for Planning to get pregnant in the next month */ define "CI Planning to get pregnant in the next month Condition": [Condition: Concepts."CI-Planning to get pregnant in the next month"]
/* @internal: Condition for Planning to get pregnant in the next month */ define "CI Planning to get pregnant in the next month Condition": Elements."CI Planning to get pregnant in the next month Condition" C where C.prevalenceInterval() includes Today
The client is planning to get pregnant in next month
/* @input: The client is planning to get pregnant in next month @pseudocode: "Potential contraindications" = "Planning to get pregnant in the next month" */ define "The client is planning to get pregnant in next month": exists "CI Planning to get pregnant in the next month Observation" or exists "CI Planning to get pregnant in the next month Condition"
/* @input: The client is planning to get pregnant in next month @pseudocode: "Potential contraindications" = "Planning to get pregnant in the next month" @code: The client is planning to get pregnant in next month-76 @decision: IMMZ.D5.DT.Rubella contraindications */ define "The client is planning to get pregnant in next month": Encounter."The client is planning to get pregnant in next month"
Clinical judgement is required. Create a clinical note
/* @output: Clinical judgement is required. Create a clinical note @pseudocode: "Immunization recommendation status" = "Further evaluation needed" */ define "Clinical judgement is required. Create a clinical note": Encounter."The client is planning to get pregnant in next month"
Clinical judgement is required. Create a clinical note Guidance
/* @output: Clinical judgement is required. Create a clinical note Guidance @guidance: Discuss pregnancy intentions with client, consider risks of vaccination and make a clinical judgement. Clients planning a pregnancy are advised to avoid pregnancy for 1 month after rubella vaccination. */ define "Clinical judgement is required. Create a clinical note Guidance": 'Discuss pregnancy intentions with client, consider risks of vaccination and make a clinical judgement. Clients planning a pregnancy are advised to avoid pregnancy for 1 month after rubella vaccination.'
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"
/* @input: The client has history of severe allergic reactions @pseudocode: "Potential contraindications" = "Severe allergic reactions" @code: The client has history of severe allergic reactions-59 @decision: IMMZ.D5.DT.Rubella contraindications */ define "The client has history of severe allergic reactions": Encounter."The client has history of severe allergic reactions"
Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note
/* @output: Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note @pseudocode: "Immunization recommendation status" = "Further evaluation needed" */ define "Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note": Encounter."The client has history of severe allergic reactions"
Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance
/* @output: Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance @guidance: Do not vaccinate client with rubella if client has experienced a severe allergic reaction after a previous vaccine dose or vaccine component. */ define "Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance": 'Do not vaccinate client with rubella if client has experienced a severe allergic reaction after a previous vaccine dose or vaccine component.'
/* @dynamicValue: Guidance */ define "Guidance": case when "Rubella vaccination is contraindicated" then "Rubella vaccination is contraindicated Guidance" when "Clinical judgement is required. Create a clinical note" then "Clinical judgement is required. Create a clinical note Guidance" when "Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note" then "Rubella vaccination could be contraindicated. Clinical judgement is required. Create a clinical note Guidance" else '' end
/* @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
/* @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
Draft Medication Request for Rubella dose
/* @internal: Draft Medication Request for Rubella dose */ define "Draft Medication Request for Rubella dose": Encounter."Draft Medication Request for Patient" MR where MR.medication in Concepts."Rubella-containing vaccines"
Draft Medication Request ID for Rubella dose
/* @dynamicValue: Draft Medication Request ID for Rubella dose */ define "Draft Medication Request ID for Rubella dose": First(Encounter."Draft Medication Request for Rubella dose").id
define "Has Guidance": "Guidance" is not null and "Guidance" != ''
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 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
/* 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: Due to the complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used with a Timing or String. */ define fluent function toInterval(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>): case when choice is FHIR.dateTime then Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)] when choice is FHIR.Period then FHIRHelpers.ToInterval(choice as FHIR.Period) when choice is FHIR.instant then Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)] when choice is FHIR.Age then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year) when choice is FHIR.Range then Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low), FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year) when choice is FHIR.Timing then Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') when choice 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 null as Interval<DateTime> end
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 ToDateTime(value instant): value.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
/* @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
/** * @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)
define function ToString(value MedicationRequestStatus): value.value
define function ToString(value MedicationRequestIntent): value.value
Code system ConditionClinicalStatusCodes
IMMZ.D5.DT.Rubella contraindications IMMZ.D5.DT.Rubella contraindications
WHO recommendations for routine immunization - summary tables (January 2025)
Check for contraindications before administering the vaccine(s) due
Contraindication for rubella immunization
Concept { codes: { Code { system: 'http://smart.who.int/immunizations/CodeSystem/IMMZ.Z', code: 'DE17', display: 'Rubella-containing vaccines' } }, display: 'Rubella-containing vaccines' }
Check for Guidance for the patient regarding IMMZ.D5.DT.Rubella contraindications.
Show Guidance for the patient regarding IMMZ.D5.DT.Rubella contraindications.
Code { system: 'http://terminology.hl7.org/CodeSystem/communication-category', code: 'alert' }
Code { system: 'http://hl7.org/fhir/request-priority', code: 'routine' }