maintenance: title: Check for Past Alerts;; mlmname: STD_FUNC_CHECK_PAST_ALERTS;; arden: version 2.5;; version: 18.4;; institution: Allscripts, Standard MLM;; author: Allscripts Healthcare Solutions, Inc.;; specialist: ;; date: 2018-10-26;; validation: testing;; /* P r o p r i e t a r y N o t i c e */ /* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved. P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium, disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users: This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}. All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates. */ /* P r o p r i e t a r y N o t i c e */ library: purpose: This MLM will check for matching alert rule groups and rule numbers that were stored in the database within the past interval of time. ;; explanation: Locates alert matches on RuleGroup, RuleNumber and CreatedWhen that occur within the alert interval. The MLM is passed the rule group, rule number, client, and interval by the calling MLM and returns TRUE if a matching alert is found within the interval. ;; keywords: alert, interval, rule ;; knowledge: type: data-driven;; data: (client_guid, // Client indicator chart_guid, // Chart indicator rule_group, // The rule group for the alert to be matched rule_number, // The rule number for the alert to be matched alert_interval_start, // Start date &time to check for past alerts alert_interval_stop // Stop date &time to check for past alerts ) := ARGUMENT; // Get all matching alerts for the given interval (AD_CreatedWhen, AD_Status, AD_ClientVisitGUID, AD_ClientGUID, AD_ChartGUID, AD_Description, AD_TypeCode, AD_EventType, AD_RuleGroup, AD_RuleNumber) := read{ "SELECT CreatedWhen, Status, ClientVisitGUID, ClientGUID, " || " ChartGUID, Description, TypeCode, EventType, RuleGroup, RuleNumber" || " FROM CV3AlertDeclaration " || " WHERE ClientGUID = " || SQL(client_guid) || " AND ChartGUID = " || SQL(chart_guid) || " AND RuleGroup = " || SQL(rule_group) || " AND RuleNumber = " || SQL(rule_number) || " AND CreatedWhen >= " || SQL(alert_interval_start) // || " AND CreatedWhen <= " || SQL(alert_interval_stop)||")" ,PrimaryTime = CreatedWhen}; ;; evoke: ;; logic: if exists AD_RuleGroup then CheckForAlertInInterval := TRUE; else CheckForAlertInInterval := FALSE; endif; // check to see if alert occurred within the time interval conclude TRUE; ;; action: return CheckForAlertInInterval; ;; end: