Metadata Title Warfarin NSAIDs Order Select Recommendation Version 1.0.0 Experimental true Jurisdiction 001 from http://unstats.un.org/unsd/methods/m49/m49.htm Topic Warfarin NSAIDs Prescribing Steward (Publisher) HL7 International / Clinical Decision Support Description Drug-drug interaction recommendation for use on order select of a warfarin or NSAID Type ECA Rule PlanDefinition Action Trigger Type Named Event Trigger Name order-select Condition Kind: Applicability Logic Definition: Inclusion Criteria PlanDefinition Sub-Action Title Potential Drug-Drug Interaction between warfarin (product) and NSAID (product) Description Topical diclofenac has relatively low systemic absorption; in one study a topical gel (16 g/day) produced about 6% of the absorption seen with systemic administration of 150 mg/day. A higher than recommended dose of topical gel (48 g/day) produced 20% of a systemic dose of diclofenac. Condition Kind: Applicability Logic Definition: Is context medication topical diclofenac Dynamic Value Path: action.title Logic Definition: Get Base Summary Dynamic Value Path: activity.extension Logic Definition: Get Base Indicator PlanDefinition Sub-Action (Parent Action Title: Potential Drug-Drug Interaction between warfarin (product) and NSAID (product)) Title No special precautions PlanDefinition Sub-Action Title Potential Drug-Drug Interaction between warfarin (product) and NSAID (product) Description Increased risk of bleeding. Bleeding is a serious potential clinical consequence because it can result in death, life-threatening hospitalization, and disability. Non-steroidal anti-inflammatory drugs (NSAIDs) have antiplatelet effects which increase the bleeding risk when combined with oral anticoagulants such as warfarin. The antiplatelet effect of NSAIDs lasts only as long as the NSAID is present in the circulation, unlike aspirin’s antiplatelet effect, which lasts for up to 2 weeks after aspirin is discontinued. NSAIDs also can cause peptic ulcers and most of the evidence for increased bleeding risk with NSAIDs plus warfarin is due to upper gastrointestinal bleeding (UGIB). unknown. unknown. Condition Kind: Applicability Logic Definition: Is not context medication topical diclofenac Dynamic Value Path: action.title Logic Definition: Get Base Summary Dynamic Value Path: activity.extension Logic Definition: Get Base Indicator PlanDefinition Sub-Action (Parent Action Title: Potential Drug-Drug Interaction between warfarin (product) and NSAID (product)) Title Assess risk and take action if necessary. Description If the NSAID is being used as an analgesic or antipyretic, it would be prudent to use an alternative such as acetaminophen. In some people, acetaminophen can increase the anticoagulant effect of warfarin, so monitor the INR if acetaminophen is used in doses over 2 g/day for a few days. For more severe pain consider short-term opioids in place of the NSAID. Type remove from http://terminology.hl7.org/CodeSystem/action-type PlanDefinition Sub-Action (Parent Action Title: Potential Drug-Drug Interaction between warfarin (product) and NSAID (product)) Title Substitute NSAID (product) with APAP (product). Description Order for APAP <2g per day (APAP 500 mg every 4-6 hours prn). Type create from http://terminology.hl7.org/CodeSystem/action-type Definition ActivityDefinition AD101 Dynamic Value Path: action.title Logic Definition: Get Base Label 1 PlanDefinition Sub-Action (Parent Action Title: Potential Drug-Drug Interaction between warfarin (product) and NSAID (product)) Title Substitute NSAID (product) with APAP (product). Description Order for APAP <2g per day (APAP 500 mg every 4-6 hours prn). Type create from http://terminology.hl7.org/CodeSystem/action-type Definition ActivityDefinition AD102 Dynamic Value Path: action.title Logic Definition: Get Base Label 2 PlanDefinition Sub-Action Title Patient is (not) taking a proton pump inhibitor (product) or misoprostol (product). Description Proton pump inhibitors and misoprostol may reduce the risk of UGIB in patients receiving NSAIDs and warfarin. Condition Kind: Applicability Logic Definition: Is not context medication topical diclofenac Dynamic Value Path: action.title Logic Definition: Get Card 2 Summary Dynamic Value Path: action.description Logic Definition: Get Card 2 Detail Dynamic Value Path: activity.extension Logic Definition: Get Card 2 Indicator PlanDefinition Sub-Action (Parent Action Title: Patient is (not) taking a proton pump inhibitor (product) or misoprostol (product).) Title Assess risk and take action if necessary. Dynamic Value Path: action.title Logic Definition: Get Card 2 Label PlanDefinition Sub-Action Title Patient is (not) 65 y/o and/or does (not) have a history of upper gastrointestinal bleed Description Patients with a history of UGIB or peptic ulcer may have an increased risk of UGIB from this interaction. The extent to which older age is an independent risk factor for UGIB due to these interactions is not firmly established, but UGIB in general is known to increase with age Condition Kind: Applicability Logic Definition: Is not context medication topical diclofenac Dynamic Value Path: action.title Logic Definition: Get Card 3 Summary Dynamic Value Path: action.description Logic Definition: Get Card 3 Detail Dynamic Value Path: activity.extension Logic Definition: Get Card 3 Indicator PlanDefinition Sub-Action (Parent Action Title: Patient is (not) 65 y/o and/or does (not) have a history of upper gastrointestinal bleed) Title Assess risk and take action if necessary. Dynamic Value Path: action.title Logic Definition: Get Card 3 Label PlanDefinition Sub-Action Title Patient is (not) concomitantly taking systemic corticosteroids, aldosterone antagonist, or high dose or multiple NSAIDs Description Both corticosteroids and aldosterone antagonists have been shown to subsetantially increase the risk of UGIB in patients on NSAIDs, with relative risks of 12.8 and 11 respectively compared to a risk of 4.3 with NSAIDs alone (Masclee et al. Gastroenterology 2014; 147:784-92.) Condition Kind: Applicability Logic Definition: Is not context medication topical diclofenac Dynamic Value Path: action.title Logic Definition: Get Card 4 Summary Dynamic Value Path: action.description Logic Definition: Get Card 4 Detail Dynamic Value Path: activity.extension Logic Definition: Get Card 4 Indicator PlanDefinition Sub-Action (Parent Action Title: Patient is (not) concomitantly taking systemic corticosteroids, aldosterone antagonist, or high dose or multiple NSAIDs) Title Assess risk and take action if necessary. Dynamic Value Path: action.title Logic Definition: Get Card 4 Label PlanDefinition Logic Primary Library Warfarin-NSAIDs CDS Logic Dependency Description: FHIR model information Resource: http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1 Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1 Dependency Description: Library FHIRHelpers Resource: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1 Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1 Dependency Description: Library FHIRCommon Resource: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0 Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0 Dependency Description: Library Common Resource: Potential Drug-Durg Interaction (PDDI) Clinical Decision Support (CDS) Common Logic version: 1.0.0 Canonical URL: http://hl7.org/fhir/uv/pddi/Library/PDDICDSCommon|1.0.0 Dependency Description: Code system RXNORM Resource: RxNorm Canonical URL: http://www.nlm.nih.gov/research/umls/rxnorm Dependency Description: Value set Topical Diclofenac Resource: Topical Diclofenac Medications Value Set Canonical URL: http://hl7.org/fhir/uv/pddi/ValueSet/valueset-topicaldiclofenac Dependency Description: Value set PPIs and Misoprostols Resource: Proton Pump Inhibitor Drug Value Set Canonical URL: http://hl7.org/fhir/uv/pddi/ValueSet/valueset-PPIS Dependency Description: Value set Warfarins Resource: Warfarin Medications Value Set Canonical URL: http://hl7.org/fhir/uv/pddi/ValueSet/valueset-warfarin Dependency Description: Value set NSAIDs Resource: Nonsteroidal Anti-inflammatory Drugs Value Set Canonical URL: http://hl7.org/fhir/uv/pddi/ValueSet/valueset-NSAIDS Dependency Description: Value set History of GI Bleeds Resource: Upper gastrointestinal bleed Value Set Canonical URL: http://hl7.org/fhir/uv/pddi/ValueSet/valueset-Hx-UGIB-snomed Dependency Description: Value set Systemic Corticosteroids Resource: Systemic Corticosteroid Drug Value Set Canonical URL: http://hl7.org/fhir/uv/pddi/ValueSet/valueset-SCS Dependency Description: Value set Aldosterone Antagonists Resource: Aldosterone Antagonists Drug Value Set Canonical URL: http://hl7.org/fhir/uv/pddi/ValueSet/valueset-AAS Parameter Name Use Card. Type Documentation ContextPrescriptions In 0..* MedicationRequest Get Base Indicator Out 0..1 string Get Card 2 Summary Out 0..1 string Inclusion Criteria Out 0..1 boolean Get Card 3 Summary Out 0..1 string Get Card 4 Summary Out 0..1 string Get Card 2 Detail Out 0..1 string Is context medication topical diclofenac Out 0..1 boolean Get Base Label 2 Out 0..1 string Get Card 2 Label Out 0..1 string Get Base Label 1 Out 0..1 string Get Card 4 Detail Out 0..1 string Get Card 4 Indicator Out 0..1 string Get Card 3 Detail Out 0..1 string Get Card 3 Indicator Out 0..1 string Is not context medication topical diclofenac Out 0..1 boolean Get Card 3 Label Out 0..1 string Get Card 2 Indicator Out 0..1 string Get Base Summary Out 0..1 string Get Card 4 Label Out 0..1 string PlanDefinition Logic Data Requirements Data Requirement Type: Patient Profile(s): Patient Data Requirement Type: MedicationRequest Profile(s): MedicationRequest Must Support Elements: medication, authoredOn Code Filter(s): Path: medication ValueSet: Proton Pump Inhibitor Drug Value Set Data Requirement Type: MedicationRequest Profile(s): MedicationRequest Must Support Elements: medication, authoredOn Code Filter(s): Path: medication ValueSet: Warfarin Medications Value Set Data Requirement Type: MedicationRequest Profile(s): MedicationRequest Must Support Elements: medication, authoredOn Code Filter(s): Path: medication ValueSet: Systemic Corticosteroid Drug Value Set Data Requirement Type: MedicationRequest Profile(s): MedicationRequest Must Support Elements: medication, authoredOn Code Filter(s): Path: medication ValueSet: Aldosterone Antagonists Drug Value Set Data Requirement Type: MedicationRequest Profile(s): MedicationRequest Must Support Elements: medication, authoredOn Code Filter(s): Path: medication ValueSet: Nonsteroidal Anti-inflammatory Drugs Value Set Data Requirement Type: MedicationRequest Profile(s): MedicationRequest Must Support Elements: medication.reference, medication, authoredOn Data Requirement Type: Medication Profile(s): Medication Must Support Elements: id, code Data Requirement Type: MedicationAdministration Profile(s): MedicationAdministration Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Proton Pump Inhibitor Drug Value Set Data Requirement Type: MedicationAdministration Profile(s): MedicationAdministration Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Warfarin Medications Value Set Data Requirement Type: MedicationAdministration Profile(s): MedicationAdministration Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Systemic Corticosteroid Drug Value Set Data Requirement Type: MedicationAdministration Profile(s): MedicationAdministration Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Aldosterone Antagonists Drug Value Set Data Requirement Type: MedicationAdministration Profile(s): MedicationAdministration Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Nonsteroidal Anti-inflammatory Drugs Value Set Data Requirement Type: MedicationAdministration Profile(s): MedicationAdministration Must Support Elements: medication.reference, effective, medication Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication, whenHandedOver Code Filter(s): Path: medication ValueSet: Proton Pump Inhibitor Drug Value Set Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication, whenHandedOver Code Filter(s): Path: medication ValueSet: Warfarin Medications Value Set Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication, whenHandedOver Code Filter(s): Path: medication ValueSet: Systemic Corticosteroid Drug Value Set Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication, whenHandedOver Code Filter(s): Path: medication ValueSet: Aldosterone Antagonists Drug Value Set Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication, whenHandedOver Code Filter(s): Path: medication ValueSet: Nonsteroidal Anti-inflammatory Drugs Value Set Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Must Support Elements: medication.reference, whenHandedOver, medication Data Requirement Type: MedicationStatement Profile(s): MedicationStatement Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Proton Pump Inhibitor Drug Value Set Data Requirement Type: MedicationStatement Profile(s): MedicationStatement Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Warfarin Medications Value Set Data Requirement Type: MedicationStatement Profile(s): MedicationStatement Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Systemic Corticosteroid Drug Value Set Data Requirement Type: MedicationStatement Profile(s): MedicationStatement Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Aldosterone Antagonists Drug Value Set Data Requirement Type: MedicationStatement Profile(s): MedicationStatement Must Support Elements: medication, effective Code Filter(s): Path: medication ValueSet: Nonsteroidal Anti-inflammatory Drugs Value Set Data Requirement Type: MedicationStatement Profile(s): MedicationStatement Must Support Elements: medication.reference, effective, medication Data Requirement Type: Condition Profile(s): Condition Must Support Elements: code Code Filter(s): Path: code ValueSet: Upper gastrointestinal bleed Value Set Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Topical Diclofenac Prescription": ContextPrescriptions P where P.medication in "Topical Diclofenac" return P.medication as CodeableConcept Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Is context medication topical diclofenac": exists ("Topical Diclofenac Prescription") Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Base Indicator": if "Is context medication topical diclofenac" then 'info' else 'warning' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "PPIs and Misoprostols Rx": ( [MedicationRequest: "PPIs and Misoprostols"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "PPIs and Misoprostols"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "PPIs and Misoprostols"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "PPIs and Misoprostols"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept ) Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Taking PPI or misoprostol": exists ("PPIs and Misoprostols Rx") Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 2 Summary": if "Taking PPI or misoprostol" then 'Patient is taking a proton pump inhibitor (' + Common.GetDrugNames("PPIs and Misoprostols Rx") + ').' else 'Patient is not taking a proton pump inhibitor or misoprostol.' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Warfarin Rx": ( [MedicationRequest: "Warfarins"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "Warfarins"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "Warfarins"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "Warfarins"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept ) Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Is warfarin in prefetch": exists ("Warfarin Rx") Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "NSAID Prescription": ContextPrescriptions P where P.medication in "NSAIDs" return P.medication as CodeableConcept Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Is context medication systemic NSAID": exists ("NSAID Prescription") Logic Definition Library Name: WarfarinNSAIDsCDSLogic /* ** ** Warfarin NSAID CDS Recommendation ** */ define "Inclusion Criteria": if "Is context medication topical diclofenac" then "Is warfarin in prefetch" else ( "Is context medication systemic NSAID" and "Is warfarin in prefetch" ) Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "GI Bleeds Condition": Last( [Condition: "History of GI Bleeds"] C sort by assertedDate().value ) Logic Definition Library Name: WarfarinNSAIDsCDSLogic -65-years-or-hx-ugib"> define "Age > 65 years or Hx UGIB": "GI Bleeds Condition" is not null or AgeInYears() > 65 Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 3 Summary": if "Age > 65 years or Hx UGIB" then 'Patient is 65 y/o or does have a history of upper gastrointestinal bleed ("' + Common.GetConditionName("GI Bleeds Condition") + '" and ' + Common.GetAssertedDate("GI Bleeds Condition") + ').' else 'Patient is not 65 y/o and does not have a history of upper gastrointestinal bleed.' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Systemic Corticosteroids Rx": ( [MedicationRequest: "Systemic Corticosteroids"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "Systemic Corticosteroids"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "Systemic Corticosteroids"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "Systemic Corticosteroids"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept ) Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Has Systemic Corticosteroids": exists ("Systemic Corticosteroids Rx") Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Aldosterone Antagonists Rx": ( [MedicationRequest: "Aldosterone Antagonists"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "Aldosterone Antagonists"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "Aldosterone Antagonists"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "Aldosterone Antagonists"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept ) Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Has Aldosterone Antagonists": exists ("Aldosterone Antagonists Rx") Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "NSAID Rx": ( [MedicationRequest: "NSAIDs"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "NSAIDs"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "NSAIDs"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "NSAIDs"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept ) Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Has NSAID": exists ("NSAID Rx") Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Taking CS, MCRA, or NSAID": "Has Systemic Corticosteroids" or "Has Aldosterone Antagonists" or "Has NSAID" Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 4 Summary": if "Taking CS, MCRA, or NSAID" then 'Patient is concomitantly taking systemic corticosteroids (' + Common.GetDrugNames("Systemic Corticosteroids Rx") + '), aldosterone antagonist (' + Common.GetDrugNames("Aldosterone Antagonists Rx") + '), or high dose or multiple NSAIDs (' + Common.GetDrugNames("NSAID Rx") + ').' else 'Patient is not concomitantly taking systemic corticosteroids, aldosterone antagonist, or high dose or multiple NSAIDs.' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 2 Detail": 'Proton pump inhibitors and misoprostol may reduce the risk of UGIB in patients receiving NSAIDs and warfarin.' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Acetaminophen 500 MG": Code '198440' from "RXNORM" display 'Acetaminophen 500 MG Oral Tablet' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Base Label 2": 'Substitute NSAID (' + Common.GetDrugNames("NSAID Prescription") + ') with APAP (' + Common.ToString("Acetaminophen 500 MG") + ').' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 2 Label": if "Taking PPI or misoprostol" then 'Assess risk and take action if necessary.' else 'Use only if benefit outweighs risk.' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Acetaminophen 325 MG": Code '313782' from "RXNORM" display 'Acetaminophen 325 MG Oral Tablet' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Base Label 1": 'Substitute NSAID (' + Common.GetDrugNames("NSAID Prescription") + ') with APAP (' + Common.ToString("Acetaminophen 325 MG") + ').' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 4 Detail": 'Both corticosteroids and aldosterone antagonists have been shown to subsetantially increase the risk of UGIB in patients on NSAIDs, with relative risks of 12.8 and 11 respectively compared to a risk of 4.3 with NSAIDs alone (Masclee et al. Gastroenterology 2014; 147:784-92.)' Logic Definition Library Name: WarfarinNSAIDsCDSLogic // Card 4: Systemic Corticosteroids or Aldosterone Antagonist define "Get Card 4 Indicator": if "Taking CS, MCRA, or NSAID" then 'warning' else 'info' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 3 Detail": 'Patients with a history of UGIB or peptic ulcer may have an increased risk of UGIB from this interaction. The extent to which older age is an independent risk factor for UGIB due to these interactions is not firmly established, but UGIB in general is known to increase with age.' Logic Definition Library Name: WarfarinNSAIDsCDSLogic // Card 3: History of UGIB/peptic ulcer or > 65 years old define "Get Card 3 Indicator": if "Age > 65 years or Hx UGIB" then 'warning' else 'info' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Is not context medication topical diclofenac": not exists ("Topical Diclofenac Prescription") Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 3 Label": if "Taking PPI or misoprostol" then 'Assess risk and take action if necessary.' else if "Age > 65 years or Hx UGIB" then 'Use only if benefit outweighs risk.' else 'Assess risk and take action if necessary.' Logic Definition Library Name: WarfarinNSAIDsCDSLogic // Card 2: PPI or misoprostol define "Get Card 2 Indicator": if "Taking PPI or misoprostol" then 'info' else 'critical' Logic Definition Library Name: WarfarinNSAIDsCDSLogic // Card 1: Base define "Get Base Summary": 'Potential Drug-Drug Interaction between warfarin (' + Common.GetDrugNames("Warfarin Rx") + ') and NSAID (' + Common.GetDrugNames("NSAID Prescription") + ').' Logic Definition Library Name: WarfarinNSAIDsCDSLogic define "Get Card 4 Label": if "Taking PPI or misoprostol" then 'Assess risk and take action if necessary.' else if "Taking CS, MCRA, or NSAID" then 'Use only if benefit outweighs risk.' else 'Assess risk and take action if necessary.' Logic Definition Library Name: FHIRCommon /* @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 Logic Definition Library Name: FHIRCommon /* @description: Returns the single extension (if present) on the given resource with the specified url. @comment: This function uses singleton from to ensure that a run-time exception is thrown if there is more than one extension on the given resource with the specified url. */ define fluent function ext(domainResource DomainResource, url String): singleton from domainResource.exts(url) Logic Definition Library Name: FHIRCommon /* @description: Returns any extensions defined on the given resource with the specified url */ define fluent function exts(domainResource DomainResource, url String): domainResource.extension E where E.url = url return E Logic Definition Library Name: FHIRHelpers /* @description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept. */ 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 } Logic Definition Library Name: FHIRHelpers /* @description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code. */ 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 } Logic Definition Library Name: FHIRHelpers define function ToString(value string): value.value Logic Definition Library Name: FHIRHelpers define function ToDateTime(value dateTime): value.value Logic Definition Library Name: FHIRHelpers /* @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period) value to a CQL DateTime Interval @comment: If the start value of the given period is unspecified, the starting boundary of the resulting interval will be open (meaning the start of the interval is unknown, as opposed to interpreted as the beginning of time). */ 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] Logic Definition Library Name: FHIRHelpers define function ToDateTime(value instant): value.value Logic Definition Library Name: FHIRHelpers define function ToDate(value date): value.value Logic Definition Library Name: FHIRHelpers /* @description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) value to a CQL Quantity @comment: If the given quantity has a comparator specified, a runtime error is raised. If the given quantity has a system other than UCUM (i.e. `http://unitsofmeasure.org`) or CQL calendar units (i.e. `http://hl7.org/fhirpath/CodeSystem/calendar-units`) an error is raised. For UCUM to calendar units, the `ToCalendarUnit` function is used. @seealso: ToCalendarUnit */ 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 Logic Definition Library Name: FHIRHelpers /* @description: Converts a UCUM definite duration unit to a CQL calendar duration unit using conversions specified in the [quantities](https://cql.hl7.org/02-authorsguide.html#quantities) topic of the CQL specification. @comment: Note that for durations above days (or weeks), the conversion is understood to be approximate */ 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 Logic Definition Library Name: FHIRHelpers define function ToString(value uri): value.value Logic Definition Library Name: PDDICDSCommon define function GetDrugNames(codes List<FHIR.CodeableConcept>): Combine( flatten( codes C return C.coding coding return ToCode(coding).display ) ,', ' ) Logic Definition Library Name: PDDICDSCommon define function ToCode(coding FHIR.Coding): System.Code { code: coding.code.value, system: coding.system.value, version: coding.version.value, display: coding.display.value } Logic Definition Library Name: PDDICDSCommon define fluent function assertedDate(condition Condition): condition.ext('http://hl7.org/fhir/StructureDefinition/condition-assertedDate').value as dateTime Logic Definition Library Name: PDDICDSCommon define function GetConditionName(condition Condition): if condition is not null then condition.code.coding[0].display.value else 'NA' Logic Definition Library Name: PDDICDSCommon define function GetAssertedDate(condition Condition): if condition is not null then ToString(condition.assertedDate().value) else 'NA' Logic Definition Library Name: PDDICDSCommon define function ToString(value Code): value.display Generated using version 0.5.6-cibuild of the sample-content-ig Liquid templates
define "Topical Diclofenac Prescription": ContextPrescriptions P where P.medication in "Topical Diclofenac" return P.medication as CodeableConcept
Is context medication topical diclofenac
define "Is context medication topical diclofenac": exists ("Topical Diclofenac Prescription")
define "Get Base Indicator": if "Is context medication topical diclofenac" then 'info' else 'warning'
define "PPIs and Misoprostols Rx": ( [MedicationRequest: "PPIs and Misoprostols"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "PPIs and Misoprostols"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "PPIs and Misoprostols"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "PPIs and Misoprostols"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept )
define "Taking PPI or misoprostol": exists ("PPIs and Misoprostols Rx")
define "Get Card 2 Summary": if "Taking PPI or misoprostol" then 'Patient is taking a proton pump inhibitor (' + Common.GetDrugNames("PPIs and Misoprostols Rx") + ').' else 'Patient is not taking a proton pump inhibitor or misoprostol.'
define "Warfarin Rx": ( [MedicationRequest: "Warfarins"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "Warfarins"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "Warfarins"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "Warfarins"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept )
define "Is warfarin in prefetch": exists ("Warfarin Rx")
define "NSAID Prescription": ContextPrescriptions P where P.medication in "NSAIDs" return P.medication as CodeableConcept
define "Is context medication systemic NSAID": exists ("NSAID Prescription")
/* ** ** Warfarin NSAID CDS Recommendation ** */ define "Inclusion Criteria": if "Is context medication topical diclofenac" then "Is warfarin in prefetch" else ( "Is context medication systemic NSAID" and "Is warfarin in prefetch" )
define "GI Bleeds Condition": Last( [Condition: "History of GI Bleeds"] C sort by assertedDate().value )
define "Age > 65 years or Hx UGIB": "GI Bleeds Condition" is not null or AgeInYears() > 65
define "Get Card 3 Summary": if "Age > 65 years or Hx UGIB" then 'Patient is 65 y/o or does have a history of upper gastrointestinal bleed ("' + Common.GetConditionName("GI Bleeds Condition") + '" and ' + Common.GetAssertedDate("GI Bleeds Condition") + ').' else 'Patient is not 65 y/o and does not have a history of upper gastrointestinal bleed.'
define "Systemic Corticosteroids Rx": ( [MedicationRequest: "Systemic Corticosteroids"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "Systemic Corticosteroids"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "Systemic Corticosteroids"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "Systemic Corticosteroids"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept )
define "Has Systemic Corticosteroids": exists ("Systemic Corticosteroids Rx")
define "Aldosterone Antagonists Rx": ( [MedicationRequest: "Aldosterone Antagonists"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "Aldosterone Antagonists"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "Aldosterone Antagonists"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "Aldosterone Antagonists"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept )
define "Has Aldosterone Antagonists": exists ("Aldosterone Antagonists Rx")
define "NSAID Rx": ( [MedicationRequest: "NSAIDs"] MR where MR.authoredOn.toInterval() during Interval[Today() - 100 days, null] return MR.medication as CodeableConcept ) union ( [MedicationAdministration: "NSAIDs"] MA where MA.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MA.medication as CodeableConcept ) union ( [MedicationDispense: "NSAIDs"] MD where MD.whenHandedOver.toInterval() during Interval[Today() - 100 days, null] return MD.medication as CodeableConcept ) union ( [MedicationStatement: "NSAIDs"] MS where MS.effective.toInterval() overlaps Interval[Today() - 100 days, null] return MS.medication as CodeableConcept )
define "Has NSAID": exists ("NSAID Rx")
define "Taking CS, MCRA, or NSAID": "Has Systemic Corticosteroids" or "Has Aldosterone Antagonists" or "Has NSAID"
define "Get Card 4 Summary": if "Taking CS, MCRA, or NSAID" then 'Patient is concomitantly taking systemic corticosteroids (' + Common.GetDrugNames("Systemic Corticosteroids Rx") + '), aldosterone antagonist (' + Common.GetDrugNames("Aldosterone Antagonists Rx") + '), or high dose or multiple NSAIDs (' + Common.GetDrugNames("NSAID Rx") + ').' else 'Patient is not concomitantly taking systemic corticosteroids, aldosterone antagonist, or high dose or multiple NSAIDs.'
define "Get Card 2 Detail": 'Proton pump inhibitors and misoprostol may reduce the risk of UGIB in patients receiving NSAIDs and warfarin.'
define "Acetaminophen 500 MG": Code '198440' from "RXNORM" display 'Acetaminophen 500 MG Oral Tablet'
define "Get Base Label 2": 'Substitute NSAID (' + Common.GetDrugNames("NSAID Prescription") + ') with APAP (' + Common.ToString("Acetaminophen 500 MG") + ').'
define "Get Card 2 Label": if "Taking PPI or misoprostol" then 'Assess risk and take action if necessary.' else 'Use only if benefit outweighs risk.'
define "Acetaminophen 325 MG": Code '313782' from "RXNORM" display 'Acetaminophen 325 MG Oral Tablet'
define "Get Base Label 1": 'Substitute NSAID (' + Common.GetDrugNames("NSAID Prescription") + ') with APAP (' + Common.ToString("Acetaminophen 325 MG") + ').'
define "Get Card 4 Detail": 'Both corticosteroids and aldosterone antagonists have been shown to subsetantially increase the risk of UGIB in patients on NSAIDs, with relative risks of 12.8 and 11 respectively compared to a risk of 4.3 with NSAIDs alone (Masclee et al. Gastroenterology 2014; 147:784-92.)'
// Card 4: Systemic Corticosteroids or Aldosterone Antagonist define "Get Card 4 Indicator": if "Taking CS, MCRA, or NSAID" then 'warning' else 'info'
define "Get Card 3 Detail": 'Patients with a history of UGIB or peptic ulcer may have an increased risk of UGIB from this interaction. The extent to which older age is an independent risk factor for UGIB due to these interactions is not firmly established, but UGIB in general is known to increase with age.'
// Card 3: History of UGIB/peptic ulcer or > 65 years old define "Get Card 3 Indicator": if "Age > 65 years or Hx UGIB" then 'warning' else 'info'
Is not context medication topical diclofenac
define "Is not context medication topical diclofenac": not exists ("Topical Diclofenac Prescription")
define "Get Card 3 Label": if "Taking PPI or misoprostol" then 'Assess risk and take action if necessary.' else if "Age > 65 years or Hx UGIB" then 'Use only if benefit outweighs risk.' else 'Assess risk and take action if necessary.'
// Card 2: PPI or misoprostol define "Get Card 2 Indicator": if "Taking PPI or misoprostol" then 'info' else 'critical'
// Card 1: Base define "Get Base Summary": 'Potential Drug-Drug Interaction between warfarin (' + Common.GetDrugNames("Warfarin Rx") + ') and NSAID (' + Common.GetDrugNames("NSAID Prescription") + ').'
define "Get Card 4 Label": if "Taking PPI or misoprostol" then 'Assess risk and take action if necessary.' else if "Taking CS, MCRA, or NSAID" then 'Use only if benefit outweighs risk.' else 'Assess risk and take action if necessary.'
/* @description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept. */ 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 }
/* @description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code. */ 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 }
define function ToString(value string): value.value
/* @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
/* @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period) value to a CQL DateTime Interval @comment: If the start value of the given period is unspecified, the starting boundary of the resulting interval will be open (meaning the start of the interval is unknown, as opposed to interpreted as the beginning of time). */ 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
/* @description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) value to a CQL Quantity @comment: If the given quantity has a comparator specified, a runtime error is raised. If the given quantity has a system other than UCUM (i.e. `http://unitsofmeasure.org`) or CQL calendar units (i.e. `http://hl7.org/fhirpath/CodeSystem/calendar-units`) an error is raised. For UCUM to calendar units, the `ToCalendarUnit` function is used. @seealso: ToCalendarUnit */ 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
/* @description: Converts a UCUM definite duration unit to a CQL calendar duration unit using conversions specified in the [quantities](https://cql.hl7.org/02-authorsguide.html#quantities) topic of the CQL specification. @comment: Note that for durations above days (or weeks), the conversion is understood to be approximate */ 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
define function GetDrugNames(codes List<FHIR.CodeableConcept>): Combine( flatten( codes C return C.coding coding return ToCode(coding).display ) ,', ' )
define function ToCode(coding FHIR.Coding): System.Code { code: coding.code.value, system: coding.system.value, version: coding.version.value, display: coding.display.value }
define fluent function assertedDate(condition Condition): condition.ext('http://hl7.org/fhir/StructureDefinition/condition-assertedDate').value as dateTime
/* @description: Returns the single extension (if present) on the given resource with the specified url. @comment: This function uses singleton from to ensure that a run-time exception is thrown if there is more than one extension on the given resource with the specified url. */ define fluent function ext(domainResource DomainResource, url String): singleton from domainResource.exts(url)
/* @description: Returns any extensions defined on the given resource with the specified url */ define fluent function exts(domainResource DomainResource, url String): domainResource.extension E where E.url = url return E
define function ToString(value uri): value.value
define function GetConditionName(condition Condition): if condition is not null then condition.code.coding[0].display.value else 'NA'
define function GetAssertedDate(condition Condition): if condition is not null then ToString(condition.assertedDate().value) else 'NA'
define function ToString(value Code): value.display
Cache information about this CDS call so that additional filtering of card responses can be done when the service is called using an order-sign CDS Hook request. Currently, this only supports filtering out cards that were triggered by the same knowledge artifact when the physician reference display, encounter id, and patient id match between the order-select and order-sign requests. Filtering will happen if both this configuration option is set to 'true' and order-sign requests set filter-out-repeated-alerts to 'true'.
Alert for non-serious potential drug-drug interactions
Serious potential drug-drug interactions could result in death; requires hospitalization or extension of hospital stay; results in persistent or significant disability or incapacity; is life-threatening (see https://www.w3.org/2019/05/pddi/index.html). If set to True, this configuration option tells the CDS service to alerts for potential drug-drug interactions that do not meet this criterion.
If this options is set to True, CDS response cards will provide more complete information about the evidence that supports the potential drug-drug interaction alert.
Warfarin NSAIDs Order Select Recommendation
HL7 International / Clinical Decision Support
Drug-drug interaction recommendation for use on order select of a warfarin or NSAID
Warfarin-NSAIDs clinical decision support algorithm
Potential Drug-Drug Interaction between warfarin (product) and NSAID (product)
Topical diclofenac has relatively low systemic absorption; in one study a topical gel (16 g/day) produced about 6% of the absorption seen with systemic administration of 150 mg/day. A higher than recommended dose of topical gel (48 g/day) produced 20% of a systemic dose of diclofenac.
Increased risk of bleeding. Bleeding is a serious potential clinical consequence because it can result in death, life-threatening hospitalization, and disability. Non-steroidal anti-inflammatory drugs (NSAIDs) have antiplatelet effects which increase the bleeding risk when combined with oral anticoagulants such as warfarin. The antiplatelet effect of NSAIDs lasts only as long as the NSAID is present in the circulation, unlike aspirin’s antiplatelet effect, which lasts for up to 2 weeks after aspirin is discontinued. NSAIDs also can cause peptic ulcers and most of the evidence for increased bleeding risk with NSAIDs plus warfarin is due to upper gastrointestinal bleeding (UGIB). unknown. unknown.
Assess risk and take action if necessary.
If the NSAID is being used as an analgesic or antipyretic, it would be prudent to use an alternative such as acetaminophen. In some people, acetaminophen can increase the anticoagulant effect of warfarin, so monitor the INR if acetaminophen is used in doses over 2 g/day for a few days. For more severe pain consider short-term opioids in place of the NSAID.
Substitute NSAID (product) with APAP (product).
Order for APAP <2g per day (APAP 500 mg every 4-6 hours prn).
Patient is (not) taking a proton pump inhibitor (product) or misoprostol (product).
Proton pump inhibitors and misoprostol may reduce the risk of UGIB in patients receiving NSAIDs and warfarin.
Patient is (not) 65 y/o and/or does (not) have a history of upper gastrointestinal bleed
Patients with a history of UGIB or peptic ulcer may have an increased risk of UGIB from this interaction. The extent to which older age is an independent risk factor for UGIB due to these interactions is not firmly established, but UGIB in general is known to increase with age
Patient is (not) concomitantly taking systemic corticosteroids, aldosterone antagonist, or high dose or multiple NSAIDs
Both corticosteroids and aldosterone antagonists have been shown to subsetantially increase the risk of UGIB in patients on NSAIDs, with relative risks of 12.8 and 11 respectively compared to a risk of 4.3 with NSAIDs alone (Masclee et al. Gastroenterology 2014; 147:784-92.)