Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,553 @@
maintenance:
title: SCH_RANOLAZINE_MEDICATION_ALERTS;;
mlmname: SCH_RANOLAZINE_MEDICATION_ALERTS;;
arden: version 2.5;;
version: 15.10;;
institution: St Clair;;
author: Teresa Spicuzza, Allscripts Corp;;
specialist: Amy Georgulis;;
date: 2016-08-17;;
validation: testing;;
library:
purpose: Ranolazine Medication Alerts
;;
explanation: MLM will alert user when any of the conflicting medications in the evoke statement are ordered with ranolazine greater then 500mg BID.
Change history
08.17.2016 TMS New Alert MLM based off existing Statin Alerts for Ranolazine.
05.16.2018 TMS Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered. CSR 33940
09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
group. CSR 37977
;;
keywords: Ranolazine Medication Alert
;;
knowledge:
type: data-driven;;
data:
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
error_occurred := false;
error_message := "";
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
log_execution_info := false;
//Set the text for this variable to indicate whether to send the message or not
send_alert := "DoNotSend";
//--------------------------------------------------------------------
if called_by_editor then
EvokingObject := read last {Order: THIS
where Name="Ranolazine 500mg Tab" };
endif;
SP := " ";
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
TAB := 9 formatted with "%c";
messageA := SP;
messageB := SP;
messageC := SP;
ordered_ranolazine := false;
continue_processing := false;
// rule_matches := false;
do_alert := false;
found_unsubmitted_conflicting_meds := false;
found_unsubmitted_ranolazine_meds := false;
found_existing_conflicting_meds := false;
msg_string := "";
alert_msg_lst := ();
//Declare the MLM that creates action on alert object
create_aoa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
aoa_ActionItemStatus := "";
aoa_ActionItemID := "";
aoa_ActionItemName := "";
aoa_ActionEnterpriseItemID := "";
aa_lst := ();
ranolazine_order_enter := event { OrderEnter User Order: where TypeCode = "Medication"
and Name matches pattern "Ranolazine%"};
conflicting_order_enter := event { OrderEnter User Order: where TypeCode = "Medication"
and (Name = "Erythromycin:"
or Name = "Erythromycin 250mg EC Tab"
or Name = "Erythromycin 500mg EC Tab"
or Name = "Erythromycin Ethylsuccinate Susp"
or Name matches pattern "Fluconazole%"
or Name matches pattern "Verapamil%"
or Name matches pattern "Diltiazem%")
};
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
(user_id,userguid) :=read last {UserInfo: idcode, guid};
UserCode, OrderRole := read last
{"Select occupationcode, orderroletype "
||" From cv3user with (nolock) "
||" Where Guid = " || SQL(userguid) };
fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
If usercode in fire_on_UserCPOE then
alert_settings := "";
UDDD_dictionary_name := "";
UDDD_is_restricted := FALSE;
else
alert_settings := "Must Comment";
UDDD_dictionary_name := "AlertAckComment";
UDDD_is_restricted := TRUE;
endif;
ranolazine_alert_dest := destination {alert} with
[alert_type := "Warning",
short_message := "Ranolazine Medication Alert",
priority := "Low",
scope := "Chart",
rule_group := "Ranolazine Meds",
rule_number := 4065,
send_with_order := send_alert,
alert_dialog_settings := alert_settings,
ack_comment_UDDD := UDDD_dictionary_name,
ack_comment_UDDD_is_restricted := UDDD_is_restricted,
display_alert := true];
//Retrieve values from Evoking Object
(ClientGUID, ChartGUID, VisitGUID,
evoking_OrderName, evoking_OrderGUID,
evoking_SignificantDtm, CatalogItemObj,
orderedUOMValue, orderedDoseValue, FrequencyValue,UserSchedType ,UserSchedDays, UserSchedDoses) := read last { Order : ClientGUID, ChartGUID, ClientVisitGUID, Name, GUID, SignificantDtm,
OrderCatalogMasterItem, UOM, DosageLow, FrequencyCode, Interval, DaysInInterval, DoseMultiplier
REFERENCING EvokingObject };
OrderAdditionalInfoObj := read last { Order: OrderAdditionalInfo
REFERENCING EvokingObject };
/* Get information from the OrderAdditionalInfo object */
(SummaryLine, FreqfromTime,FreqUOM) := read last { OrderAdditionalInfo: FreqSummaryLine, FreqFromTime, FreqUOM
REFERENCING OrderAdditionalInfoObj };
If (evoking_ordername matches pattern "Ranolazine%") then
if ((orderedDoseValue as number) > 500) then
ordertype := "ranolazine";
continue_processing := true;
highdose := true;
else
highdose := false;
ordertype := "ranolazine";
continue_processing := true;
endif;
else
continue_processing := true;
ordertype := "conflicting";
endif;
//check for ranolazine schedule > BID
If continue_processing = true and ordertype = "ranolazine" and highdose = false then
(schedtime, freqcode, timefrom, timeuom) := read last
{" select fsd.ScheduledTime, cft.FrequencyCode, cft.TimeFromValue, cft.TimeUom from CV3CodedFreqTranslation cft"
|| " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
|| " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}<Default>{{{SINGLE-QUOTE}}} and cft.Active = 1"
|| " order by fsd.ScheduledTime "
};
(TimesPerDay) := read last {" select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft"
|| " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
|| " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}<Default>{{{SINGLE-QUOTE}}} and cft.Active = 1"
};
Oncegroup := ("Now", "STAT", "Once", "One Time", "Today,", "Load", "Pre-procedure",
"Post-procedure","Pre-Transfusion", "Post-Transfusion","Between Blood",
"PRE OP,", "POST OP", "As Ordered", "As Directed", "Given in Infusion Center",
"Given in Delivery Room","With Dialysis Treatment");
If frequencyvalue in Oncegroup then
frequencygroup := "OneTime";
else frequencygroup := "Other";
endif;
if continue_processing = true and highdose = false then
If frequencyvalue <> "<User Schedule>" and frequencygroup <> "OneTime" then
If timefrom = 1 and timeuom = "day" then
If TimesPerDay > 2 then
TooFrequent := true;
continue_processing := true;
else
continue_processing := false;
endif;
endif;
ElseIf frequencyvalue = "<User Schedule>" then
If UserSchedType = "Daily" and UserSchedDoses > 2 and FreqFromTime = 1 and FreqUom = "day" then
TooFrequent := true;
continue_processing := true;
else TooFrequent := false;
continue_processing := false;
endif;
else TooFrequent := false;
continue_processing := false;
endif; //If frequencyvalue = "<User Schedule>"
endif; // if continue_processing = true and highdose = false
endif; //If continue_processing = true and ordertype = "ranolazine" and highdose = false
if continue_processing = true and ordertype = "ranolazine" and (toofrequent = true or highdose = true) then
//Get list of unsubmitted orders that conflict with Ranolazine med
(conf_unsub_med_list,
conf_unsub_med_dose,
conf_unsub_med_UOM,
conf_unsub_oGUID,
conf_unsub_oCatGUID) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID
WHERE ( ( NAME matches pattern "Diltiazem%")
OR ( NAME matches pattern "Diltiazem%")
OR ( NAME matches pattern "Diltiazem%" )
OR ((NAME matches pattern "Erythromycin%") and (FormCode <> "Oint"))
OR (NAME matches pattern "Fluconazole%" )
OR (NAME matches pattern "Verapamil%" ) )};
if ( exists conf_unsub_med_list ) then
found_unsubmitted_conflicting_meds := true;
continue_processing := true;
// rule_matches := true;
endif;
//Get a list of relevant existing medications that conflict with ranolazine
(conf_existing_meds_list,
conf_existing_meds_name,
conf_existing_meds_dose,
conf_existing_meds_UOM,
conf_existing_order_guid,
conf_existing_oCat_guid ) := read {"SELECT LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1)), o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID "
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.ClientGUID = o.ClientGUID"
|| " AND cv.GUID = o.ClientVisitGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " JOIN CV3OrderAddnlInfo oai WITH (NOLOCK)"
|| " ON o.GUID = oai.GUID"
|| " JOIN CV3OrderTask ot WITH (NOLOCK)"
|| " ON o.GUID = ot.OrderGUID "
|| " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
|| " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
|| " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
|| " AND ((o.Name LIKE {{{SINGLE-QUOTE}}}diltiazem%{{{SINGLE-QUOTE}}} )"
|| " OR (o.Name like {{{SINGLE-QUOTE}}}erythromycin%{{{SINGLE-QUOTE}}} AND ot.OrderForm not in ({{{SINGLE-QUOTE}}}oint{{{SINGLE-QUOTE}}}))"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}fluconazole%{{{SINGLE-QUOTE}}} )"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}verapamil%{{{SINGLE-QUOTE}}} ))"
|| " AND ((o.OrderStatusLevelNum > 15)"
|| " AND (o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
if ( exists conf_existing_meds_list ) then
// rule_matches := true;
continue_processing := true;
found_existing_conflicting_meds := true;
endif;
endif; //If continue_processing = true and ordertype = "ranolazine"
If continue_processing = true
and ordertype = "ranolazine"
and (toofrequent = true or highdose = true)
and found_existing_conflicting_meds = false
and found_unsubmitted_conflicting_meds = false then
continue_processing := false;
endif;
If continue_processing = true and ordertype = "conflicting" then
//Ordered med was a medication that conflicts with ranolazine
//Look for an unsubmitted order for a ranolozine orders
(unsub_ranolazine_list,
unsub_ranolazine_dose,
unsub_ranolazine_UOM,
unsub_ranolazine_oGUID,
unsub_ranolazine_oCatGUID,
unsub_ranolazine_FrequencyValue,
unsub_ranolazine_UserSchedType,
unsub_ranolazine_UserSchedDays,
unsub_ranolazine_UserSchedDoses ) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID, FrequencyCode, Interval, DaysInInterval, DoseMultiplier
WHERE ( NAME matches pattern "Ranolazine%" AND UOM = "mg")};
unsubhighdose := false;
UnsubTooFrequent := false;
if ( exists unsub_ranolazine_list ) then
for j in (1 seqto count unsub_ranolazine_list ) do
if (unsub_ranolazine_dose[j] as number) > 500 then
unsubhighdose := true;
endif;
If unsub_ranolazine_FrequencyValue[j] <> "<User Schedule>" then
Thisfrequency := unsub_ranolazine_FrequencyValue[j] ;
(UnsubTimesPerDay) := read last {" select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft"
|| " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
|| " where cft.FrequencyCode = " || sql(ThisFrequency)|| " and FrequencyClass = {{{SINGLE-QUOTE}}}<Default>{{{SINGLE-QUOTE}}} and cft.Active = 1"
};
If UnsubTimesPerDay > 2 then
UnsubTooFrequent := true;
continue_processing := true;
endif;
elseif unsub_ranolazine_FrequencyValue[j] = "<User Schedule>" then
if unsub_ranolazine_UserSchedType[j] = "Daily" and
unsub_ranolazine_UserSchedDays[j] = 1 and
unsub_ranolazine_UserSchedDoses[j] > 2 then
UnsubTooFrequent := true;
endif;
endif;
enddo;
endif;
If unsubtoofrequent = true or unsubhighdose = true then
found_unsubmitted_ranolazine_meds := true;
continue_processing := true;
endif;
//Look for an existing ranolazine order on patient{{{SINGLE-QUOTE}}}s chart
(existing_ranolazine_list,
existing_ranolazine_med,
existing_ranolazine_dose,
existing_ranolazine_UOM,
existing_ranolazine_oGUID,
existing_ranolazine_oCatGUID,
existing_ranolozine_task_Guid,
existing_ranolazine_freq,
existing_ranolazine_sched) := read {"SELECT LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1)), o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID, ot.GUID, o.frequencycode, ot.TaskScheduleDisplay"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.ClientGUID = o.ClientGUID"
|| " AND cv.GUID = o.ClientVisitGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " JOIN CV3OrderAddnlInfo oai WITH (NOLOCK)"
|| " ON o.GUID = oai.GUID"
|| " JOIN CV3OrderTask ot WITH (NOLOCK)"
|| " ON o.GUID = ot.OrderGUID"
|| " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
|| " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
|| " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
|| " AND (o.Name LIKE {{{SINGLE-QUOTE}}}ranolazine%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
if ( exists existing_ranolazine_list ) then
existhighdose := false;
existingtoofrequent := false;
found_existing_ranolazine_meds := false;
for c in ( 1 seqto count existing_ranolazine_dose ) do
if (existing_ranolazine_dose[c] as number) > 500 then
existhighdose := true;
endif;
if existing_ranolazine_sched [c] is not null then
countdoses := 0;
timelist := existing_ranolazine_sched[c];
parsedose := call str_parse with timelist, ",";
countdoses := count parsedose;
if countdoses > 2 then
existingtoofrequent := true;
endif;
endif;
enddo;
if existhighdose = true or existingtoofrequent = true then
found_existing_ranolazine_meds := true;
else
found_existing_ranolazine_meds := false;
endif;
else
found_existing_ranolazine_meds := false;
endif; //if ( exists existing_ranolazine_list )
endif; // continue processing and conflicting drug
if continue_processing = true and ordertype = "conflicting" and found_existing_ranolazine_meds = false and found_unsubmitted_ranolazine_meds = false then
continue_processing := false;
endif;
if (continue_processing) then
do_alert := true;
if ( found_unsubmitted_conflicting_meds ) then
//Conflict med in unsub list?
for k in ( 1 seqto count conf_unsub_med_list ) do
if ( do_alert ) then
msg_string := "{{+B}}The dosage of Ranolazine should not exceed 500mg twice a day when given with "
|| conf_unsub_med_list[k] ||". Decrease ranolizine dose or discontinue "|| conf_unsub_med_list[k] || " and use an alternative agent. {{-B}}" ;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.ObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Unsubmitted";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := conf_unsub_oGUID[k];
alert_action.ActionItemName := conf_unsub_med_list[k];
alert_action.ActionEnterpriseItemID := conf_unsub_oCatGUID[k];
alert_action.MLMName := "SCH_RANOLAZINE_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the UNSUBMITTED Medication to DC-Cancel. This medication conflicts with the Ranolazine medication you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
enddo;
endif; // ( found_unsubmitted_conflicting_meds )
//Conflict med in existing meds list?
If ( found_existing_conflicting_meds ) then
for j in ( 1 seqto count conf_existing_meds_list ) do
if ( do_alert ) then
msg_string := "{{+B}}The dosage of Ranolazine should not exceed 500mg twice a day when given with "
|| conf_existing_meds_list[j] ||". Decrease ranolizine dose or discontinue "|| conf_existing_meds_list[j] || " and use an alternative agent. {{-B}}" ;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.ObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Existing";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := conf_existing_order_guid[j];
alert_action.ItemName := conf_existing_meds_name[j];
alert_action.ActionEnterpriseItemID := conf_existing_oCat_guid[j];
alert_action.MLMName := "SCH_RANOLAZINE_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the EXISTING Medication to DC-Cancel. This medication conflicts with the medication you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
enddo;
endif; // ( found_existing_conflicting_meds
if ( found_unsubmitted_ranolazine_meds ) then
for m IN ( 1 seqto count unsub_ranolazine_list ) do
if ( do_alert ) then
msg_string := "{{+B}}The dosage of Ranolazine should not exceed 500mg twice a day when given with "
|| evoking_ordername ||". Decrease ranolizine dose or discontinue "|| evoking_ordername || " and use an alternative agent. {{-B}}" ;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.ObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Unsubmitted";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := unsub_ranolazine_oGUID[m];
alert_action.ActionItemName := unsub_ranolazine_list[m];
alert_action.ActionEnterpriseItemID := unsub_ranolazine_oCatGuid[m];
alert_action.MLMName := "SCH_RANOLAZINE_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the UNSUBMITTED statin medication to DC-Cancel. This statin medication conflicts with the medication that you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
enddo;
endif; // ( found_unsubmitted_ranolazine_meds )
if ( found_existing_ranolazine_meds ) then
for l IN ( 1 seqto count existing_ranolazine_list ) do
if ( do_alert )then
msg_string := "{{+B}}The dosage of Ranolazine should not exceed 500mg twice a day when given with "
|| evoking_ordername ||". Decrease ranolizine dose or discontinue "|| evoking_ordername || " and use an alternative agent. {{-B}}" ;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.EvokingObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Existing";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := existing_ranolazine_oGUID[l];
alert_action.ActionItemName := existing_ranolazine_med[l];
alert_action.ActionEnterpriseItemID := existing_ranolazine_oCatGUID[l];
alert_action.MLMName := "SCH_RANOLAZINE_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the EXISTING ranolazine medication to DC-Cancel. This ranolazine medication conflicts with the medication that you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
enddo;
endif; // ( found_existing_ranolazine_meds
endif; //(continue_processing)
;;
priority: 50
;;
evoke:
ranolazine_order_enter;
conflicting_order_enter;
;;
logic:
conclude do_alert;
;;
action:
if ( do_alert = true ) then
final_msg := "";
for i IN ( 1 seqto count alert_msg_lst ) do
if ( final_msg = "" ) then
final_msg := alert_msg_lst[i];
else
final_msg := final_msg || "\n\n" || alert_msg_lst[i];
endif;
enddo;
write final_msg at ranolazine_alert_dest;
attach aa_lst to ranolazine_alert_dest;
endif;
;;
Urgency: 50;;
end: