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,127 @@
maintenance:
title: Trim Excess Decimals from Numbers;;
mlmname: STD_FUNC_DOSAGE_TRIM;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, Standard 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: Trims excess decimals from number(s) by rounding them to a specific
number of decimals, based on a template number.
;;
explanation: A list of numbers is rounded and trimmed to 1 decimal place more
than the template number with the most decimal places.
Example: the template number has 2 decimal places (e.g. 450.25),
then the list of numbers is rounded to 3 decimals (e.g. 20.333333, 50.7777777)
and becomes (20.333, 50.778).
;;
keywords: single dose; average daily dose; total daily dose; dosage range
;;
knowledge:
type: data-driven;;
data:
(template_numbers_list, // A list of numbers that is used as a template for trimming decimals
trim_numbers_list // One or more numbers that need to be trimmed.
) := ARGUMENT;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using namespace "System";
// Set to true if logging is needed.
log_execution_info := false;
;;
evoke:
;;
logic:
if template_numbers_list is number
then
template_numbers_list := , template_numbers_list;
endif;
if all (template_numbers_list is number)
and all (trim_numbers_list is number)
then
// Initalize Variables
rounded_trim_numbers_list := ();
max_decimals := 0;
for temp_num in template_numbers_list do
// Convert number to Characters and extract them into a list
initial_string := "" || temp_num;
// Check for Scientific Notation
// and convert to all digits
if initial_string matches pattern "%E%"
then
initial_string := temp_num formatted with "%f";
endif; // if "E"
net_string := initial_string as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
decimal_index := call net_string.IndexOf with (".");
if (decimal_index >= 0)
then
number_of_decimals := LENGTH initial_string - (decimal_index + 1);
else
number_of_decimals := 0;
endif;
if (number_of_decimals > max_decimals)
then
max_decimals := number_of_decimals;
longest_num := temp_num;
endif;
enddo;
// Adjust by one decimal
max_decimals := max_decimals + 1;
// Create the string template for format the number
// Template example: "%.3f"
string_template := "%." || max_decimals ||"f";
// Create a list of numbers with the required number of decimals
for temp_num in trim_numbers_list do
// Check that a number is being formatted.
// Otherwise formatting something that is not a number
// will throw an execution error.
// Return a NULL if we do not have a number.
if temp_num is number
then rounded_num := (temp_num formatted with string_template) AS NUMBER ;
else rounded_num := null;
endif;
rounded_trim_numbers_list := rounded_trim_numbers_list, rounded_num;
enddo; //for temp_num
endif; //if template_number is number
Conclude True;
;;
action:
Return rounded_trim_numbers_list;
;;
Urgency: 50;;
end: