305 lines
9.5 KiB
Plaintext
305 lines
9.5 KiB
Plaintext
maintenance:
|
|
|
|
title: Form_Insulin_Sliding_Scale_calc;;
|
|
mlmname: Form_Insulin_Sliding_Scale_calc;;
|
|
arden: version 2;;
|
|
version: 4.50;;
|
|
institution: St. Clair Hospital;;
|
|
author: Teresa M. Spicuzza ;;
|
|
specialist: Josue Lopez, Eclipsys Corporation;;
|
|
date: 2007-02-02;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Populate Variable dose fields based upon Sliding scale dosing option
|
|
and baseline dose of insulin.
|
|
;;
|
|
explanation:
|
|
1. On any activation, this MLM will gather data from the fields:
|
|
a. Baseline Dose
|
|
b. Variable Dose
|
|
c. Dosing Option
|
|
|
|
2. On the FieldChange event of the Dose Options field, this MLM will
|
|
a. clear any previous values from the Variable Dose object,
|
|
b. if the Dose Option value is "Manual Entry",
|
|
i. set Dose Options Read Only atribute to "true"
|
|
ii. set the Baseline Dose Mandatory attribute to "false"
|
|
c. if the Dose Option value is "Low", "Moderate" or "High",
|
|
i. set Dose Options Read Only atribute to "false"
|
|
ii. set the Baseline Dose Mandatory attribute to "true"
|
|
|
|
3. On the ButtonClick event, this MLM will
|
|
a. set error messages for
|
|
i. missing Dosing Option
|
|
ii. Dosing Option = "Manual Entry" and Variable Doses are missing
|
|
iii.Other Dosing Option and Baseline Dosage value is missing
|
|
b. if errors are found,
|
|
i. blank out Variable Dose list
|
|
ii. display error message
|
|
c. if no errors are found, then for
|
|
i. Dosing Option = "Manual Entry"
|
|
1) if missing Baseline Dosage, convert it to 0
|
|
2) add Baseline Dosage to (entered) Variable Doses
|
|
3) display informational message about Variable Dose amount.
|
|
ii. Other Dosing Options
|
|
1) select Low, Moderate or High Variable Dose increments according
|
|
to Dosing Option chosen
|
|
2) create a Variable Dose object for each Blood Sugar range, and
|
|
3) Set Variable Dose amount = Baseline amount + increment for
|
|
each object.
|
|
|
|
MLM assigned to:
|
|
OEF: PRX_IjSS
|
|
Calling Event: ButtonClick
|
|
Calling Field: CallMLM Button
|
|
|
|
Calling Event: FieldChange
|
|
Calling Field: PRX_InsulinSlideDosing
|
|
|
|
;;
|
|
keywords:
|
|
Insulin, sliding scale;
|
|
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
/******************* Make Changes To Spelling And Flags In This Section ***************/
|
|
log_execution_info := false;
|
|
|
|
low_incr := (1, 2, 3, 4, 5);
|
|
mod_incr := (1, 3, 5, 7, 9);
|
|
high_incr := (2, 4, 7, 10, 13);
|
|
|
|
dose_ranges := ("Low", "Moderate", "High");
|
|
/**************************************************************************************/
|
|
|
|
// This MLM receives three arguments from system
|
|
(this_communication, // Communication object
|
|
this_form, // Form object
|
|
client_info_obj // Arden ClientInfo object
|
|
) := argument;
|
|
|
|
// get calling event values from communication object
|
|
calling_event := this_communication.CallingEvent;
|
|
calling_field := this_communication.CallingFieldName;
|
|
|
|
// Assign pointer to the Field object, get field values
|
|
field_list := this_form.fields;
|
|
|
|
// get Baseline dose
|
|
baseline_field := first of
|
|
(field_list where field_list.DataItemName = "PRX_InsulinBaseline" );
|
|
if exists baseline_field then
|
|
baseline_value := baseline_field.value as number;
|
|
endif;
|
|
|
|
// get variable dose list
|
|
VariableDose_field := first of
|
|
(field_list where field_list.DataItemName = "VariableDose" );
|
|
if exists VariableDose_field then
|
|
dose_list := VariableDose_field.Value;
|
|
endif;
|
|
|
|
// This sets the value of the increments depending upon the dosing option selected.
|
|
Option_field := first of
|
|
(field_list where field_list.DataItemName = "PRX_InsulinSlideDosing" );
|
|
if exists Option_field then
|
|
opt_chosen := Option_field.Value;
|
|
endif;
|
|
|
|
// process fields according to calling events
|
|
if calling_event = "FieldChange" and calling_field = "PRX_InsulinSlideDosing" then
|
|
// blank out variable dose list, make read only
|
|
VariableDose_field.Control_Read_Only := false;
|
|
if exist dose_list then
|
|
for ea_dose in dose_list do
|
|
ea_dose.condition := null;
|
|
ea_dose.from := null;
|
|
ea_dose.to := null;
|
|
ea_dose.DoseInstructions := null;
|
|
ea_dose.uom := null;
|
|
ea_dose.ItemID := null;
|
|
enddo;
|
|
endif; // exist dose_list
|
|
VariableDose_field.Control_Read_Only := true;
|
|
|
|
// set field characteristics when option is chosen
|
|
if opt_chosen = "Manual Entry" then
|
|
VariableDose_field.Control_Read_Only := false;
|
|
baseline_field.Control_Mandatory := false;
|
|
|
|
elseif opt_chosen is in dose_ranges then
|
|
VariableDose_field.Control_Read_Only := true;
|
|
baseline_field.Control_Mandatory := true;
|
|
endif; // opt_chosen = ...
|
|
|
|
elseif calling_event = "ButtonClick" then
|
|
// check for errors
|
|
err_msg := "";
|
|
fatal_error := false;
|
|
|
|
if (opt_chosen is null) or (opt_chosen = "") then
|
|
fatal_error := true;
|
|
err_msg := "Please Select a Dosing Option before proceeding.";
|
|
|
|
else
|
|
if opt_chosen = "Manual Entry" then
|
|
if not exist dose_list then
|
|
fatal_error := true;
|
|
err_msg := "Dosages must be entered manually.";
|
|
endif;
|
|
|
|
elseif opt_chosen is in dose_ranges then
|
|
if (baseline_value is null) or (baseline_value = "") then
|
|
fatal_error := true;
|
|
err_msg := "Please Enter a Baseline Dose before proceeding.";
|
|
endif; // baseline_value is null
|
|
endif; // opt_chosen = ...
|
|
endif; // not exist opt_chosen
|
|
|
|
// proceed only if no errors
|
|
if fatal_error then
|
|
|
|
if exist dose_list then
|
|
for ea_dose in dose_list do
|
|
ea_dose.condition := null;
|
|
ea_dose.from := null;
|
|
ea_dose.to := null;
|
|
ea_dose.DoseInstructions := null;
|
|
ea_dose.uom := null;
|
|
ea_dose.ItemID := null;
|
|
enddo;
|
|
endif; // exist dose_list
|
|
|
|
this_communication.Message := err_msg;
|
|
this_communication.MessageType := "Error";
|
|
|
|
else // hooray, no errors!
|
|
if opt_chosen = "Manual Entry" then
|
|
if (baseline_value is null) or (baseline_value = "") then
|
|
baseline_value := 0;
|
|
endif;
|
|
|
|
for ea_dose in dose_list do
|
|
entered_dose := ea_dose.DoseInstructions as number;
|
|
final_dose := entered_dose + baseline_value;
|
|
ea_dose.DoseInstructions := final_dose;
|
|
enddo;
|
|
|
|
this_communication.Message := "Baseline amount of "
|
|
|| baseline_value || " "
|
|
|| "added to Variable Doses";
|
|
this_communication.MessageType := "Informational";
|
|
|
|
else // other options chosen
|
|
// select dosage range
|
|
if opt_chosen = "Low" then
|
|
dose_opt := low_incr;
|
|
elseif opt_chosen = "Moderate" then
|
|
dose_opt := mod_incr;
|
|
elseif opt_chosen = "High" then
|
|
dose_opt := high_incr;
|
|
endif;
|
|
|
|
inc1 := dose_opt[1];
|
|
inc2 := dose_opt[2];
|
|
inc3 := dose_opt[3];
|
|
inc4 := dose_opt[4];
|
|
inc5 := dose_opt[5];
|
|
|
|
// set the value in the Variable dose field based upon the baseline
|
|
// and dosing options selected on form
|
|
VariableDose_field.Control_Read_Only := false;
|
|
|
|
// clear exisisting Variable Dose list
|
|
if exist dose_list then
|
|
for ea_dose in dose_list do
|
|
ea_dose.condition := null;
|
|
ea_dose.from := null;
|
|
ea_dose.to := null;
|
|
ea_dose.DoseInstructions := null;
|
|
ea_dose.uom := null;
|
|
ea_dose.ItemID := null;
|
|
enddo;
|
|
endif; // exist dose_list
|
|
|
|
// create new Variable Dose list
|
|
variable_dose_type := OBJECT [Condition, From, To, DoseInstructions, UOM, ItemID];
|
|
var_dose := NEW variable_dose_type;
|
|
var_dose.condition := "Blood Sugar";
|
|
var_dose.from := "70";
|
|
var_dose.to := "149";
|
|
var_dose.DoseInstructions := (baseline_value as number);
|
|
var_dose.uom := "units";
|
|
var_dose.ItemID := NULL;
|
|
VariableDose_field.Value := VariableDose_field.Value, var_dose;
|
|
|
|
var_dose := NEW variable_dose_type;
|
|
var_dose.condition := "Blood Sugar";
|
|
var_dose.from := "150";
|
|
var_dose.to := "199";
|
|
var_dose.DoseInstructions := (baseline_value as number) + (inc1 as number);
|
|
var_dose.uom := "units";
|
|
var_dose.ItemID := NULL;
|
|
VariableDose_field.Value := VariableDose_field.Value, var_dose;
|
|
|
|
var_dose := NEW variable_dose_type;
|
|
var_dose.condition := "Blood Sugar";
|
|
var_dose.from := "200";
|
|
var_dose.to := "249";
|
|
var_dose.DoseInstructions := (baseline_value as number) + (inc2 as number);
|
|
var_dose.uom := "units";
|
|
var_dose.ItemID := NULL;
|
|
VariableDose_field.Value := VariableDose_field.Value, var_dose;
|
|
|
|
var_dose := NEW variable_dose_type;
|
|
var_dose.condition := "Blood Sugar";
|
|
var_dose.from := "250";
|
|
var_dose.to := "299";
|
|
var_dose.DoseInstructions := (baseline_value as number) + (inc3 as number);
|
|
var_dose.uom := "units";
|
|
var_dose.ItemID := NULL;
|
|
VariableDose_field.Value := VariableDose_field.Value, var_dose;
|
|
|
|
var_dose := NEW variable_dose_type;
|
|
var_dose.condition := "Blood Sugar";
|
|
var_dose.from := "300";
|
|
var_dose.to := "349";
|
|
var_dose.DoseInstructions := (baseline_value as number) + (inc4 as number);
|
|
var_dose.uom := "units";
|
|
var_dose.ItemID := NULL;
|
|
VariableDose_field.Value := VariableDose_field.Value, var_dose;
|
|
|
|
var_dose := NEW variable_dose_type;
|
|
var_dose.condition := "Blood Sugar";
|
|
var_dose.from := "350";
|
|
var_dose.to := "399";
|
|
var_dose.DoseInstructions := (baseline_value as number) + (inc5 as number);
|
|
var_dose.uom := "units";
|
|
var_dose.ItemID := NULL;
|
|
VariableDose_field.Value := VariableDose_field.Value, var_dose;
|
|
|
|
VariableDose_field.Control_Read_Only := true;
|
|
endif; // opt_chosen = ...
|
|
endif; // fatal_error
|
|
endif; // calling_event = ...
|
|
|
|
;;
|
|
evoke:
|
|
|
|
;;
|
|
logic:
|
|
Conclude true;
|
|
|
|
;;
|
|
action:
|
|
// This MLM returns communication_type and form_type parameters.
|
|
return this_communication, this_form;
|
|
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|