maintenance: title: Form_RX_TPN_Rate_calc;; mlmname: Form_Rx_TPN_RATE_calc;; arden: version 2;; version: 4.50;; institution: St. Clair Hospital;; author: Teresa M. Spicuzza ;; specialist: Eclipsys Corporation;; date: 2007-06-27;; validation: testing;; library: purpose: Calculate TPN rate based upon ordered volume ;; explanation: Ordered Volume /24 = Infusion rate (rounded to nearest whole number) History: 03.03.2014 TMS Created to calculate TPN and Cyclic TPN rates and to allow charting on veriscan. CSR{{{SINGLE-QUOTE}}}s: 30737 and 32895 08.17.2015 TMS For cyclic TPN, add total volume to be infused for each cycle to the informational message for use with infusion pump settings. CSR 33645. ;; keywords: TPN, Rate, Volume, Cyclic; ;; knowledge: type: data-driven;; data: /********************Make Changes To Spelling And Flags In This Section*********************/ /*************************************************************************************************/ // This MLM is passed three arguments, of types // communication_type, form_type and client info object respectively. (this_communication, // Communication object this_form, // Form object client_info_obj // Arden ClientInfo object ) := argument; SP := " "; CR := 13 formatted with "%c"; LF := 10 formatted with "%c"; CRLF:= CR||LF; TAB := 9 formatted with "%c"; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CyclicTPN := first of (field_list where field_list.DataItemName = "PRX_Cyclic_TPN_Order"); CyclicTPN_On := first of (field_list where field_list.DataItemName = "PRX_Cyclic_TPN_On_Hours"); CyclicTPN_Off := first of (field_list where field_list.DataItemName = "PRX_Cyclic_TPN_Off_Hours"); Instruct := first of (field_list where field_list.DataItemName = "AdminInstructions"); rate := first of (field_list where field_list.DataItemName = "OrderIVRate"); vol := first of (field_list where field_list.DataItemName = "DosageLow"); IVduration := first of (field_list where field_list.DataItemName = "stopafter"); IVduration_val := IVduration.value; ratevalue := rate.value; Freq := first of (field_list where field_list.DataItemName = "FrequencyCode"); Freq_value := Freq.value; // If order is for cyclic TPN, make the rate not mandatory calculate the 3 rates and populate them into // the instructions, make the frequency variable If exist CyclicTPN and CyclicTPN.value = true then CyclicTPN_On.Control_Mandatory := true; CyclicTPN_On.control_read_only := false; CyclicTPN_Off.Control_Mandatory := true; CyclicTPN_Off.control_read_only := false; rate.control_mandatory := false; RateValue.Amount := Null; RateValue.UOM := Null; Rate.control_read_only := True; if exists vol and vol.value is not null and CyclicTPN_On.value is not null then IvDuration_Val.Number := 1; Freq.value.frequencysummary := "Variable"; IvDuration_Val.Option := "Times"; vol_val := vol.value; CyclicTPN_On_val := CyclicTPN_On.value as number; CyclicTPN_Off.value := (24 - CyclicTPN_On_val); Cycle2 := CyclicTPN_On_Val - 1; Cycle2hours := CyclicTPN_On_Val - 2; Cycle2Rate := (vol_val / Cycle2) as number; Cycle2Rateround := int(cycle2rate + 0.5); Cycle1Rate := (Cycle2Rate / 2) as number; Cycle1Rateround := int(cycle1rate + 0.5); TotalVolume := ((Cycle1rateround * 2) + (Cycle2rateround * Cycle2hours)) as number; Cycle2Volume := (Cycle2rateround * Cycle2hours) as number; Cycle1Volume := Cycle1rateround as number; If TotalVolume >= vol.value then TotalVolume := vol.value; Total_vol_msg := " ml."; else Total_vol_msg := " ml, which is approximately the volume ordered. Because the rate has been rounded the volume is slightly different."; endif; Msg := "Start the TPN at " || cycle1rateround || " ml/hr for (1) hour (Volume: " || Cycle1Volume || " ml), then run the TPN at " || cycle2rateround || " ml/hr for (" || Cycle2hours ||") hours (Volume: " || Cycle2Volume || " ml); finally run the TPN at " ||cycle1rateround || " ml/hr for (1) hour (Volume: " || Cycle1Volume || " ml), then stop." || CRLF || "The total volume that will be infused is " || totalvolume || Total_vol_msg; Instruct.value := msg; Endif; Else // If order is not for cyclic TPN calculate the rate based upon the volume ordered over 24 hours If exist CyclicTPN and CyclicTPN.value = false then CyclicTPN_On.value := Null; CyclicTPN_On.Control_Mandatory := false; CyclicTPN_On.control_read_only := true; CyclicTPN_Off.value := Null; CyclicTPN_Off.Control_Mandatory := false; CyclicTPN_Off.control_read_only := True; Rate.control_mandatory := true; Rate.control_read_only := False; Freq.value.frequencysummary := ""; if exists vol and vol.value is not null then vol_val := vol.value; dose_rate := vol_val / 24; IvDuration_Val.Number := 1; IvDuration_Val.Option := "Times"; RateValue := Rate.Value; RateValue.Amount := dose_rate formatted with "%.0f"; RateValue.UOM := "ml/hr"; OrderIVRateValue.KVODisplayed := false; OrderIVRateValue.IsKVO := false; msg := " "; Instruct.value := msg; Endif; Endif; Endif; ;; evoke: ;; logic: Conclude true; ;; action: // This MLM returns two parameters, of types //communication_type and form_type respectively. return this_communication, this_form; ;; Urgency: 50;; end: