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,436 @@
maintenance:
title: AUC Dose Calculation Coefficient;;
mlmname: SYS_CALC_AUC_COEF;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose:
The sys_calc_AUC_coef MLM determines the computation coefficient for Area Under
the Curve (AUC) dosing and returns it to the sys_calc_dosage MLM for final calculation
of the Dose, along with a text string showing the formula used.
;;
explanation:
Four different computations for carboplatin dosage are implemented by this MLM.
The Calvert formula, used mostly for adults, requires a value for a Glomerular
Filtration Rate (GFR), which is approximated by Estimated Creatinine Clearance (ECC).
The ECC is calculated by the Cockcroft-Gault or Jellife method as selected by the user
or the user may supply a measured or "Actual" value. A clinically-determined constant
value is added to ECC (or GFR), and the sum is multiplied by a value for the Area
Under the Curve (AUC). The Calvert formula is as follows:
Carboplatin dose (mg) = AUC x (GFR + 25)
For Pediatric patients less than 18 years old and weighing 10 Kg or more,
the dose calculation requires a "raw CrCl" test result or user-entered
lab value. The modified Calvert formula is:
Carboplatin Dose (mg) = AUC x [CrCl + (BSA x 15)]
For pediatric patients less than 18 years old and weighing less than 10 Kg,
the dose calculation requires a "raw CrCl" test result or user-entered
lab value. The modified Calvert formula is:
Carboplatin Dose (mg) = AUC x [CrCl + (Wt x 0.36)]
A third choice for all pediatric patients less than 18 years old is the
St. Jude{{{SINGLE-QUOTE}}}s modified Calvert formula, which requires a measured Creatinine
Clearance. The St. Jude{{{SINGLE-QUOTE}}}s modified Calvert formula is :
Carboplatin Dose (mg) = target AUC x [(0.93 x CrCl/BSA) + 15] x BSA.
The Dose Basis and BSA preference are selected by the user and determine which data elements
are used and how to calculate the ECC. The patient{{{SINGLE-QUOTE}}}s age determines whether to use Pediatric
BSA, and the patient{{{SINGLE-QUOTE}}}s height constrains the use of Ideal or Adjusted weights. The Dose Basis
strings and the calculations to which they correspond are listed:
Dose Basis string Dose Calculation Considerations
AUC (Cockcroft-Gault) Dose = AUC x (CrCl+25)
AUC (Cockcroft-Gault ideal) Dose = AUC x (CrCl+25) Ht >= 150 cm
AUC (Cockcroft-Gault adjusted) Dose = AUC x (CrCl+25)
AUC (Jelliffe) Dose = AUC x (CrCl+25)
AUC (Jelliffe ideal) Dose = AUC x (CrCl+25) Ht >= 150 cm
AUC (Jelliffe adjusted) Dose = AUC x (CrCl+25)
AUC (Jelliffe no BSA) Dose = AUC x (CrCl+25)
AUC (measured CrCl) Dose = AUC x (CrCl+25) Adult or Peds
AUC (measured CrCl) Dose = AUC x (CrCl+(BSA x 15)) Age <= 18y, Wt >= 10 kg
AUC (measured CrCl) Dose = AUC x (CrCl+(Wt x 0.36)) Age <= 18y, Wt < 10 kg
AUC (St. Jude{{{SINGLE-QUOTE}}}s modified-Peds) Dose = AUC x ((0.93 x ClCl/BSA)+15) x BSA Age <= 18y
Note that all of the above Dose Calculations have the general pattern of
Dose = AUC_value x AUC_coefficient
The AUC_value is entered by the user and this MLM determines the AUC_coefficient, which
are then used to calculate the dose.
The sys_calc_AUC_coef MLM requires the arguments listed below from the calling MLM or program.
Note that Units of measure are assumed to always be US standard: ml/min for for Creatinine
Clearance and mg/dL for Serum Creatinine. Any conversion required is done by the application.
Arguments:
ht_val - in centimeters, used in BSA and Ideal weight
wt_val - in Kg, used in BSA and Adjusted weight calcs
BSA_val - in m^2, for use in various calculations
dose_val - user entry in Requested field, to be used as AUC_value
dose_basis - string selected by user
serum_creatinine - either entered by user into ECC control or sent by application
creat_clearance - either entered by user into ECC control or sent by application
is_actual_CrCl - state of "Actual" button on the ECC control - True = set, False = clear
client_info_obj - used for accessing client demographic info as needed
The sys_calc_AUC_dose mlm returns the following values:
error_message - string, or "" if no error was generated
AUC_coef - number computed from the values received, for the chosen dose basis
dose_calc_formula - a string containing the formula by which the values are computed
;;
keywords: Carboplatin dosage, Calvert{{{SINGLE-QUOTE}}}s formula
;;
knowledge:
type: data-driven;;
data:
/* ------------------------------------------ */
/* Arguments passed in by sys_calc_dosage mlm */
/* ------------------------------------------ */
(ht_val,
wt_val,
BSA_val,
dose_val,
dose_basis,
serum_creatinine, // from ECC control via sys_dose_calc mlm
creat_clearance, // from ECC control via sys_dose_calc mlm
is_actual_CrCl, // from ECC control via sys_dose_calc mlm
client_info_obj
) := argument;
/****************** Make Changes To Spelling And Flags In This Section *****************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/*-----------------------------------*/
/* Declare MLMs and variables */
/*-----------------------------------*/
/* MLM to get the Estimated Creatinine Clearance. */
func_calc_estCrCl := MLM {{{SINGLE-QUOTE}}}SYS_CALC_EST_CRCL{{{SINGLE-QUOTE}}};
/* MLM to get the BSA */
func_calc_BSA := MLM {{{SINGLE-QUOTE}}}SYS_CALC_BSA{{{SINGLE-QUOTE}}};
pediatric_BSA_age_limit := 18; // years
calculate_with_BSA := true; // assume we will use BSA in Jelliffe formula
BSA_pref := "Standard"; // default BSA calculation will be done
EstCrCl_equation_pref := ""; // will be set for Cockcroft-Gault or Jelliffe only
use_ECC_mlm := true; // assume we will use the EstCrCl mlm
calc_pedi_dose := false; // assume we will do an adult dosage
error_message := ""; // to be populated if errors are found
fatal_error := false; // will be used to determine if we can continue
/*----------------------------------------------------------*/
/* define dose basis string sets for AUC dose calculations */
/*----------------------------------------------------------*/
AUC_cg_string := ("AUC (Cockcroft-Gault)", "AUC (Cockcroft-Gault ideal)",
"AUC (Cockcroft-Gault adjusted)");
AUC_jlf_string := ("AUC (Jelliffe)", "AUC (Jelliffe ideal)", "AUC (Jelliffe adjusted)",
"AUC (Jelliffe no BSA)");
AUC_mCrCl_string := ("AUC (measured CrCl)", "AUC (St. Jude{{{SINGLE-QUOTE}}}s modified-Peds)");
AUC_ideal_string := ("AUC (Cockcroft-Gault ideal)", "AUC (Jelliffe ideal)");
AUC_adjusted_string := ("AUC (Cockcroft-Gault adjusted)", "AUC (Jelliffe adjusted)");
AUC_strings := (AUC_cg_string, AUC_jlf_string, AUC_mCrCl_string);
/***************************************************************************************/
/*---------------------------*/
/* convert values to numbers */
/*---------------------------*/
ht_val := ht_val as number;
wt_val := wt_val as number;
BSA_val := BSA_val as number;
dose_val := dose_val as number;
serum_creatinine := serum_creatinine as number;
creat_clearance := creat_clearance as number;
/*----------------------------------------*/
/* set up Pediatric calculation if needed */
/*----------------------------------------*/
if exist client_info_obj
then
(birthdatetime,
birth_year,
patient_gender ):= read last
{ClientInfo: birthdatetime, BirthYearNum, GenderTypeIntlCode
REFERENCING client_info_obj};
endif;
if exist birthdatetime
and birth_year > 0
and birthdatetime is time
then
patient_age:= (NOW - birthdatetime) / (1 year);
calc_pedi_dose := (patient_age <= pediatric_BSA_age_limit);
endif; /* if exist birthdatetime */
/*------------------------------------------*/
/* set EstCrCl equation and BSA preference */
/*------------------------------------------*/
if (dose_basis is in AUC_mCrCl_string)
then
EstCrCl_equation_pref := "";
use_ECC_mlm := false;
elseif dose_basis is in AUC_cg_string
then
EstCrCl_equation_pref := "Cockcroft-Gault";
elseif dose_basis is in AUC_jlf_string
then
EstCrCl_equation_pref := "Jelliffe";
if dose_basis = "AUC (Jelliffe no BSA)"
then
calculate_with_BSA := false;
endif;
endif;
/*------------------------------*/
/* set BSA formula preference */
/*------------------------------*/
if dose_basis is in AUC_ideal_string
then
BSA_pref := "Ideal";
elseif dose_basis is in AUC_adjusted_string
then
BSA_pref := "Adjusted";
else
BSA_pref := "Standard";
endif;
/*--------------*/
/* trap errors */
/*--------------*/
if use_ECC_mlm
then
if calc_pedi_dose
then
error_message := error_message || "Est. CrCl formula not valid for pediatric patient. ";
fatal_error := true;
else // calculating adult EstCrCl
if not (exist serum_creatinine and serum_creatinine > 0)
then
error_message := error_message || "Missing or invalid Serum Creatinine value. ";
fatal_error := true;
endif; // serum Creat not given
endif; //calc_pedi_dose
else
if is_actual_CrCl
then
if not (exist creat_clearance and creat_clearance > 0)
then
error_message := error_message || "Missing or invalid measured CrCl value. ";
fatal_error := true;
else // CrCl exists, check for other errors
if (dose_basis is not in AUC_mCrCl_string)
then
error_message := error_message || "Estimated CrCl is required to calculate AUC dose. ";
fatal_error := true;
elseif (dose_basis = "AUC (St. Jude{{{SINGLE-QUOTE}}}s modified-Peds)")
then
if not calc_pedi_dose
then
error_message := error_message || "Cannot use pediatric calculation for adult dosage.";
fatal_error := true;
else
if not (exist BSA_val and BSA_val > 0)
then
error_message := error_message || "BSA is required to calculate AUC dose.";
fatal_error := true;
endif;
endif; // not pedi patient
elseif (dose_basis = "AUC (measured CrCl)")
then
if calc_pedi_dose
then
if not (exist wt_val and wt_val > 0)
then
error_message := error_message || "Weight is required to calculate AUC dose. ";
fatal_error := true;
elseif (wt_val >= 10)
then
if not (exist BSA_val and BSA_val > 0)
then
error_message := error_message || "BSA is required to calculate AUC dose. ";
fatal_error := true;
endif; // not exist BSA
endif; // not exist weight
endif; // calc pedi dose
endif; // dose basis = St. Jude{{{SINGLE-QUOTE}}}s or measured CrCl
endif; // not exist CrCl
else // is Actual CrCl = false
error_message := error_message || "Measured CrCl is required to calculate AUC dose. ";
fatal_error := true;
endif; // is Actual CrCl
endif; // using ECC_mlm
/*----------------------------------------------------------*/
/* Call EstCrCl mlm to get values if using C-G or Jelliffe */
/*----------------------------------------------------------*/
if use_ECC_mlm
then
(ECC_mlm_error_message,
EstCrCl_number_rounded,
EstCrCl_formula,
weight_used,
BSA_used) := call func_calc_estCrCl with
EstCrCl_equation_pref,
BSA_pref,
ht_val,
wt_val,
Serum_Creatinine,
calculate_with_BSA,
client_info_obj;
if ECC_mlm_error_message <> "" // and EstCrCl_number_rounded = NULL
then
error_message := error_message || ECC_mlm_error_message;
fatal_error := true;
endif; // error occured
/*-----------------------------------------------------------*/
/* otherwise set values for the calculation to be done here */
/*-----------------------------------------------------------*/
else
if (is_actual_CrCl and creat_clearance > 0)
then
weight_used := wt_val;
endif;
endif; /* using the EstCrCl mlm */
;;
evoke:
;;
logic:
/*-------------------------------------------------------------------*/
/* perform and return calculation only if no fatal errors were found */
/*-------------------------------------------------------------------*/
if not fatal_error
then
formula_tail := "";
wt_or_bsa_type := "";
/*------------------------------------------------------*/
/* dose calculation using "standard" Calvert formula */
/*------------------------------------------------------*/
if use_ECC_mlm // only for Jelliffe or Cockcroft-Gault EstCrCl
then
creat_clearance := EstCrCl_number_rounded;
AUC_coef := creat_clearance + 25;
AUC_coef_formula := "(CrCl + 25)";
if BSA_pref <> "Standard"
then
wt_or_bsa_type := "(" || BSA_pref || ")";
endif;
if EstCrCl_equation_pref = "Cockcroft-Gault"
then
formula_tail := "; Wt" || wt_or_bsa_type || " = " || weight_used;
elseif EstCrCl_equation_pref = "Jelliffe"
then
if calculate_with_BSA
then
formula_tail := "; BSA" || wt_or_bsa_type ||" = " || BSA_used;
endif;
endif;
/*---------------------------------------------*/
/* Calvert formula with measured CrCl - Adults */
/*---------------------------------------------*/
else
if not calc_pedi_dose // i.e., dose basis is measured CrCl, adult
then
AUC_coef := creat_clearance + 25;
AUC_coef_formula := "(CrCl + 25)";
/*--------------------------------------------*/
/* St. Jude{{{SINGLE-QUOTE}}}s modified Calvert formula - Peds */
/*--------------------------------------------*/
else
if (dose_basis = "AUC (St. Jude{{{SINGLE-QUOTE}}}s modified-Peds)")
then
GFR := creat_clearance / BSA_val;
AUC_coef := ((0.93 * GFR) + 15) * BSA_val;
AUC_coef_formula := "((0.93 x (CrCl/BSA)) + 15) x BSA";
formula_tail := "; BSA = " || BSA_val;
/*----------------------------------------------------------------*/
/* Modified Calvert{{{SINGLE-QUOTE}}}s formula for peds patients weighing >= 10 kg */
/*----------------------------------------------------------------*/
elseif (dose_basis = "AUC (measured CrCl)") then
if wt_val >= 10
then
AUC_coef := (creat_clearance + (BSA_val * 15));
AUC_coef_formula := "(CrCl + (BSA x 15))";
formula_tail := "; BSA = " || BSA_val;
/*----------------------------------------------------------------*/
/* Modified Calvert{{{SINGLE-QUOTE}}}s formula for peds patients weighing < 10 kg */
/*----------------------------------------------------------------*/
elseif wt_val < 10
then
AUC_coef := (creat_clearance + (wt_val * 0.36));
AUC_coef_formula := "(CrCl + (Wt x 0.36))";
formula_tail := "; Wt = " || wt_val;
endif; // wt_val
endif; // dose basis
endif; // not calc pedi
endif; // use ecc mlm
/*-------------------------------------------------------*/
/* Format Dose calc formula to return to calling program */
/*-------------------------------------------------------*/
AUC_dose_calc_formula := "formula: " || AUC_coef_formula
|| "; CrCl = " || creat_clearance
|| formula_tail;
endif; // not fatal error
conclude true; // always, to return values or error message
;;
action:
if fatal_error
then
return error_message;
else
return ( "", AUC_coef, AUC_dose_calc_formula );
endif;
;;
end:

View File

@@ -0,0 +1,133 @@
maintenance:
title: Calculates Body Mass Index (BMI);;
mlmname: SYS_CALC_BMI;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Calculates a patient{{{SINGLE-QUOTE}}}s Body Mass Index (BMI).
;;
explanation: Calculates the Body Mass Index using the following rules:
1. The Body Mass Index is calculated using the following equation:
BMI = Weight(kg) /[Height(m)**2].
This formula can be changed by client sites as needed.
2. Arguments passed in from the calling program or other MLM:
ht_val - patient{{{SINGLE-QUOTE}}}s actual height number in centimeters (cm)
wt_val - patient{{{SINGLE-QUOTE}}}s actual weight number in kilograms (kg)
client_info_obj - Arden ClientInfo object
3. Values returned to the calling program or other MLM
error_message - text string containing error message
BMI_value_rounded - The BMI value, rounded to two decimal places
BMI_formula - A text string that describes the formula used to perform the calculation.
Sites can change the formula or text string as needed.
Configured message currently returned to the application reads:
"BMI calculated using formula: (WeightKg / (HeightM) ^ 2))".
;;
keywords: Body Mass Index, BMI;
;;
knowledge:
type: data-driven;;
data:
/* Arguments are passed in from the calling C++ program or MLM */
(ht_val, //number in centimeters (cm)
wt_val, //number in kilograms (kg)
client_info_obj //Arden ClientInfo object
) := argument;
/**************** Make Changes To Spelling And Flags In This Section ****************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/************************************************************************************/
error_message:="";
fatal_error := false;
;;
evoke:
;;
logic:
/*----------------*/
/* Set error flag */
/*----------------*/
if not (exist ht_val) or (ht_val <= 0)
then
fatal_error := true;
error_message := error_message || "Invalid height for BMI calculation. ";
endif;
if not (exist wt_val) or (wt_val <= 0)
then
fatal_error := true;
error_message := error_message || "Invalid weight for BMI calculation. ";
endif;
/*--------------------------------*/
/* calculate BMI only if no error */
/*--------------------------------*/
if not fatal_error
then
/*------------------------------------------------------*/
/* Body Mass Index calculation (convert cm to meters) */
/*------------------------------------------------------*/
BMI_value := wt_val / ((ht_val/100 ) **2);
BMI_formula := "BMI calculated using formula: WeightKg / (HeightM^2)";
/*----------------------------------------*/
/* Rounds the BMI to two decimal points */
/*----------------------------------------*/
BMI_value_rounded:= (int ((BMI_value + 0.005) * 100))/100;
endif; /* no errors */
/*--------------------------------------------------------*/
/* Always conclude True to return values or error_message */
/*--------------------------------------------------------*/
conclude TRUE;
;;
action:
if fatal_error
then
return error_message;
else
/* Return the BMI - object layer will set to Null if needed */
return (error_message, BMI_value_rounded, BMI_formula);
endif;
;;
end:

View File

@@ -0,0 +1,218 @@
maintenance:
title: Calculate Body Surface Area (BSA);;
mlmname: SYS_CALC_BSA;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Calculates a patient{{{SINGLE-QUOTE}}}s BSA.
;;
explanation: Calculates the BSA using the following rules:
1. If the formula preference = Standard or Pediatric and if the patient{{{SINGLE-QUOTE}}}s age can be calculated, then:
- For patients <= 18.0 years, the standard pediatric BSA formula is used.
pediatric BSA = SQRT(HeightCm * (WeightKg/3600))
- For patient{{{SINGLE-QUOTE}}}s > 18.0 years, the standard BSA formula is used.
standard BSA = (WeightKg^0.425) * (HeightCm^0.725) * 0.007184)
2. If the formula preference = Standard or Pediatric and if the patient{{{SINGLE-QUOTE}}}s age cannot be calculated, then
- The facility{{{SINGLE-QUOTE}}}s preference for BSAFormula in the Enterprise Profile is used.
If the preference is not set, then the Standard BSA formula will be used.
3. If the formula preference = Ideal, then the ideal weight is used in the calculation.
4. If the formula preference = Adjusted, then the adjusted weight is used in the calculation.
Facility may customize this MLM to use their own formulas for BSA calculations.
;;
keywords: BSA Calculation; Age ;
;;
knowledge:
type: data-driven;;
data:
/* Arguments are passed in from the calling C++ program or MLM */
(BSA_formula_preference, //string - valid strings are Standard, Pediatric, Ideal, or Adjusted
ht_val, //number in centimeters (cm)
wt_val, //number in kilograms (kg)
client_info_obj //Arden ClientInfo object
) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/* What is the Upper AGE limit for using the Pediatric BSA calculation? */
/* The calculation will use LESS THAN OR EQUAL TO this number listed below */
pediatric_BSA_upper_age_limit:= 18; /* years */
/***************************************************************************************/
/* MLM to calculate weight. */
func_calc_weight := MLM {{{SINGLE-QUOTE}}}SYS_CALC_WT{{{SINGLE-QUOTE}}};
calculate_actual := "Standard";
calculate_pediatric := "Pediatric";
calculate_ideal := "Ideal";
calculate_adjusted := "Adjusted";
/* initialize values to be returned */
BSA_number := 0;
BSA_formula := "";
weight_used:= 0;
/*----------------------------------------------------------------*/
/* Convert a string representation of a number to an Arden number */
/*----------------------------------------------------------------*/
ht_val := ht_val as number;
wt_val := wt_val as number;
/* Retrieves birthdate and gender from ClientInfo Object that is passed as an argument */
if exist client_info_obj
then
(birthdate,
birth_year,
patient_gender ):= read last
{ClientInfo: birthdate, BirthYearNum, GenderTypeIntlCode
REFERENCING client_info_obj};
endif;
;;
evoke:
;;
logic:
/*------------------------------*/
/* Save original BSA preference */
/*------------------------------*/
original_BSA_formula_preference := BSA_formula_preference;
/*-----------------------------------------------------*/
/* Calculate a patient{{{SINGLE-QUOTE}}}s age and */
/* Reset BSA preference based on the patient{{{SINGLE-QUOTE}}}s age */
/* Reset only if preference is Standard or Pediatric */
/*-----------------------------------------------------*/
if exist birthdate
and birth_year > 0
and birthdate is time
and (BSA_formula_preference = "Pediatric" OR BSA_formula_preference = "Standard")
then
patient_age:= (NOW - birthdate) / (1 year);
if patient_age <= pediatric_BSA_upper_age_limit
then
BSA_formula_preference := "Pediatric";
else
BSA_formula_preference := "Standard";
endif; /* if patient_age */
endif; /* if exist birthdate */
/*-----------------------------------*/
/* Calculate Body Surface Area (BSA) */
/*-----------------------------------*/
if exist ht_val
and ht_val > 0
then
/*-----------------------------------------------------------------------------------------------*/
/* Pediatric BSA calculation */
/*-----------------------------------------------------------------------------------------------*/
IF BSA_formula_preference = "Pediatric"
and exist wt_val
and wt_val > 0
then
BSA_number := SQRT(ht_val * (wt_val/3600));
BSA_formula := "BSA calculated using formula: SQRT(HeightCm * (WeightKg/3600))";
weight_used := wt_val;
/*-----------------------------------------------------------------------------------------------*/
/* Standard BSA calculation */
/*-----------------------------------------------------------------------------------------------*/
ELSEIF (BSA_formula_preference = "Standard" )
and exist wt_val
and wt_val > 0
then
BSA_number := (ht_val**0.725) * (wt_val**0.425) * 0.007184;
BSA_formula := "BSA calculated using formula: (WeightKg^0.425) * (HeightCm^0.725) * 0.007184)";
weight_used := wt_val;
/*-----------------------------------------------------------------------------------------------*/
/* Ideal Weight BSA calculation */
/*-----------------------------------------------------------------------------------------------*/
ELSEIF (BSA_formula_preference = "Ideal" )
then
(IdealWeightKg, Tooltip_formula, display_message) := call func_calc_weight
with (BSA_formula_preference, ht_val, wt_val, client_info_obj);
if exist IdealWeightKg and IdealWeightKg > 0
then
BSA_number := IdealWeightKg**0.425 * (ht_val)**0.725 * 0.007184;
BSA_formula := "BSA formula: (IdealWeightKg^0.425 * (HeightCm^0.725) * 0.007184)";
weight_used := IdealWeightKg;
else
BSA_number := 0;
endif; //if exist IdealWeightKg and IdealWeightKg > 0
/*-----------------------------------------------------------------------------------------------*/
/* Adjusted Weight BSA calculation */
/*-----------------------------------------------------------------------------------------------*/
ELSEIF (BSA_formula_preference = "Adjusted")
then
(AdjustedWeightKg, Tooltip_formula, display_message) := call func_calc_weight
with (BSA_formula_preference, ht_val, wt_val, client_info_obj );
if exist AdjustedWeightKg and AdjustedWeightKg > 0
then
BSA_number := AdjustedWeightKg**0.425 * (ht_val)**0.725 * 0.007184;
BSA_formula := "BSA formula: (AdjustedWeightKg^0.425 * (HeightCm^0.725) * 0.007184)";
weight_used := AdjustedWeightKg;
else
BSA_number := 0;
endif; //if exist AdjustedWeightKg and AdjustedWeightKg > 0
ENDIF; /* if BSA_formula_preference */
/*-----------------------------------------------------------------------------------------------*/
/* Rounds the BSA to two decimal points */
/*-----------------------------------------------------------------------------------------------*/
BSA_number_rounded:= (int ((BSA_number + 0.005) * 100))/100;
conclude TRUE;
else
/* The Object Layer will convert an Arden NULL to a zero or -1 */
conclude FALSE;
endif; /* if exist ht_val */
;;
action:
/* Returns the BSA */
return ( BSA_number_rounded, BSA_formula, weight_used ) ;
;;
end:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,266 @@
maintenance:
title: Calculate Estimated Creatinine Clearance;;
mlmname: SYS_CALC_EST_CRCL;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Calculates a patient{{{SINGLE-QUOTE}}}s Estimated Creatinine Clearance.
;;
explanation: Calculates the Estimated Creatinine Clearance using the following rules:
1. Estimated Creatinine Clearance is calculated based on the user{{{SINGLE-QUOTE}}}s preference for
equation for Creatinine Clearance and on preference for weight and BSA variations.
Formulas used include:
Cockcroft-Gault
EstCrCl = [(140 - Age) x Wt / (72 x SerumCreat)] x ( 0.85 if female)
Jelliffe
EstCrCl = [ [ 98 - 0.8 x (Age - 20) ] / SerumCreat ] x (0.9 if female) * BSA/1.73
The Cockcroft-Gault formula can be calculated with Standard, Ideal, or Adjusted weight.
The Jelliffe formula can be calculated normalized with Standard, Ideal, or Adjusted BSA,
or without BSA normalization.
2. If the preference is for the BSA or weight to be Adjusted or Ideal, then the actual ht and wt
that are passed to the MLM are used to call the BSA mlm with the given preference. This
will return the adjusted or ideal values for wt and BSA.
If the preference is not set, then the standard BSA formula will be used.
3. All input parameters are required including:
- preference for equation, either Cockcroft-Gault or Jelliffe
- preference for Standard, Ideal, or Adjusted variations of weight or BSA
- actual height in cm
- actual weight in kg
- serum creatinine in units of mg/dl (either resulted or user entered value)
- flag indicating if Jellife equation is to be calculated without BSA normalization
- client info object
4. The MLM returns the following:
- An error message if a parameter required to do the calculation is missing.
- Estimated Creatinine Clearance value rounded returned as mL/min units, or
Null if an error exists.
- A string containing the formula used to perform the calculation, or an
abbreviated error message
if an error exists. This is used in the Tooltip message.
- Sites can change the formula or text string as needed.
- Weight in kg used in calculation, or 0 if an error exists.
- BSA in m2 used in calculation, or 0 if an error exists.
;;
keywords: Creatinine Clearance Calculation;
;;
knowledge:
type: data-driven;;
data:
/* Arguments are passed in from the calling C++ program or MLM */
(EstCrCl_equation_preference, // string - valid strings are "Jelliffe" or "Cockcroft-Gault"
BSA_formula_preference, // string - valid strings are "Standard", "Ideal", or "Adjusted"
ht_val, // number in centimeters (cm)
wt_val, // number in kilograms (kg)
Serum_Creatinine, // number for Creatinine to be used in formula
calculate_with_BSA, // boolean - flag to indicate whether to use BSA in Jelliffe formula
client_info_obj // Arden ClientInfo object
) := argument;
/****************** Make Changes To Spelling And Flags In This Section *****************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/***************************************************************************************/
/* MLM to calculate BSA */
func_calc_BSA := MLM {{{SINGLE-QUOTE}}}SYS_CALC_BSA{{{SINGLE-QUOTE}}};
error_message := "";
ht_val := ht_val as number;
wt_val := wt_val as number;
Serum_Creatinine := Serum_Creatinine as number;
/* Retrieves birthdatetime and gender from ClientInfo Object that is passed as an argument */
if exist client_info_obj
then
(birthdatetime,
birth_year,
patient_gender ):= read last
{ClientInfo: birthdatetime, BirthYearNum, GenderTypeIntlCode
REFERENCING client_info_obj};
endif;
;;
evoke:
;;
logic:
/* Check to see if Serum Creatiine is a valid number */
if Serum_Creatinine > 0
then
/*-----------------------------------------------------*/
/* Calculate patient{{{SINGLE-QUOTE}}}s age */
/*-----------------------------------------------------*/
if exist birthdatetime
and birth_year > 0
and birthdatetime is time
then
patient_age := (NOW - birthdatetime) / (1 year);
endif; /* if exist birthdatetime */
/*----------------------------*/
/* check for existence of age */
/*----------------------------*/
if (exist patient_age) and (patient_age > 0)
then
/*-----------------------------------------------------------------------*/
/* Get the actual, ideal, or adjusted Body Surface Area (BSA) and weight */
/*-----------------------------------------------------------------------*/
(BSA_used,
BSA_formula,
weight_used) := call func_calc_BSA with
BSA_formula_preference,
ht_val,
wt_val,
client_info_obj;
/*---------------------------------------*/
/* {{{SINGLE-QUOTE}}}Cockcroft-Gault{{{SINGLE-QUOTE}}} EstCrCl calculation */
/*---------------------------------------*/
IF (EstCrCl_equation_preference = "Cockcroft-Gault")
then
if BSA_formula_preference = "Standard"
or BSA_formula_preference = ""
then
weight_used := wt_val;
endif;
if (exist weight_used) and (weight_used > 0)
then
EstCrCl_value := ((140 - patient_age) * weight_used)
/ (72 * Serum_Creatinine);
EstCrCl_formula := "((140 - Age) x Wt / (72 x SerumCreat))";
if patient_gender = "F"
then
EstCrCl_value := EstCrCl_value * 0.85;
EstCrCl_formula := EstCrCl_formula || " x 0.85";
endif; //gender = "F"
else // weight is missing!
EstCrCl_formula := "Missing " || BSA_formula_preference || " weight.";
error_message := BSA_formula_preference
|| " weight is needed to calculate Est. CrCl. ";
endif; // weight exists
/*------------------------------*/
/* Jelliffe EstCrCl calculation */
/*------------------------------*/
ELSEIF (EstCrCl_equation_preference = "Jelliffe")
then
EstCrCl_value := ((98 - 0.8 * (patient_age - 20)) / Serum_Creatinine);
EstCrCl_formula := "((98 - 0.8 x (Age - 20)) / SerumCreat)";
if patient_gender = "F"
then
EstCrCl_value := EstCrCl_value * 0.9;
EstCrCl_formula := EstCrCl_formula || " x 0.9";
endif;
if calculate_with_BSA
then
if (exist BSA_used) and (BSA_used > 0)
then
EstCrCl_value := EstCrCl_value * (BSA_used/1.73);
EstCrCl_formula := EstCrCl_formula || " x BSA/1.73";
else // BSA_used <= 0!!
if (NOT exist wt_val) or (wt_val <= 0)
then
wt_message := "Weight is required to perform BSA calculations. ";
else
wt_message := "";
endif;
if (NOT exist ht_val) or (ht_val <= 0)
then
ht_message := "Height is required to perform BSA calculations. ";
else
ht_message := "";
endif;
EstCrCl_value := NULL;
EstCrCl_formula := "Missing " || BSA_formula_preference || " BSA." ;
error_message := BSA_formula_preference
|| " BSA is needed to calculate Est. CrCl. "
|| wt_message || ht_message;
endif; // BSA exists
endif; // calc w BSA
endif; // C-G or Jelliffe calcs
/*-------------------------------------------*/
/* Add other EstCrCl calculations, as needed */
/*-------------------------------------------*/
else // patient_age is invalid
EstCrCl_formula := "Missing patient age. ";
error_message := "Missing patient age. ";
endif; // pt_age > 0
if (exist EstCrCl_value) and (EstCrCl_value > 0)
then
/*----------------------------*/
/* Format the formula message */
/*----------------------------*/
EstCrCl_formula := ("Est.CrCl(" ||
EstCrCl_equation_preference ||
") = " || EstCrCl_formula);
/*-----------------------------------------*/
/* Round the EstCrCl to two decimal points */
/*-----------------------------------------*/
EstCrCl_number_rounded:= (int ((EstCrCl_value + 0.005) * 100))/100;
endif; // if exist EstCrCl_value
else
EstCrCl_formula := "Invalid Serum Creatinine. ";
error_message := "Serum Creatinine must be a valid number. ";
endif; // if Serum_Creatinine > 0
conclude TRUE; // always, to return value or error message
;;
action:
/* Returns the values to the calling program */
return ( error_message, EstCrCl_number_rounded,
EstCrCl_formula, weight_used, BSA_used ) ;
;;
end:

View File

@@ -0,0 +1,180 @@
maintenance:
title: Calculate the Frequency Multiplier for Average Daily;;
mlmname: SYS_CALC_FREQMULT_AVERAGE;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Calculates a Frequency Mutiplier for a Frequency such as BID, Q18H, etc.
This AVERAGE DAILY multiplier is for the average number of times something can occur in a day.
;;
explanation: Using the Frequency dictionary and the Units of Measure
dictionary, an AVERAGE DAILY frequency multiplier is calculated
based on seconds, minutes, hours, days, weeks, months, or years.
The Frequency Multiplier can be used to calculate an Average
Daily Dose from a Single-Dose. For example, BID returns 2 as
a multiplier, and Q18H returns 1.333333 as a multiplier
;;
keywords: Frequency Multiplier; Average Daily
;;
knowledge:
type: data-driven;;
data:
/* Pass in a frequency as a string */
(order_med_frequency,
from_time,
from_uom):= argument;
/* The facility must map its Dictionary Codes to the Core UOM in the */
/* Units of Measure Dictionary. The MLM converts the facility-defined units of measure */
/* to the system-defined values in the Unit of Measure Dictionary called CoreUOM. */
day_string:= "day";
hour_string:= "hr";
minute_string:= "min";
month_string:= "month";
ounce_string:= "oz";
second_string:= "s";
week_string:= "week";
year_string:= "year";
if order_med_frequency = "<Variable Interval>"
then
frequency_type := 3;
time_from_value := from_time as number;
(time_core_uom) := read last
{"SELECT CoreUOM "
|| " FROM CV3UnitOfMeasure"
|| " WHERE Code = " || SQL (from_uom)
|| " AND Active = 1 " };
else
/* Gets the Frequency information from the Enterprise data */
/* Only gets the Active Frequencies and Active Units of Measures */
(frequency_code,
frequency_type,
time_from_value,
time_to_value,
time_uom,
time_core_uom):= read last
{"SELECT f.Code, f.DefinitionType, f.TimeFromValue, f.TimeToValue,"
|| " f.TimeUom, u.CoreUOM "
|| " FROM CV3Frequency AS f JOIN CV3UnitOfMeasure AS u"
|| " ON f.TimeUom = u.Code "
|| " WHERE f.Code = " || SQL (order_med_frequency)
|| " AND f.Active = 1 "
|| " AND u.Active = 1 " };
/* Handle frequency templates <qxh> and <qxm> by parsing the frequency string */
/* If changes are made to this code, also change them in SYS_CALC_FREQMULT_DAILY */
/* This is a temporary workaround for frequency templates */
If NOT Exist frequency_type
then
/* Declare C functions to parse the frequency string */
func_get_token := interface {char* msvcrt:strtok(char*, char*)};
func_get_str := interface {char* msvcrt:strstr(char*, char*)};
/* Declare characters used for delimiting the string */
/* Delimiters are Case Sensitive */
q_delim:= "Q";
h_delim:= "H";
m_delim:= "M";
/* Determine if the letter in at the back of the string is H or M */
get_H:= call func_get_str with (order_med_frequency, h_delim);
get_M:= call func_get_str with (order_med_frequency, m_delim);
/* Remove the front Q, so xH or xM is left */
trim_Q:= call func_get_token with (order_med_frequency, q_delim);
/* Set the time_core_uom */
/* Remove the H or the M, leaving a string representation of a number */
if exist get_H
then
time_core_uom := hour_string;
freq_num_str := call func_get_token with (trim_Q, h_delim);
elseif exist get_M
then time_core_uom := minute_string;
freq_num_str := call func_get_token with (trim_Q, m_delim);
endif; /* if exist get_H */
/* Convert string to number */
time_from_value := freq_num_str as number;
endif; /* If NOT Exist frequency_type */
endif /* if order_med_frequency = "<Variable Interaval>" */
;;
evoke:
;;
logic:
if time_core_uom = day_string then
if frequency_type = 1 /* y times per day */
then conversion_factor_ave:= time_from_value;
else conversion_factor_ave:= 1/ time_from_value ;
endif;
elseif time_core_uom = hour_string then
if frequency_type = 1 /* y times per hour */
then conversion_factor_ave:= 24 * time_from_value;
else conversion_factor_ave:= 24/ time_from_value;
endif;
elseif time_core_uom = minute_string then
if frequency_type = 1 /* y times per minute*/
then conversion_factor_ave:= 24*60* time_from_value;
else conversion_factor_ave:= 24*60/ time_from_value;
endif;
elseif time_core_uom = second_string then
if frequency_type = 1 /* y times per second */
then conversion_factor_ave:= 24*60*60* time_from_value;
else conversion_factor_ave:= 24*60*60/time_from_value;
endif;
elseif time_core_uom = week_string then
if frequency_type = 1 /* y times per week */
then conversion_factor_ave:= time_from_value / 7;
else conversion_factor_ave:= 1/(7 * time_from_value);
endif;
elseif time_core_uom = month_string then
if frequency_type = 1 /* y times per month */
then conversion_factor_ave:= time_from_value /(365/12);
else conversion_factor_ave:= (1/((365/12)* time_from_value));
endif;
elseif time_core_uom = year_string then
if frequency_type = 1 /* y times per year */
then conversion_factor_ave:= time_from_value/365;
else conversion_factor_ave:= 1/(365 * time_from_value);
endif;
endif; /* if time_core_uom */
Conclude true;
;;
action:
return conversion_factor_ave;
;;
end:

View File

@@ -0,0 +1,178 @@
maintenance:
title: : Calculate the Frequency Multiplier for Total Daily Dose;;
mlmname: SYS_CALC_FREQMULT_DAILY;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Calculates a Frequency Mutiplier for a Frequency such as BID, Q18H, etc.
This TOTAL DAILY multiplier is for the total number of times something can occur in a day.
;;
explanation: Using the Frequency dictionary and the Units of Measure
dictionary, a TOTAL DAILY frequency multiplier is calculated
based on seconds, minutes, hours, days, weeks, months, or years.
The Frequency Multiplier can be used to calculate an Total Daily
Dose from a Single-Dose. For example, both BID and Q18H
return 2 as a multiplier
;;
keywords: Frequency Multiplier; Average Daily
;;
knowledge:
type: data-driven;;
data:
/* Pass in a frequency as a string */
(order_med_frequency,
from_time,
from_uom):= argument;
/* The facility must map its Dictionary Codes to the Core UOM in the */
/* Units of Measure Dictionary. The MLM converts the facility-defined units of measure */
/* to the system-defined values in the Unit of Measure Dictionary called CoreUOM. */
day_string:= "day";
hour_string:= "hr";
minute_string:= "min";
month_string:= "month";
ounce_string:= "oz";
second_string:= "s";
week_string:= "week";
year_string:= "year";
if order_med_frequency = "<Variable Interval>"
then
frequency_type := 3;
time_from_value := from_time as number;
(time_core_uom) := read last
{"SELECT CoreUOM "
|| " FROM CV3UnitOfMeasure"
|| " WHERE Code = " || SQL (from_uom)
|| " AND Active = 1 " };
else
/* Gets the Frequency information from the Enterprise data */
/* Only gets the Active Frequencies and Active Units of Measures */
(frequency_code,
frequency_type,
time_from_value,
time_to_value,
time_uom,
time_core_uom):= read last
{"SELECT f.Code, f.DefinitionType, f.TimeFromValue, f.TimeToValue,"
|| " f.TimeUom, u.CoreUOM "
|| " FROM CV3Frequency AS f JOIN CV3UnitOfMeasure AS u"
|| " ON f.TimeUom = u.Code "
|| " WHERE f.Code = " || SQL (order_med_frequency)
|| " AND f.Active = 1 "
|| " AND u.Active = 1 " };
/* Handle frequency templates <qxh> and <qxm> by parsing the frequency string */
/* If changes are made to this code, also change them in SYS_CALC_FREQMULT_AVERAGE */
/* This is a temporary workaround for frequency templates */
If NOT Exist frequency_type
then
/* Declare C functions to parse the frequency string */
func_get_token := interface {char* msvcrt:strtok(char*, char*)};
func_get_str := interface {char* msvcrt:strstr(char*, char*)};
/* Declare characters used for delimiting the string */
/* Delimiters are Case Sensitive */
q_delim:= "Q";
h_delim:= "H";
m_delim:= "M";
/* Determine if the letter in at the back of the string is H or M */
get_H:= call func_get_str with (order_med_frequency, h_delim);
get_M:= call func_get_str with (order_med_frequency, m_delim);
/* Remove the front Q, so xH or xM is left */
trim_Q:= call func_get_token with (order_med_frequency, q_delim);
/* Set the time_core_uom */
/* Remove the H or the M, leaving a string representation of a number */
if exist get_H
then
time_core_uom := hour_string;
freq_num_str := call func_get_token with (trim_Q, h_delim);
elseif exist get_M
then time_core_uom := minute_string;
freq_num_str := call func_get_token with (trim_Q, m_delim);
endif; /* if exist get_H */
/* Convert string to number */
time_from_value := freq_num_str as number;
endif; /* If NOT Exist frequency_type */
endif /* if order_med_frequency = "<Variable Interaval>" */
;;
evoke:
;;
logic:
if time_core_uom = day_string then
if frequency_type = 1 /* y times per day */
then conversion_factor_total:= time_from_value;
else conversion_factor_total:= 1 ;
endif;
elseif time_core_uom = hour_string then
if frequency_type = 1 /* y times per hour */
then conversion_factor_total:= 24 * time_from_value;
else conversion_factor_total:= int ((24/ time_from_value)+ 0.999999);
endif;
elseif time_core_uom = minute_string then
if frequency_type = 1 /* y times per minute*/
then conversion_factor_total:= 24*60* time_from_value;
else conversion_factor_total:= int ((24*60/ time_from_value) + 0.999999);
endif;
elseif time_core_uom = second_string then
if frequency_type = 1 /* y times per second */
then conversion_factor_total:= 24*60*60* time_from_value;
else conversion_factor_total:= int ((24*60*60/time_from_value) + 0.999999);
endif;
elseif time_core_uom = week_string then
if frequency_type = 1 /* y times per week */
then conversion_factor_total:= int ((time_from_value / 7) + 0.999999);
else conversion_factor_total:= 1 ;
endif;
elseif time_core_uom = month_string then
if frequency_type = 1 /* y times per month */
then conversion_factor_total:= int ((time_from_value /(365/12)) + 0.999999);
else conversion_factor_total:= 1 ;
endif;
elseif time_core_uom = year_string then
if frequency_type = 1 /* y times per year */
then conversion_factor_total:= int ((time_from_value/365) + 0.999999);
else conversion_factor_total:= 1;
endif;
endif; /* if time_core_uom */
Conclude true;
;;
action:
return conversion_factor_total;
;;
end:

View File

@@ -0,0 +1,189 @@
maintenance:
title: Calculates Ideal or Adjusted Weights;;
mlmname: SYS_CALC_WT;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Calculates a patient{{{SINGLE-QUOTE}}}s Ideal or Adjusted weight.
;;
explanation: Calculates the BSA using the following rules:
1. If the formula preference = Ideal, then the ideal Weight formula is used.
Ideal weight = (((HeightCm / 2.54) - 60) * 2.3) + GenderConstant (50 for male; 45.5 for female)
2. If the formula preference = Adjusted, then the adjusted Weight formula is used.
Adjusted Weight = ((Actual wt - Ideal wt) * 0.25) + Ideal wt
;;
keywords: Weight Calculation; Ideal; Adjusted ;
;;
knowledge:
type: data-driven;;
data:
/* Arguments are passed in from the calling C++ program or MLM */
(Weight_formula_preference, //string - valid strings are Ideal or Adjusted
ht_val, //number in kilograms (kg)
wt_val, //number in centimeters (cm)
client_info_obj //Arden ClientInfo object
) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/* What is the HEIGHT limit for using the Ideal weight calculation? */
/* The calculation will be done if the height is GREATER THAN OR EQUAL TO this number listed below */
ideal_WT_height_limit:= 150; /* cm */
/* Change text between quotes to change text message displayed in Calculated Weights */
Calc_Wt_Display_Message:= "Please see tool tip for calculation formulas.";
under_limits_message := "Calculations performed only if height => " ||ideal_WT_height_limit|| " cm.";
/***************************************************************************************/
/* Retrieves birthdate and gender from ClientInfo Object that is passed as an argument */
if exist client_info_obj
then
(birthdate,
birth_year,
patient_gender ):= read last
{ClientInfo: birthdate, BirthYearNum, GenderTypeIntlCode
REFERENCING client_info_obj};
endif; // if exist client_info_obj
/*-----------------------------------------------------*/
/* Calculate a patient{{{SINGLE-QUOTE}}}s age - NOT USED AT THIS TIME */
/*-----------------------------------------------------*/
if exist birthdate
and birth_year > 0
and birthdate is time
then
patient_age:= (NOW - birthdate) / (1 year);
endif; /* if exist birthdate */
/* Initialize return values */
WeightKg:= 0;
Tooltip_Formula := " ";
/*-------------------------------------------*/
/* Convert a string value to an Arden number */
/*-------------------------------------------*/
ht_val := ht_val as number;
wt_val := wt_val as number;
/*------------------------------------*/
/* Check for missing values or errors */
/*------------------------------------*/
fatal_error := false;
if not (exist ht_val and ht_val > 0)
then
WeightKg_rounded := 0;
Tooltip_Formula := "Missing height value";
Calc_Wt_Display_Message := "No calculation performed.";
fatal_error := true;
else
if ht_val < ideal_WT_height_limit
then
WeightKg_rounded := 0;
Tooltip_Formula := "Height is below limits.";
Calc_Wt_Display_Message := under_limits_message;
fatal_error := true;
endif;
endif;
if not (exist patient_gender
and (patient_gender = "F" or patient_gender = "M"))
then
WeightKg_rounded := 0;
Tooltip_Formula := "Unknown patient gender";
Calc_Wt_Display_Message := "Calculation performed only when gender is known.";
fatal_error := true;
endif;
;;
evoke:
;;
logic:
if not fatal_error
then
/*---------------------------------------*/
/* Calculates the patient{{{SINGLE-QUOTE}}}s Ideal Weight */
/*---------------------------------------*/
if (Weight_formula_preference = "Ideal") or (Weight_formula_preference = "Adjusted")
then if patient_gender = "F"
then
WeightKg:= ((((ht_val /2.54)-60)* 2.3)+45.5);
Tooltip_Formula := "Formula used: (((Height(cm)/2.54)-60)* 2.3)+45.5";
else
WeightKg:= ((((ht_val/2.54)-60)* 2.3)+50);
Tooltip_Formula := "Formula used: (((Height(cm)/2.54)-60)* 2.3)+50";
endif; //if patient_gender = "F"
ideal_wt := WeightKg;
endif; //if (Weight_formula_preference = "Ideal" ) or (Weight_formula_preference = "Adjusted")
/*------------------------------------------*/
/* Calculates the patient{{{SINGLE-QUOTE}}}s Adjusted Weight */
/*------------------------------------------*/
if (Weight_formula_preference = "Adjusted")
then
if (exist wt_val AND wt_val > 0)
then
actual_wt := wt_val;
WeightKg:=((actual_wt - ideal_wt)* 0.25) + ideal_wt;
Tooltip_Formula := "Formula used: ((Actual wt - Ideal wt) * 0.25) + Ideal wt";
else
WeightKg:= 0;
Tooltip_Formula := "Adjusted weight cannot be calculated without actual weight";
endif; /* (exist wt_val AND wt_val > 0) */
endif; /* if Weight_formula_preference */
/*------------------------------------------*/
/* Rounds the weight to two decimal points */
/*------------------------------------------*/
WeightKg_rounded:= (int ((WeightKg + 0.005) * 100))/100;
endif; // no fatal errors
conclude TRUE; // always, to return all values
;;
action:
/* Returns the weight */
return ( WeightKg_rounded, Tooltip_Formula, Calc_Wt_Display_Message) ;
;;
end:

View File

@@ -0,0 +1,89 @@
maintenance:
title: Formats numbers into strings with commas;;
mlmname: SYS_FORMAT_NUMBER;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts,System MLM ;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Format a number as a string, using conversion rules:
Commas are used to delimit thousands
Exponent notation is never used
Trailing zeros which occur following the decimal point
and at the end of the string are trimmed off.
;;
explanation:
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
( num ) := argument;
;;
evoke: // called from another MLM
;;
logic:
if num is not number then
result := num;
conclude true;
endif;
result := num formatted with "%,f";
chars := extract characters result;
// loop through chars, and determine if there are trailing zeros
trailing_pos := 0;
found_trailing := false;
found_decimal := false;
pos := 0;
for ch in chars do
if (ch = ".") then
found_decimal := true;
found_trailing := true;
trailing_pos := pos;
elseif (ch = "0") and (found_decimal = true) and (found_trailing = false) then
found_trailing := true;
trailing_pos := pos;
elseif (ch <> "0") and (found_trailing = true) then
found_trailing := false;
endif;
pos := pos + 1;
enddo;
if found_trailing then
result := string (first trailing_pos from chars);
endif;
conclude true;
;;
action:
return result;
;;
end:

View File

@@ -0,0 +1,70 @@
maintenance:
title: CDS Local Session Definition;;
filename: SYS_GLOBAL_SESSION;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose:
This MLM defines the global session object,
stored in the Arden variable CDS_SESSION.global.
;;
explanation: Facilities should modify this MLM, as needed
to support custom MLMs that are created by the facility.
From Arden, the global session object can be referenced like this:
global_session := CDS_SESSION.global;
Note: this MLM is called by the system both to define and to return
a new session object. It must not refer to CDS_SESSION or else a circular
reference may occur where the MLM will call itself again and again.
;;
keywords: SESSION; CDS_SESSION
;;
knowledge:
type: data-driven;;
data:
// Declare the LOCAL SESSION object
global_session := object
[
activated_applications_list, // Used by the sample signature manager MLM
selected_patient_visit_list, // Used by the sample order entry worksheet info message MLM
global_field_1, // Rename these or add additional fields as
global_field_2 // needed for local institution{{{SINGLE-QUOTE}}}s MLMs
];
;;
evoke: // Called internally by the system as necessary
;;
logic:
// Create a GLOBAL SESSION and return it
global_session_obj := new global_session;
global_session_obj.activated_applications_list := ();
global_session_obj.selected_patient_visit_list := ();
conclude true;
;;
action:
return global_session_obj;
;;
end:

View File

@@ -0,0 +1,103 @@
maintenance:
title: CDS Environment Settings Definition;;
filename: SYS_LIB_CDSEnvironmentSettings;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose:
This MLM defines and populates the CDSEnvironmentSettings object
;;
explanation: Facilities should NOT modify this MLM.
From Arden, this can be referenced like this:
cds_env_settings := CDS_SESSION.CDSEnvironmentSettings;
Note: this MLM is called by the SYS_SESSION MLM which is called by the
system both to define and to return a new session object.
This MLM must not refer to CDS_SESSION or else a circular
reference may occur where the MLM will call itself again and again.
This MLM should ONLY be modified by Eclipsys.
;;
keywords: SESSION; CDS_SESSION, ENVIRONMENT PROFILE
;;
knowledge:
type: data-driven;;
data:
CDSEnvironmentSettingsDef := object
[
AlertDrugFood,
BSAFormula,
SeverityLevel,
HealthIssueTerm_Singular,
HealthIssueTerm_Plural
];
// Populate the object
( AlertDrugFood,
BSAFormula,
SeverityLevel,
HITermPural,
HITermSingular ) := READ LAST
{ "SELECT AlertDrugFood=(select value from HVCEnvProfile "
||" where HierarchyCode={{{SINGLE-QUOTE}}}CDS|Drug Interaction Alerts{{{SINGLE-QUOTE}}} "
||" AND code={{{SINGLE-QUOTE}}}Alert Drug Food{{{SINGLE-QUOTE}}}), "
||" BSAFormula = (select value from HVCEnvProfile "
||" where HierarchyCode={{{SINGLE-QUOTE}}}Client Info{{{SINGLE-QUOTE}}} "
||" AND code={{{SINGLE-QUOTE}}}BSAFormula{{{SINGLE-QUOTE}}}), "
||" SeverityLevel = (select value from HVCEnvProfile "
||" where HierarchyCode={{{SINGLE-QUOTE}}}CDS|Drug Interaction Alerts{{{SINGLE-QUOTE}}} "
||" AND code={{{SINGLE-QUOTE}}}Drug Severity Level{{{SINGLE-QUOTE}}}), "
||" HITermPlural = (select value from HVCEnvProfile "
||" where HierarchyCode={{{SINGLE-QUOTE}}}Client Info|Health Issue Label{{{SINGLE-QUOTE}}} "
||" AND code={{{SINGLE-QUOTE}}}Plural Term{{{SINGLE-QUOTE}}}), "
||" HITermSingular = (select value from HVCEnvProfile "
||" where HierarchyCode={{{SINGLE-QUOTE}}}Client Info|Health Issue Label{{{SINGLE-QUOTE}}} "
||" AND code={{{SINGLE-QUOTE}}}Singular Term{{{SINGLE-QUOTE}}}) " };
;;
evoke: // Called internally by the system as necessary
;;
logic:
// Create a session and return it
CDSEnvironmentSettings_obj := new CDSEnvironmentSettingsDef;
CDSEnvironmentSettings_obj.AlertDrugFood := AlertDrugFood;
CDSEnvironmentSettings_obj.BSAFormula := BSAFormula;
CDSEnvironmentSettings_obj.SeverityLevel := SeverityLevel;
CDSEnvironmentSettings_obj.HealthIssueTerm_Singular := HITermSingular;
CDSEnvironmentSettings_obj.HealthIssueTerm_Plural := HITermPural;
conclude true;
;;
action:
return CDSEnvironmentSettings_obj;
;;
end:

View File

@@ -0,0 +1,93 @@
maintenance:
title: CDS Session Definition;;
filename: SYS_LIB_SESSION;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose:
This MLM defines the top level session object,
stored in the Arden variable CDS_SESSION.
;;
explanation: Facilities should NOT modify this MLM.
If a facility wishes to add session variables,
they should be added to the MLM named SYS_LOCAL_SESSION.
From Arden, this can be referenced like this:
local_session := CDS_SESSION.local;
To add global session variables (these are only cleared when a user
logs off) modify the SYS_GLOBAL_SESSION.MLM.
From Arden, this can be referenced like this:
global_session := CDS_SESSION.global;
Note: this MLM is called by the system both to define and to return
a new session object. It must not refer to CDS_SESSION or else a circular
reference may occur where the MLM will call itself again and again.
This MLM should ONLY be modified by Eclipsys.
;;
keywords: SESSION; CDS_SESSION
;;
knowledge:
type: data-driven;;
data:
// Declare the MLM that will be called
local_session_mlm := MLM {{{SINGLE-QUOTE}}}SYS_LOCAL_SESSION{{{SINGLE-QUOTE}}};
global_session_mlm := MLM {{{SINGLE-QUOTE}}}SYS_GLOBAL_SESSION{{{SINGLE-QUOTE}}};
EnvProfile_session_mlm := MLM {{{SINGLE-QUOTE}}}SYS_LIB_CDSENVIRONMENTSETTINGS{{{SINGLE-QUOTE}}};
// Declare the TOP LEVEL SESSION Object
session := object
[
global,
local,
CDSEnvironmentSettings,
system_field_1, // Rename these or add additional fields as needed by Allscripts
system_field_2
];
;;
evoke: // Called internally by the system as necessary
;;
logic:
// Create a session and return it
session_obj := new session;
local := call local_session_mlm; // Create the local session
session_obj.local := local;
global := call global_session_mlm; // Create the global session
session_obj.global := global;
// Create the environment profile session object
CDSEnvironmentSettings_obj := call EnvProfile_session_mlm;
session_obj.CDSEnvironmentSettings := CDSEnvironmentSettings_obj;
conclude true;
;;
action:
return session_obj;
;;
end:

View File

@@ -0,0 +1,448 @@
maintenance:
title: CDS Local Session Definition;;
filename: SYS_LOCAL_SESSION;;
arden: version 2.5;;
version: 15.1;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2014-12-18;;
validation: testing;;
library:
purpose:
This MLM defines the local session object,
stored in the Arden variable CDS_SESSION.local.
;;
explanation: Facilities should modify this MLM, as needed
to support custom MLMs that are created by the facility.
From Arden, the local session object can be referenced like this:
local_session := CDS_SESSION.local;
Note: this MLM is called by the system both to define and to return
a new session object. It must not refer to CDS_SESSION or else a circular
reference may occur where the MLM will call itself again and again.
Change history
01.13.2009 DW Added session object code to recall the answer to the pregnancy and lms questions and populate them on other forms during the session
12.27.2010 DW Added site customization to 5.5 version
03.14.2011 DW Added session object for Consulting MD
06.13.2011 TMS Added additional session objects for VTE prophylaxis
07.05.2011 DW Added 2 lines in the Logic section to set the 2 heparin object to empty list (per trackit ticket)
11.21.2011 ACS Added object for tracking selected GROUPINGS on the Physician Progress Note
01.30.2012 JML Added object for tracking unsubmitted tube feeding orders
04.01.2012 JML Added list object containing list of unsubmitted anticoagulant orders triggered from SCH_ALERT_ON_ANTICOAGULANT_ORDERS.
04.01.2013 JML Added boolean variable to control the number of times a Beta Blocker alert is displayed on order entry.
03.23.2015 JML Added four new session variables for Vancomycin Antibiotic scheduling for conditional orders.
12.3.2015 STH Added new VTE not ordered session object. {Go-Live 12/15/2015}
03.01.2016 STH SR#: 33758 Added new SessionMaxRepeatLabNames & SessionMaxRepeatLabTimes for Post Initiation Thrombolytic therapy {GO LIVE 3/7/2016}
02.19.2016 STH CSR#: 32165 Added new SessionUnSubTypeandScreen for the FORM_SET_TRANSFUSION_PRODUCT OrderSet MLM.
05.31.2016 JML CSR#: 34156 Added new SessionVancoTroughDose & SessionVancoTroughUOM to capture vanco calculated dose & UOM.
08.22.2016 STH CSR#: 34139 Add new SessiionBloodConsent to capture unsubmitted BloodConsent orders in this current session {GO 10/4/2016}
10.31.2017 TMS CSR# 35723 Added session object to capture unsubmitted diet or NPO orders for diabetic management protocol
11.13.2017 TMS CSR# 35723 Added session object to capture unsubmitted IV steroid orders for diabetic management protocol
03.21.2016 DW CSR# 35320 Added Session Objects for Sunrise Surgical
07.07.2017 JML CSR# 34155 Added session object to capture stop date on vancomycin orders to control ordering of vanco trough lab
12.04.2017 DW CSR# 26413 Added Session Objects for Sunrise Access Manager
02.06.2018 DW CSR# 26413 Added Session Objects for Sunrise Access Manager - Patient Type for Hospice MLM
10.08.2018 DW CSR# 36715 Created - PDMP in order session
01.22.2019 JML CSR# 37770 - Added session object to capture Admission Diagnosis & Admit Date/Time for Admission Order Confirmation order for co-sign
08.06.2019 DW CSR# 38551 Redesign based upon JACHO observations
;;
keywords: SESSION; CDS_SESSION
;;
knowledge:
type: data-driven;;
data:
// Declare the LOCAL SESSION object
local_session := object
[
SessionMaxRepeatLabNames, //Added to hold unsubmitted lab names with max times
SessionMaxRepeatLabTimes, //Added to hold unsubmitted lab names with max times
UnsubmittedRepeatLabDetails,//Added to hold unsubmitted lab names with max times
has_received_order_worksheet_message,
irreg_sched, // Rename these or add additional fields as
Sess_APTTValue, // Holds APPT value from heparin child orders to relate to order sets
SessionPregnancyValue, // Holds Pregnancy value for use in other ofders of the order sets
SessionLMPValue, // Holds LMP value for use in other ofders of the order sets
SessionIndications1, // Holds Clinical Indications value for use in other of orders of the order sets
SessionIndications2, // Holds Clinical Indications value for use in other of orders of the order sets
SessionUnSubTypeandScreen, //identifies if a Type and Screen has been submitted yet
SessionUnSubBloodConsent, //identifies if a Blood Consent has been submitted yet
SessionUnsubmittedHeparinSQ, // Holds Unsubmitted Heparin SQ orders
SessionUnsubmittedHeparinIV, // Holds Unsubmitted Heparin IV orders
SessionVTEContraindication, // Holds VTE Prophylaxis Evaluation Contraindication Information
SessionVTEScore, // Holds VTE Prophylaxis Score Information
SessionVTENotIndicated, // Holds VTE Prophylaxis Not Indicated Information
SessionVTENotOrdered, // Holds VTE Prophylaxis Not Ordered Information
SessionReleseOrderAlertFired, // Holds VTE Prophylaxis Evaluation Contraindication Information
NowAndThenOrderConfig,
SessionConsultingMD, // Holds Consulting MD Provider Number values
ACSPNGroupSelections, // Holds GROUPING selections on the Physician Progress Note
ACS_FormatedText, // Hold Text value for Physician Progress note from Doc_func_Max_Temp MLM
SessionUnsubDietExists,
SessionUnsubNPOOrder,
SessionUnsubDietOrder,
SessionUnsubIVSteroidOrder, // Hold value for diabetic management protocol
SessionFallRiskMedLast , //Indicates if the last med was selected
SessionRepeatTime,
SessionRepeatfreq,
Sessionmaxoccurence,
Sessioncheckall,
SessionLabOrderSet,
SessionTemperatureCelsius,
SessionUnsubmittedAnticoagulantOrders, //List of unsubmitted anticoagulant med orders
SessionSuicideOrdersSelected, //Suicide orders selected in structured notes
//Blood Gas Custom fields
SessionBloodGas,
SessionLAB_VO_DI_Patient_Temp,
SessionLAB_RC_BGCMT_LV_RespNCLPM,
SessionLAB_RC_BGCMT_LO_RespRoomAir,
SessionLAB_RC_BGCMT_LO_Resp100_02,
SessionLAB_RC_BGCMT_LV_RespNasalMaskLPM,
SessionLAB_RC_BGCMT_LO_RespNonRebreather,
SessionLAB_RC_BGCMT_LO_RespPartRebreather,
SessionLAB_RC_BGCMT_LO_AllensNeg,
SessionLAB_RC_BGCMT_LO_AllensPosi,
SessionLAB_RC_BGCMT_LV_RespFaceMaskLPM,
SessionLAB_RC_BGCMT_LV_RespVenturiMaskFIO2,
SessionLAB_RC_BGCMT_LV_RESP_Oximizer_LPM,
SessionLAB_RC_BGCMT_RespAerosolMode,
SessionLAB_RC_BGCMT_BIPAP_CPAP,
SessionLAB_RC_BGCMT_LV_RespVentMode,
SessionLAB_VO_DI_PatientLocation,
SessionLAB_RC_BGCMT_LV_RespAerosolConc,
SessionLAB_RC_BGCMT_RespMode_BIPAP_CPAP,
SessionLAB_RC_BGCMT_LV_RespIPAPcmH2O,
SessionLAB_RC_BGCMT_LV_RespEPAPcmH2O,
SessionLAB_RC_BGCMT_LV_RespBIPAPCPAPO2,
SessionLAB_RC_BGCMT_LV_RespBIPAPCPAPLPM,
SessionLAB_RC_BGCMT_LV_RespVent_VT,
SessionLAB_RC_BGCMT_LV_RespVent_O2ConcFIO2,
SessionLAB_RC_BGCMT_LV_RespVent_PEEP,
SessionLAB_RC_BGCMT_LV_RespVent_PressureSupport,
SessionLAB_RC_BGCMT_LV_RespVent_Rate,
//Blood Gas Custom fields
/*
1x
*/
SeessionScheduledBloodGases1xtimesCheckbox,
SeessionScheduledBloodGases1xtimesRequestdate,
SeessionScheduledBloodGases1xtimesRequesttime,
SeessionScheduledBloodGases2xtimesCheckbox,
SeessionScheduledBloodGases2xtimesRequestdate,
SeessionRepeatlabPlsamaAPTTCBCOrder,
SeessionRepeatlabPlsamaCheckbox,
SeessionRepeatlabAPTTCheckbox,
SeessionRepeatlabCBCCheckbox,
SeessionRepeatlabRepeatFrequency,
SeessionRepeatlabmaxoccurence,
SeessionRepeatlabRequestdate,
SeessionRepeatlabRequesttime,
SeessionRepeatlabq2Checkbox,
SeessionRepeatlabq2maxoccurence,
SeessionRepeatlabq2Requestdate,
SeessionRepeatlabq2Requesttime,
sessionIsConfig,
SessionRepeatlabArray,
SessionScheduledBloodGasesArray,
SeessionRepeatLabq2array,
SessionzzsodiumfromBloodgasRequesteddate,
SessionzzsodiumfromBloodgasRequestedtime,
SessionzzsodiumfromBloodgasTimecode,
SessionAMRoundsAutoReorder,
SessionBetaBlockerDisplayAlert,
SessionPDMPSearch, // Prevents multiple PDMP search requests in one session
/* Readmission Risk Order */
SessionReadmissionOrder,
SessionReadmissionScore,
SessionReadmissionPharmacy,
SessionReadmissionDiagnosis,
SessionReadmissionDischarge,
SessionReadmissionFunctional,
SessionReadmissionDevice,
SessionReadmissionNutritional,
SessionReadmissionSmoking,
SessionReadmissionDiagnosisForMessage,
SessionNutritionalForMessage,
SessionDeviceMessage,
SessionSmokingForMessage,
// Pediatric Order
SessionPediatricSpecialNeed,
SessionPediatricSpecialNeedForMessage,
//Discharge Orders
SessionDischargeLabOrders,
SessionDischargeMIOrders,
//Vancomycin Trough Antibiotic Scheduling Date Time
SessionUnsubVancoExists,
SessionVancoTroughScheduledDate,
SessionVancoTroughScheduledTime,
SessionVancoTroughFrequency,
SessionVancoTroughFrequencyList,
SessionVancoTroughDose,
SessionVancoTroughUOM,
SessionVancoTroughStopAfter,
SessionVancoTroughStopDate,
SessionVancoTroughStopTime,
SessionVancoTroughAddlDose,
SessionVancoGiveSTATNOWOrdered,
// CSR:33419-For Request Bed Order from {{{SINGLE-QUOTE}}}Place in Observation{{{SINGLE-QUOTE}}} and {{{SINGLE-QUOTE}}} Admit to Inpatient{{{SINGLE-QUOTE}}} Order
SessionRequestBed,
SessionRequestedGUID,
// added by Deepty Singh for Release Order MLM
releaseQry ,
releaseFreq ,
//CSR 37770 - For Admission Order Confirmation from {{{SINGLE-QUOTE}}}Place In Observation{{{SINGLE-QUOTE}}} and {{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}} Order
SessionAdmissionOrderConfirmation,
SessionAdmissionOrderAttendingPhysician,
SessionAdmissionOrderEffectiveDate,
// Sunrise Access Manager Objects CSR# 26413 DW 12.04.2017
SessionPrimaryVisitInsurance,
SessionService,
SessionPatientType,
SessionInsurancePlanBIssueCorrected,
// Sunrise Surgical Session Objects
//Modified by Phil Thomas, Eclipsys - New varible declaration for the "SCE_Telephone_Order_Notice" MLM
has_seen_telephone_order_notice, //S2V Variable used for the Telephone order readback workflow
is_telephone_order_session_Order_Enter, //S2V Variable used for the Telephone order readback workflow
Order_Set_Telephone_Order_Notice, //S2V Variable used for the Telephone order readback workflow
telephone_order_user_name, //S2V Variable used for the Telephone order readback workflow
telephone_order_user_occup, //S2V Variable used for the Telephone order readback workflow
CareProviderID, // Rename these or add additional fields as
ACSPNGroupSelections, //ACS: Hols GROUPING selections on the Physician Progress Note
local_field_1, // As needed for local institution{{{SINGLE-QUOTE}}}s MLMs
local_field_2, // As needed for local institution{{{SINGLE-QUOTE}}}s MLMs
local_field_3, // As needed for local institution{{{SINGLE-QUOTE}}}s MLMs
Current_Roadmap_GUID, //Allscripts Oncology Content package
Current_Roadmap_SignificantDtm, //Allscripts Oncology Content package
Current_Matching_Days, //The new eligible search window if the user wishes to expand the roadmap search
OrderSetSource , //Needed for OrderSetInit changes to VORB workflow
PregAlert_Reviewed_Once, //Needed for the IsPregnancy alert in Rad Order Forms
current_orders //S2V Varible used in FORM_OS_Order_Omission_Check MLM
,CCC_LV //20140904 SMS: holds charted list values on SN
,CCC_ChartedObs //20140904 SMS: holds charted obs list on SN
,Radiology_Results_Last_Selection //20141114 SMS: Oncology Content Package
,Pathology_Results_Last_Selection //20141114 SMS: Oncology Content Package
,onc_disease_name //20160707 SKelly: Oncology update
,ACS_OrderReplacmentOrderInfo
// End of Sunrise Surgical Session Objects
];
;;
evoke: // Called internally by the system as necessary
;;
logic:
// Create a LOCAL SESSION and return it
local_session_obj := new local_session;
local_session_obj.SessionMaxRepeatLabNames := ();
local_session_obj.SessionMaxRepeatLabTimes := ();
local_session_obj.UnsubmittedRepeatLabDetails := ();
local_session_obj.has_received_order_worksheet_message := false;
local_session_obj.irreg_sched := False;
local_session_obj.GridField:= (false,false,false);
local_session_obj.NowAndThenOrderConfig := ();
local_session_obj.SessionUnsubmittedHeparinSQ:= ();
local_session_obj.SessionUnsubmittedHeparinIV:= ();
local_session_obj.SessionUnSubTypeandScreen := false;
local_session_obj.SessionUnSubBloodConsent := false;
local_session_obj.ACSPNGroupSelections := ();
local_session_obj.ACS_FormatedText := (); // for Max Temp Text Value
local_session_obj.SessionUnsubDietExists := false;
local_session_obj.SessionUnsubNPOOrder := false;
local_session_obj.SessionUnsubDietOrder := false;
local_session.SessionUnsubIVSteroidOrder := false;
local_session_obj.SessionFallRiskMedLast := false;
local_session_obj.SessionRepeatTime :="";
local_session_obj.SessionRepeatfreq := "";
local_session_obj.Sessionmaxoccurence := "";
local_session_obj.Sessioncheckall := "";
local_session_obj.SessionLabOrderSet := false;
local_session_obj.SessionTemperatureCelsius := "";
local_session_obj.SessionUnsubmittedAnticoagulantOrders := ();
local_session_obj.SessionSuicideOrdersSelected := ();
//Blood Gas Custom fields
local_session_obj.SessionBloodGas := false;
local_session_obj.SessionLAB_VO_DI_Patient_Temp := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespNCLPM := "";
local_session_obj.SessionLAB_RC_BGCMT_LO_RespRoomAir := "";
local_session_obj.SessionLAB_RC_BGCMT_LO_Resp100_02 := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespNasalMaskLPM := "";
local_session_obj.SessionLAB_RC_BGCMT_LO_RespNonRebreather := "";
local_session_obj.SessionLAB_RC_BGCMT_LO_RespPartRebreather := "";
local_session_obj.SessionLAB_RC_BGCMT_LO_AllensNeg := "";
local_session_obj.SessionLAB_RC_BGCMT_LO_AllensPosi := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespFaceMaskLPM := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespVenturiMaskFIO2 := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RESP_Oximizer_LPM := "";
local_session_obj.SessionLAB_RC_BGCMT_RespAerosolMode := "";
local_session_obj.SessionLAB_RC_BGCMT_BIPAP_CPAP := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespVentMode := "";
local_session_obj.SessionLAB_VO_DI_PatientLocation := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespAerosolConc := "";
local_session_obj.SessionLAB_RC_BGCMT_RespMode_BIPAP_CPAP := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespIPAPcmH2O := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespEPAPcmH2O := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespBIPAPCPAPO2 := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespBIPAPCPAPLPM := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespVent_VT := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespVent_O2ConcFIO2 := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespVent_PEEP := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespVent_PressureSupport := "";
local_session_obj.SessionLAB_RC_BGCMT_LV_RespVent_Rate := "";
local_session_obj.SeessionScheduledBloodGases1xtimesCheckbox := false;
local_session_obj.SeessionScheduledBloodGases1xtimesRequestdate :="";
local_session_obj.SeessionScheduledBloodGases1xtimesRequesttime :="";
local_session_obj.SeessionScheduledBloodGases2xtimesCheckbox := false;
local_session_obj.SeessionRepeatlabq2Checkbox := false;
local_session_obj.SeessionRepeatlabq2maxoccurence := "";
local_session_obj.SeessionRepeatlabq2Requestdate := "";
local_session_obj.SeessionRepeatlabq2Requesttime :="";
local_session_obj.SeessionScheduledBloodGases2xtimesRequestdate := "";
local_session_obj.SeessionRepeatlabPlsamaCheckbox := false;
local_session_obj.SeessionRepeatlabAPTTCheckbox := false;
local_session_obj.SeessionRepeatlabCBCCheckbox := false;
local_session_obj.SeessionRepeatlabRepeatFrequency :="";
local_session_obj.SeessionRepeatlabmaxoccurence :="";
local_session_obj.SeessionRepeatlabRequestdate :="";
local_session_obj.SeessionRepeatlabRequesttime :="";
local_session_obj.SeessionRepeatlabPlsamaAPTTCBCOrder := "";
local_session_obj.sessionIsConfig := false;
local_session_obj.SessionRepeatlabArray := "";
local_session_obj.SessionScheduledBloodGasesArray := "";
local_session_obj.SeessionRepeatLabq2array := "";
local_session_obj.SessionzzsodiumfromBloodgasRequesteddate := "";
local_session_obj.SessionzzsodiumfromBloodgasRequestedtime := "";
local_session_obj.SessionzzsodiumfromBloodgasTimecode := "";
local_session_obj.SessionPDMPSearch:= "false";
//Blood Gas Custom fields
//AM Rounds Reorder
local_session_obj.SessionAMRoundsAutoReorder := "";
//Beta Blocker on Order Init Alert
local_session_obj.SessionBetaBlockerDisplayAlert := true;
//Readmission Risk Order
local_session_obj.SessionReadmissionOrder := "";
local_session_obj.SessionReadmissionScore := "";
local_session_obj.SessionReadmissionPharmacy := "";
local_session_obj.SessionReadmissionDiagnosis := "";
local_session_obj.SessionReadmissionDischarge := "";
local_session_obj.SessionReadmissionFunctional := "";
local_session_obj.SessionReadmissionDevice := "";
local_session_obj.SessionReadmissionNutritional := "";
local_session_obj.SessionReadmissionSmoking := "";
local_session.SessionReadmissionDiagnosisForMessage := "";
local_session.SessionNutritionalForMessage := "";
local_session.sessionDeviceMessage := "";
local_session.SessionSmokingForMessage := "";
//Discharge Orders
local_session.SessionDischargeLabOrders := "";
local_session.SessionDischargeMIOrders := "";
//Vancomycin Trough Antibiotic Scheduled Date Time
local_session_obj.SessionUnsubVancoExists := false;
local_session_obj.SessionVancoTroughScheduledDate := NULL;
local_session_obj.SessionVancoTroughScheduledTime := NULL;
local_session_obj.SessionVancoTroughFrequency := "";
local_session_obj.SessionVancoTroughFrequencyList := "";
local_session_obj.SessionVancoTroughDose := 0;
local_session_obj.SessionVancoTroughUOM := "";
local_session_obj.SessionVancoTroughStopAfter := "";
local_session_obj.SessionVancoTroughStopDate := "";
local_session_obj.SessionVancoTroughStopTime := "";
local_session_obj.SessionVancoTroughAddlDose := false;
local_session_obj.SessionVancoGiveSTATNOWOrdered := false;
// CSR#33419 -for Request Bed Order
local_session_obj.SessionRequestBed:="" ;
local_session_obj.SessionRequestedGUID := "";
//CSR# 37770 - Admission Order Confirmation
local_session_obj.SessionAdmissionOrderConfirmation := "";
local_session_obj.SessionAdmissionOrderAttendingPhysician := "";
local_session_obj.SessionAdmissionOrderEffectiveDate := "";
local_session_obj.releaseQry := "";
local_session_obj.releaseFreq := "";
// Sunrise Access Manager Objects CSR# 26413 DW 12.04.2017
SessionPrimaryVisitInsurance:= "";
SessionService:= "";
SessionPatientType:= "";
SessionInsurancePlanBIssueCorrected:= "";
// Sunrise Surgical Session Objects
local_session_obj.PregAlert_Reviewed_Once := False;
//Modified by Phil Thomas, Eclipsys - Save the deafult value upon patient selection for the telephone order notice MLM
local_session_obj.has_seen_telephone_order_notice := false;
local_session_obj.is_telephone_order_session_Order_Enter := false;
local_session_obj.Order_Set_Telephone_Order_Notice := false;
local_session_obj.telephone_order_user_name := NULL;
local_session_obj.telephone_order_user_occup := NULL;
local_session_obj.ACSPNGroupSelections := (); //ACS 2012-08-02
//Modified - Below are for Oncology Content Order Sets
local_session_obj.Current_Roadmap_GUID := NULL;
local_session_obj.Current_Roadmap_SignificantDtm := NULL;
local_session_obj.Current_Matching_Days := NULL;
//Modified for OrderSetInit changes to VORB workflow
local_session_obj.OrderSetSource := null;
local_session_obj.current_orders := ();
local_session_obj.CCC_LV := NULL; //20140904 SMS
local_session_obj.CCC_ChartedObs := NULL; //20140904 SMS
local_session_obj.Radiology_Results_Last_Selection := NULL; //20141114 SMS
local_session_obj.Pathology_Results_Last_Selection := NULL; //20141114 SMS
local_session_obj.onc_disease_name := ""; // 07.07.2016 SKelly
local_session_obj.ACS_OrderReplacmentOrderInfo := ();
// End of Sunrise Surgical Session Objects
conclude true;
;;
action:
return local_session_obj;
;;
end:

View File

@@ -0,0 +1,265 @@
maintenance:
title: Round Medication Dosage;;
mlmname: SYS_ROUND_DOSAGE;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Rounds a medication dose to the appropriate value using the medication route; or
within the limit of a maximum of 10% variation, regardless of route.
;;
explanation: Implements rounding rules in one of three ways. The first two were developed
by Eclipsys, and the third was developed at Johns Hopkins Hospital using an algorithm
that limits the rounding so that it never exceeds 10% of the original dose amount. The
Eclipsys rounding rules are designated as "Standard" and are the default function of
this MLM. The third rule is designated as "10pctLimit" and can be selected by changing
the RoundingRule flag in the Spelling and Flags section.
The "Standard" rounding rules can be used when the route is supplied. An error message
is returned if the Dose is NOT a string, or if the Route is NULL, or if the dose amount
is smaller than 0.005:
(1) The Parenteral Rounding Rules are used whenever the route matches the routes
listed in the Parenteral_Route_List variable.
(2) The Other Rounding Rules are used whenever a route exists and does NOT match
the routes listed in the Parenteral_Route_List variable.
PARENTERAL ROUNDING RULES
For values < 0.005, return Error_Message
For values <= 1, round to the nearest 0.01
For values > 1 and <= 5, round to the nearest 0.1
For values > 5 and <= 50, round to the nearest 1 (integer)
For values > 50 and <= 100, round to the nearest 2 (even number)
For values > 100 and <= 500, round to the nearest 10 (integer)
For values > 500 and <= 2000, round to the nearest 50 (integer)
For values > 2000, round to the nearest 100 (integer)
OTHER ROUNDING RULES
For values < 0.005, return Error_Message
For values <= 1, round to the nearest 0.01
For values >= 1 and <= 10, round to the nearest 0.1
For values >= 10 and <= 50, round to the nearest integer
For values > 50, round to the nearest 5
The "10pctLimit" rule implements the requirement that rounding shall not exceed 10% of the original
amount. It rounds to values that are always within 1 log value of the dose, as in the chart below.
It will not evaluate a Route nor return a route error message. To conform with the functional limits
of the Sunrise application, it will return: 1) an error message and NULL for the rounded dose if
the dose amount is less than 0.00005; 2) a warning message and a rounded dose that may exceed the
10% limit if 0.00005 <= dose < 0.0005; or 3) a NULL message and a rounded dose within the 10% limit
for all other dose values.
. .
. .
(error) any smaller <= Dose < 0.00005 -> return Error_Message
0.00005 <= Dose < 0.0005 -> Round to the nearest 0.0001, return warning_message
0.0005 <= Dose < 0.005 -> Round to the nearest 0.0001
0.005 <= Dose < 0.05 -> Round to the nearest 0.001
0.05 <= Dose < 0.5 -> Round to the nearest 0.01
(A) 0.5 <= Dose < 5 -> Round to the nearest 0.1
(B) 5 <= Dose < 50 -> Round to the nearest 1
50 <= Dose < 500 -> Round to the nearest 10
500 <= Dose < 5000 -> Round to the nearest 100
5000 <= Dose < 50000 -> Round to the nearest 1000
50000 <= Dose < 500000 -> Round to the nearest 10000
500000 <= Dose < 5000000 -> Round to the nearest 100000
5000000 <= Dose < 50000000 -> Round to the nearest 1000000
.
.
.
METHOD:
1) The Dose is normalized by moving the decimal point so that
1 <= (normalized value) < 10. This is done by taking the log of the Dose.
2) Because the normalized Dose satisfies 1 <= (normalized Dose) < 10, we apply
rule (A) above if the normalized Dose is < 5 and rule (B) above otherwise.
3) The decimal point is moved back to its former location (denormalized).
A facility can modify this MLM if a different rounding is preferred.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
/***************** Make Changes To Spelling And Flags In This Section ******************/
// The rounding rule type to be applied by the MLM. Current valid values are
// "Standard" (the default) and "10pctLimit"
RoundingRule := "Standard";
// The list of PARENTERAL ROUTES that will be used to round the
// dose using the "Dose Rounding Rules for Parenteral Routes."
// The strings must match entries in your Route Dictionary.
// If there any entries that are NOT in your Route Dictionary, remove them.
Parenteral_Route_List := ("IM", "IM or IV", "IV", "IV push",
"IVPB", "SC", "Subcutaneous");
/* Set to true if logging is needed.*/
log_execution_info := false;
/***************************************************************************************/
/*-----------*/
/* ARGUMENTS */
/*-----------*/
(dose, // A number that is the amount of the dose.
route) // A string that is from the Route Dictionary.
:= Argument;
/* Set Return Variables to NULL */
rounded_dose := NULL;
error_message := NULL;
/* Set Round, Dose and Route errors to blank */
round_error := "";
dose_error := "";
route_error := "";
/* Assume no errors to start */
fatal_error := false;
minor_error := false;
if dose is not number then
/*------------------------------------------------------*/
/* Create Error Message for non-numerical dose argument */
/*------------------------------------------------------*/
fatal_error := true;
dose_error := " the Dose is NOT a number.";
else
/*----------------------------------------------*/
/* proceed if we have numeric argument for dose */
/*----------------------------------------------*/
if (RoundingRule is null or RoundingRule = "Standard") then
if not exist Route then
fatal_error := true;
route_error := " the Route is missing or invalid.";
elseif dose < 0.005 then
fatal_error := true;
dose_error := " the Dose amount is less than the {{{SINGLE-QUOTE}}}Standard{{{SINGLE-QUOTE}}} rounding lower limit (0.005).";
else // process only if we have a route
if route is in Parenteral_Route_List then
/*---------------------------*/
/* PARENTERAL Rounding Rules */
/*---------------------------*/
if dose <=1 then
/* For values <= 1, round to the nearest 0.01 */
rounded_dose:= (int((dose + 0.0051)*100))/100;
elseif dose <= 5 then
/* For values > 1 and <= 5, round to the nearest 0.1 */
rounded_dose:= (int((dose + 0.051)*10))/10;
elseif dose <= 50 then
/* For values > 5 and <= 50, round to the nearest 1 (integer) */
rounded_dose:= int(dose + 0.51);
elseif dose <= 100 then
/* For values > 50 and <= 100, round to the nearest 2 (even number) */
rounded_dose:= int((dose/2)+ 0.5)* 2;
elseif dose <= 500 then
/* For values > 100 and <= 500, round to the nearest 10 (integer) */
rounded_dose:= int((dose/10)+ 0.5)* 10;
elseif dose <= 2000 then
/* For values > 500 and <= 2000, round to the nearest 50 (integer) */
rounded_dose:= int((dose/50)+ 0.5)* 50;
elseif dose > 2000 then
/* For values > 2000, round to the nearest 100 (integer) */
rounded_dose:= int((dose/100)+ 0.5)* 100;
endif; // dose ranges (Parenteral route)
else
/*---------------------------------------------*/
/* OTHER (non-parenteral Route) Rounding Rules */
/*---------------------------------------------*/
if dose <= 1 then
/*For values <= 1, round to the nearest 0.01*/
rounded_dose:= (int((dose + 0.0051)*100))/100;
elseif dose < 10 then
/* For values >= 1 and <= 10, round to the nearest 0.1 */
rounded_dose:= (int((dose + 0.051)*10))/10;
elseif dose <= 50 then
/* For values >= 10 and <= 50, round to the nearest integer */
rounded_dose:= int(dose + 0.51);
else
/* For values > 50, round to the nearest 5 */
rounded_dose:= int((dose/5)+ 0.51)* 5;
endif; // dose ranges (non-Parenteral route)
endif; // Route is in parenteral list
endif; // not exist Route (for Standard rounding)
elseif RoundingRule = "10pctLimit" then
/* the number of decimal places is found by the log base 10 */
decimal_offset := int(log10(dose));
/* shift decimal point to "normalize" dose */
dose_normalized := dose / (10**decimal_offset);
/*-----------------------------------*/
/* now 1 <= dose_normalized < 10 */
/*-----------------------------------*/
if (dose < 0.00005) then
fatal_error := true;
dose_error := " the Dose amount is less than the {{{SINGLE-QUOTE}}}10pctLimit{{{SINGLE-QUOTE}}} "
|| "rounding lower limit (0.00005).";
elseif (0.00005 <= dose) and (dose < 0.0005) then
rounded_dose := dose formatted with "%.4f";
rounded_dose := rounded_dose as number;
if (abs(rounded_dose - dose) / dose) > 0.1 then
minor_error := true;
round_error := " rounded dose is outside the 10% limit "
|| "due to number of decimal places.";
endif; // rounded dose is outside 10%
else
/* round value below 5 to nearest 10th */
if dose_normalized < 5 then
rounded_dose_normalized := int((dose_normalized + 0.051)*10)/10;
else
/* or round to next higher integer */
rounded_dose_normalized := int(dose_normalized + 0.51);
endif;
/* restore decimal point */
rounded_dose := rounded_dose_normalized * (10**decimal_offset);
endif; // (dose < 0.00005) (10pctLimit)
/*----------------------------------*/
/* Insert other Rounding Rules here */
/*----------------------------------*/
endif; // Rounding Rule is Standard or 10pctLimit (or other)
endif; /* dose is number */
;;
evoke:
;;
logic:
if fatal_error then
error_message := "Unable to round dose because" || dose_error || route_error;
elseif minor_error then
error_message := "Warning: " || round_error;
endif;
/* Always conclude true to return a value */
conclude true;
;;
action:
return error_message, rounded_dose;
;;
end:

View File

@@ -0,0 +1,130 @@
maintenance:
title: Task Error Message;;
mlmname: SYS_TASK_ERROR;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: This MLM will evaluate the information in a virtual field of the OrderTask
object to determine if an alert should be written to the database.
Current alerts include:
- Error on calculating task stop date.
;;
explanation:
;;
keywords: task error message, stop date error
;;
knowledge:
type: data-driven;;
data:
/***************Make Changes To Spelling And Flags In This Section***************/
// Set to true if logging is needed.
log_execution_info := false;
// Change the message within first set of quotes for different alert review short-message.
task_alert:= destination { Alert: Reminder, "Order Stop Date Error", medium, chart,
"Task Error Message", 1005 };
// Change the spelling within the quotes to match the order item-catalog.
any_new_task:= event {OrderTaskEnter Any
OrderTask:
WHERE TaskAlertMessage is not NULL};
any_modified_task:= event {OrderTaskModify Batch
OrderTask:
WHERE TaskAlertMessage is not NULL};
any_rescheduled_task:= event {OrderTaskReschedule Batch
OrderTask:
WHERE TaskAlertMessage is not NULL};
/********************************************************************************/
/* Execute only when this MLM is called by the editor */
if called_by_editor then
task_obj:= read first
{OrderTask: This
WHERE OrderNameSummaryLine = "TaskMed 01 - scheduled 1 Q4H"
};
EvokingObject:= task_obj;
endif;
// Get the Client GUID
client_guid := read last {ClientInfo: GUID};
// Get information from the evoking OrderTask
(task_name,
task_guid,
task_order_name_summary_line,
task_start_dtm,
task_order,
task_order_guid,
task_catalog_item_task_guid,
task_schedule_type_code,
task_process_type,
task_state,
task_processing_in_progess,
task_is_current,
task_back_up_obj,
task_alert_message ) := read last
{OrderTask: TaskName, GUID, OrderNameSummaryLine, StartDtm, Order, OrderGUID,
CatalogItemTaskGUID, ScheduleTypeCode, ProcessType, TaskState, ProcessingInProgress,
IsCurrent, Backup , TaskAlertMessage
REFERENCING EvokingObject};
// Initialize text string
task_message_text := "";
if exist task_start_dtm then
start_dtm_formatted := task_start_dtm formatted with "%.4t";
else
start_dtm_formatted := "";
endif;
;;
evoke: any_new_task or any_modified_task or any_rescheduled_task;
;;
logic:
if exists task_alert_message then
task_message_text := "There is a problem calculating the stop date "
||"for the following order: "
||"\n {{+B}}{{+C}} " || task_order_name_summary_line
|| "{{-B}}{{-C}}"
|| "\n" || " started on " || start_dtm_formatted
|| "\n\n" || "The problem is: "
|| "\n" || task_alert_message;
conclude TRUE;
else
conclude FALSE;
endif;
;;
action:
write task_message_text at task_alert;
;;
end: