maintenance: title: Dosing Alerts for Metformin;; mlmname: SCH_MetforminPrecautions;; arden: version 2;; version: 5.50;; institution: St Clair;; author: Teresa Spicuzza, Allscripts Corp;; specialist: Teresa Spicuzza;; date: 2012-08-20;; validation: testing;; library: purpose: Metformin Dosing Recommendations ;; explanation: MLM will read table and suggest dosing based upon medication, dose and CrCl. Change history 08.20.2012 TMS Created CSR 30865 08.31.2012 TMS Removed alert for users other than physicians, physician extenders, IT and Pharmacists. This allows nursing dept staff to enter order for documentation. Pharmacist can override by entering a comment. 06.03.2019 TMS Removed statement from Creatinine retrieval to limit results to past 24 hours. Query will now pull the most recent result for this chart (admission). CSR 38251 ;; keywords: Dosing ;; 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}}}; //CrCl_info:= mlm {{{SINGLE-QUOTE}}}SCH_Func_Creatinine_Clearance{{{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="Metformin 500mg Tab" }; endif; doalert := false; order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"}; (CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, AdminIns, UserSchedType ,UserSchedDays, UserSchedDoses) := read last {Order: OrderCatalogMasterItem, FrequencyCode, UOM, DosageLow, Name, AdminInstructions, Interval, DaysInInterval, DoseMultiplier REFERENCING EvokingObject}; CatalogClassTypeValueObj := read last {OrderCatalogMasterItem: CatalogClassTypeValue, REFERENCING CatalogItemObj}; ClassTypeValue_code_list, ClassTypeValue_value_list := read {CatalogClassTypeValue: Code, Value REFERENCING CatalogClassTypeValueObj where code = "PRX_MetforminMed"}; fire_on_User := ("IT","MD","DO","DDS","DPM","PA","PA-C","CRNP","RPh"); // fire_on_User := ("tspicuzza","deiler","shead","gfino","ccorbettit", "dwarnick", // "dmiklavichis","ageorgulis","dbellissimo","kbaumgarte"); /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/ (user_id,userguid) :=read last {UserInfo: idcode, guid}; UserCode := read last {"Select occupationcode " ||" From cv3user with (nolock) " ||" Where Guid = " || SQL(userguid) }; continue_processing:= usercode in fire_on_User; If UserCode = "RPh" then alert_setting := "Must Comment"; else alert_setting := "No Override Allowed"; endif; dose_alert_dest := destination {alert} with [alert_type := "Warning", short_message := "Dosing Recommendation", priority := "Low", scope := "Chart", rule_group := "Renal Dosing", rule_number := 4050, send_with_order := send_alert, alert_dialog_settings :=alert_setting, display_alert := true]; // continue_processing:= user_id in fire_on_User; continue_processing:= usercode in fire_on_User; If continue_processing = true then (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus }; (UserGUID ) := read last { UserInfo: GUID }; patientgender := read last { ClientInfo: Gendercode }; Creatinine := read last {"Select top 1 bo.value " || " From cv3order as o with (nolock) " || " join cv3basicobservation as bo with (nolock) " || " on o.clientguid = bo.clientguid " || " and o.chartguid = bo.chartguid " || " and o.guid = bo.orderguid " || " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} " || " and bo.Active = 1 " || " And bo.IsHistory = 0 " || " join cv3ordercatalogmasteritem as ocmi with (nolock) " || " on ocmi.guid = o.ordercatalogmasteritemguid " || " and ocmi.active = 1 " || " where o.clientguid = " || SQL(clientguid) // || " and o.performeddtm >= (DATEADD(hour, -24, getdate())) " || " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} " || " order by o.performeddtm desc " }; /* // added to use typed in creatinine level for testing only - Use in ***DEV ONLY *** tempcreat := (adminins as number); crentered := (tempcreat is number); If crentered = false then tempcreat := null; endif; If Creatinine is null then creatinine := tempcreat; endif; // end of logic for ***DEV ONLY *** */ If ((PatientGender = "Female") and ((Creatinine as number) > 1.4 )) then alert_message := "{{+B}}{{+R}} Contraindicated in Women with SCr > 1.4 {{-R}} \n Please monitor SCr and resume metformin when renal function improves.{{-B}}"; doalert := true; endif; If ((PatientGender = "Male") and ((Creatinine as number) > 1.5 )) then alert_message := "{{+B}}{{+R}} Contraindicated in Men with SCr > 1.5 {{-R}} \n Please monitor SCr and resume metformin when renal function improves.{{-B}}"; doalert := true; endif; else doalert := false; endif; ;; priority: 50 ;; evoke: order_enter_event; ;; logic: if called_by_editor then conclude false; endif; If "Yes" not in ClassTypeValue_value_list then conclude false; endif; //---------------------------------------------------------------- // If there is no evoking object then do nothing, this can // only be true for the MLM Editor //---------------------------------------------------------------- if EvokingObject is null then conclude false; endif; if continue_processing = false then conclude false; endif; conclude doalert; ;; action: write alert_message at dose_alert_dest ;; Urgency: 50;; end: