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,468 @@
maintenance:
title: Form_Kcentra_Order;;
mlmname: Form_Kcentra_Order;;
arden: version 2.5;;
version: 6.10;;
institution: SCH ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-07-15;;
validation: testing;;
library:
purpose: While opening of the Order items If the weight is not charted on the patient then pre -populate the message that weight needs to entered like below.
Dose shall be calculated as per the INR result and weight and should be populated in the dosage field.
Dosage cap should also be calculated as per the below data and If the user is putting the dose greater than the dose cap then
it should display a popup and place the value as the highest capping which is allowed. ** Pop up removed 5/2/18 info added to order and
listed on order set info box.
2 to 3.9 25 units/kg 2500 "Dose not to exceed 2500 units.
4 to 5.9 35 units/kg 3500 "Dose not to exceed 3,500 units
6 n more 50 units/kg 5000 "Dose not to exceed 5,000 units
;;
explanation:
Change History
-----------------
07.07.2015 SJ CSR# 32480 : Created
11.09.2015 TMS Updated MLM to include all specIfications needed for KCentra Dosing.
Moved to production 11/9/2015 CSR 32480
05.02.2018 TMS CSR 36420 Updated MLM to include buttons for allowing physician to choose between
Warfarin reversal using INR values or NOAC reversal using 50 units/kg. Updated
info with dose capping values and calculation info for NOACs. Pop up removed notifing user
of dose capping, since this is added to order calculation info.
06.26.2018 TMS CSR 36420 Updated to not present duplicate "no weight" notices on order item
when called from an order set within an order set.
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
Client_GUID := this_communication.ClientGUID;
ClientVisit_GUID := this_communication.ClientVisitGUID;
Chart_GUID := this_communication.ChartGUID;
form_name := this_form.Name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
Primary_object := this_communication.PrimaryObj;
ParentOrderSet := this_communication.ParentOrderSetGUID;
OrderSetName := Primary_Object.OrderSetName;
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
HtWt := First of ( field_list where field_list.DataItemName = "CombinedMeasurements" ) ;
Parameters := First of ( field_list where field_list.DataItemName = "PRX_Parameters" ) ;
Dosage := First of ( field_list where field_list.DataItemName = "DosageLow" ) ;
INR_Calc_Value := First of ( field_list where field_list.DataItemName = "PRX_INR_Value") ;
INR_Override := First of ( field_list where field_list.DataItemName = "PRX_Generic_CB") ;
AdminInst := First of ( field_list where field_list.DataItemName = "AdminInstructions") ;
UnitsPerKg := First of ( field_list where field_list.DataItemName = "PRX_Units_Per_Kg") ;
WarfarinReversal := Last of ( field_list where field_list.DataItemName = "PRX_WarfarinReversal") ;
NOACReversal := last of ( field_list where field_list.DataItemName = "PRX_NOACReversal") ;
UnitsPerKg_val := UnitsPerKg.value;
Val_Wt := HtWt.Value.WEIGHT;
Dosage_value :=Dosage.Value ;
Max_Rate_in_Units := 210;
Max_Rate_in_MLs := 8.4;
// check weight Value for Patient and Give warning message
Wt := Val_Wt ;
If (Wt is 0 and callingevent = "FormOpen" and this_communication.ParentOrderSetGUID is null) or (Wt is 0 and callingevent = "FormClose" and (Dosage is null or Dosage = 0)) then
Void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a weight for this patient" ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
Endif;
// Round weight to the nearest whole number for calculation
CalcWt := int (val_wt as number);
DecWgt := (val_wt as number) - (CalcWt as number);
DecWgt := (DecWgt as number) + 0.5;
If DecWgt > 1 then CalcWt := CalcWt + 1; Endif;
// Obtain the INR Result Value and Apply condition for Dose with Dose Capping Value
(INR_Result ) := Read First {" select bo.Value "
|| " from CV3Order o join CV3BasicObservation bo on bo.clientguid = o.clientguid "
|| " and bo.chartguid = o.chartguid "
|| " and bo.clientvisitguid = o.clientvisitguid "
|| " and o.GUID = bo.OrderGUID "
|| " left outer join CV3TextualObservationLine tol on bo.clientguid = tol.clientguid "
|| " and bo.GUID = tol.ObservationGUID "
|| " where o.clientvisitguid = " || SQL(ClientVisit_GUID)
|| " And o.clientguid = " ||SQL(Client_GUID)
|| " and o.ChartGUID = " ||SQL(Chart_GUID)
|| " and IsHistory = 0 "
|| " AND ( o.name ={{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}} ) "
|| " And bo.ResultItemCode ={{{SINGLE-QUOTE}}}INR{{{SINGLE-QUOTE}}} Order By bo.entered Desc "};
// remove > or < sign from result If present for calculation
If INR_Result matches pattern ">%" or INR_Result matches pattern "<%" then
INR_Result:= (substring (length of inr_result) characters starting at 2 from INR_Result) ;
Endif;
// Alert User If no INR Result Value on patient record.
// If INR_Result is null and Dosage.Value is null and CallingEvent = "FormOpen" Then
If INR_Result is null and Dosage.Value is null and INR_Override.Value = false and WarfarinReversal.Value = True Then
Void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient has no current INR result on record. " ||CRLF || CRLF
|| "Please manually enter an INR value or enter a valid dose If you wish to administer Kcentra." ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
Dosage.Control_Read_only := false;
INR_Override.Value := "true";
INR_Calc_Value.Control_Read_only := false;
Endif;
// Determine whether to use manually entered INR value or retrieved value for dose calculation
If INR_Override.Value = false then
INR_Val := INR_Result As Number;
INR_Calc_Value.Value := INR_Val;
INR_Calc_Value.Control_Read_Only := true;
else
INR_Val := INR_Calc_Value.Value as Number;
Endif;
If ( CallingEvent = "FormOpen" ) or (CallingEvent = "FieldChange") then
If (CallingField = "PRX_WarfarinReversal" and WarfarinReversal.Value= True) then
NoacReversal.value := false;
Dosage.value := null;
UnitsPerKg.value := null;
elseif (CallingField = "PRX_NoacReversal" and NOACReversal.Value = True) then
WarfarinReversal.Value := false;
Dosage.value := null;
UnitsPerKg.value := null;
elseif (CallingField = "PRX_NoacReversal" and NOACReversal.Value = False) then
WarfarinReversal.Value := true;
Dosage.value := null;
UnitsPerKg.value := null;
elseif (CallingField = "PRX_WarfarinReversal" and WarfarinReversal.Value= False) then
NoacReversal.value := true;
Dosage.value := null;
UnitsPerKg.value := null;
endif;
If WarfarinReversal.value = True then
If (CallingField = "PRX_Generic_CB" and INR_Override.value = true) then
INR_Calc_Value.Control_Read_Only := false;
INR_Calc_Value.Value := null;
INR_Val := INR_Calc_Value.value as Number;
Dosage.Control_Read_only := false;
Dosage.value := Null;
Unitsperkg.value := null;
Unitsperkg.Control_Read_Only := false;
Endif;
If (CallingField = "PRX_Generic_CB" or CallingField = "PRX_INR_Value") and INR_Override.value = true and INR_Calc_Value is not null then
INR_Calc_Value.Control_Read_Only := false;
INR_Val := INR_Calc_Value.value as Number;
Dosage.Control_Read_only := false;
If INR_Val < 2 or INR_Val is null then
Unitsperkg.value := Null;
Unitsperkg.Control_Read_Only := false;
Dosage.value := Null;
else
Unitsperkg.Control_Read_Only := true;
Endif;
Endif;
If CallingField = "PRX_Generic_CB" and INR_Override.value = false and INR_Calc_Value.value is not null then
INR_Calc_Value.Control_Read_Only := true;
INR_Val := INR_Result as Number;
Dosage_value := "" ;
Dosage.Control_Read_only := true;
Unitsperkg.Control_Read_Only := true;
Endif;
// Allow user to type in dose when override is selected an no INR value available
If INR_Val is Null and INR_Override.value = true and Dosage.value is not null Then
INR_Calc_Value.Control_Read_Only := false;
MaxDoseCap := 5000 ;
Parameters.Value := "Dose not to exceed 5,000 units. " || CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min)" || CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
If wt > 0 then
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) " || CRLF ;
Endif;
If Dosage_value > MaxDoseCap and callingevent = "fieldchange" Then
Dosage.value := MaxDoseCap ;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " units. ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Endif;
Endif; //INR_Val is Null and INR_Override.value = true and Dosage.value is not null
// Determine dose based upon INR value and weight. Check calculated dose against max dose limit and cap dose If necessary.
If INR_Val is Not Null And Wt > 0 Then
If (INR_Val < 0.9 ) Then
Dosage_value := "" ;
Endif;
If (INR_Val >= 2.0 ) Then
// INR 2.0 to 3.9
If INR_Val >= 2.0 and INR_Val < 4.0 Then
CalcDose := Int( 25 * (CalcWt As Number )) ;
UnitsPerKg.value := 25;
MaxDoseCap := 2500 ;
// INR 4.0 to 5.9
ElseIf INR_Val >= 4.0 and INR_Val < 6.0 Then
CalcDose := Int ( 35 * (CalcWt As Number )) ;
UnitsPerKg.value := 35;
MaxDoseCap := 3500 ;
// INR 6.0 or greater
ElseIf INR_Val >= 6.0 Then
CalcDose := Int(( 50 * (CalcWt As Number )) ) ;
UnitsPerKg.value := 50;
MaxDoseCap := 5000 ;
Endif;
Dosage.value := CalcDose;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for this INR Range ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
dosemessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
dosemessage := "";
Endif;
Parameters.Value := "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF
|| "Weight rounded to " || Calcwt || " kg X " ||unitsPerKg.value || " units/kg = " || Dosage.value || dosemessage;
Endif; // inr > 2
Endif; //INR_Val is Not Null And Wt > 0 Then
// Calculate dose for INR 0.9 to 2.0 - used for Apixaban, Edoxaban, Rivaroxaban.
If INR_Val is Not Null and INR_val >= 0.9 and INR_Val < 2.0 And Wt > 0 Then
If (unitsperkg.value is null and dosage.value is null) then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " The INR Result for this patient is less than 2." || CRLF || " Do you still wish to place order? ", "Low INR Value Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
dialogResult := dialogResult As string;
If dialogResult = "Yes" Then
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." , "INR < 2 Alert", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Dosage.Control_Mandatory := True ;
Dosage.Control_Read_Only := false;
UnitsPerKg.control_mandatory := "true";
UnitsPerKg.Control_Read_Only := false;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := " ";
Else
Dosage.Value := Null ;
Dosage.Control_Mandatory := True ;
UnitsPerKg.value := null;
UnitsPerKg.control_mandatory := "false";
Parameters.Value := " ";
AdminInst.value := "";
Endif;
Endif; // if units per kg and dosage is null show messages
If INR_Val >= 0.9 and INR_Val < 2.0 Then
If callingfield = "PRX_Units_Per_Kg" then
If (UnitsPerKg_val as number) > 50 or (UnitsPerKg_val as number) < 25 then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Please enter a value between 25 Units/kg and 50 Units/kg" ,"Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
UnitsPerKg.value := null;
Dosage.value := null;
AdminInst.value := "";
Endif;
If ((UnitsPerKg_val as number) > 0 and (UnitsPerKg_val as number) <= 50) and UnitsPerKg_val is not null then
CalcDose := Int((UnitsPerKg.value As Number) * (CalcWt As Number )) ;
Dosage.value := CalcDose;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If UnitsPerKg_val >0 and UnitsPerKg_val <=25 then MaxDoseCap := 2500;
elseIf UnitsPerKg_val >25 and UnitsPerKg_val <=35 then MaxDoseCap := 3500;
elseIf UnitsPerKg_val >35 and UnitsPerKg_val <=50 then MaxDoseCap := 5000;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for this INR Range ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
DoseMessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
DoseMessage := "";
Endif;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF || "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF
|| "Weight rounded to " || Calcwt || " kg X " ||unitsPerKg_val || " units/kg = " || Dosage.value || DoseMessage;
Endif; //((UnitsPerKg_val as number) > 0 and (UnitsPerKg_val as number) <= 50) and UnitsPerKg_val is not null
elseIf callingfield = "DosageLow" and dosage.value > 0 then
CalcDose := dosage.value;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
MaxDoseCap := 5000 ;
UnitsPerKg.control_mandatory := false;
UnitsPerKg.VALUE := "";
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for this INR Range ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
DoseMessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
DoseMessage := "";
Endif;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF || "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF ;
Endif; // calling field is dosagelow or UnitsPerKg_val
Endif; // INR_Val >= 0.9 and INR_Val < 2.0
Endif; //INR_Val is Not Null and INR_val >= 0.9 and INR_Val < 2.0 And Wt > 0
elseif NoacReversal.value = true then
UnitsPerKg.value := 50;
MaxDoseCap := 5000;
If wt > 0 then
CalcDose := Int((UnitsPerKg.value As Number) * (CalcWt As Number )) ;
Dosage.value := CalcDose;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
endif;
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for NOAC Reversal ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
DoseMessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
DoseMessage := "";
Endif;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF || "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF
|| "Weight rounded to " || Calcwt || " kg X " ||unitsPerKg_val || " units/kg = " || Dosage.value || DoseMessage;
Endif; //((UnitsPerKg_val as number) > 0 and (UnitsPerKg_val as number) <= 50) and UnitsPerKg_val is not null
Endif; // (CallingEvent = "FormOpen" ) or (CallingEvent = "FieldChange")
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end: