Initial Checking with all 820 MLMs
This commit is contained in:
266
MLMStripper/bin/Debug/SYS/SYS_CALC_EST_CRCL.mlm
Normal file
266
MLMStripper/bin/Debug/SYS/SYS_CALC_EST_CRCL.mlm
Normal 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:
|
||||
Reference in New Issue
Block a user