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,321 @@
maintenance:
title: Extraction of Dosage Range Criteria;;
mlmname: STD_FUNC_DOSAGE_CAT;;
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: Finds the appropriate dose-range criteria from the order{{{SINGLE-QUOTE}}}s item-catalog and
returns the information to the calling MLM.
;;
explanation: This MLM assists the STD_Dosage MLM with dose-range checking.
A large list of arguments is passed to this MLM, and they are used to find
all the appropriate dose-range criteria (AGE, BSA, or WEIGHT)
for the patient.
If the ORDERED-DOSE is being checking and the "PER WT OR M2" field has a
valid uom (kg,lb,oz,g,m2), then the upper and lower dose-ranges will be
(1) multiplied by the patient{{{SINGLE-QUOTE}}}s weight or BSA and
(2) rounded using the rules found in the SYS_round_dosage MLM,
if there is a valid route.
If the DOSE-PER is being checking and the "PER WT OR M2" field has a
valid uom (kg,lb,oz,g,m2), then the upper and lower dose-ranges will NOT be
multiplied or rounded.
The dose-ranges and other pertinent information are returned to the calling MLM.
See the STD_Dosage MLM for further information.
;;
keywords: single dose; average daily dose; total daily dose; dosage range
;;
knowledge:
type: data-driven;;
data:
// include common data structures
std_dosage_includes := MLM {{{SINGLE-QUOTE}}}std_func_dosage_includes{{{SINGLE-QUOTE}}};
include std_dosage_includes;
(
drug_name,
is_order,
catalog_item_obj,
drc_grouper_id,
multum_dnum,
multum_mmdc,
order_med_route,
order_med_route_id,
is_generic_route,
order_med_significant_date,
order_med_units,
order_med_uom_id,
single_order_calc_per_uom,
average_order_calc_per_uom,
total_order_calc_per_uom,
patient_birthday_info_on_order,
has_valid_birthdate,
wt_kg,
BSA_number_rounded,
intl_patient_gender,
core_uom_const,
alert_if_missing_flags,
patient_info
):= ARGUMENT;
// Set to true if logging is needed.
log_execution_info := false;
/* Declare the MLMs that can be called */
xml_params := MLM {{{SINGLE-QUOTE}}}STD_Func_Dosage_XML_Params{{{SINGLE-QUOTE}}};
// XML parameter
( input_param_xml,
missing_route,
unmapped_route,
missing_uom,
unmapped_uom
) := call xml_params with
(
// Common medication data
drc_grouper_id,
multum_dnum,
multum_mmdc,
order_med_route,
order_med_route_id,
is_generic_route,
order_med_significant_date,
order_med_units,
order_med_uom_id,
null, // multum_freq_id not needed
null, // med_order_type not needed
is_order,
// Patient data
patient_birthday_info_on_order,
has_valid_birthdate,
wt_kg,
BSA_number_rounded,
intl_patient_gender,
// Item Catalog only
true, //for_item_catalog
catalog_item_obj,
// Multum only
null, //has_liver_disease_bit,
null, //dialysis_type_str,
null, //serum_creatinine,
// Flags and constants
alert_if_missing_flags,
patient_info,
core_uom_const
);
debug_sql_str := "SCMGetItemCatDosageRangePr "
|| SQL(input_param_xml);
if exists drug_name
then
(match_found_list,
dose_type_list,
gender_codes,
facility_gender_codes,
criteria_type_names,
criteria_type_codes,
criteria_type_low_codes,
criteria_type_high_codes,
criteria_type_facility_uoms,
routes,
route_ids,
range_low_codes,
range_high_codes,
range_uoms,
range_uom_ids,
is_PER_WT_list,
is_PER_M2_list,
range_per_facility_uoms,
range_per_core_uoms,
uom_conversion_factor_list,
uom_conversion_issue_list,
route_conversion_issue_list,
cat_item_match_list,
estimated_age_used_list
) := read {"SCMGetItemCatDosageRangePr "
|| SQL(input_param_xml)
};
endif;
;;
evoke:
;;
logic:
/* Intializes variables */
dose_per_string:= "Dose Per";
dose_reg_string:= "Dose Reg";
found_criteria:= false;
item_cat_dosage_range_list := ();
if exists match_found_list
then
row_count := count match_found_list;
list_indices := 1 seqto row_count;
for ind in list_indices
do
// Put the dosage range values into the dosage range object
dosage_range_item := new Dosage_Range_Object;
item_cat_dosage_range_list := item_cat_dosage_range_list, dosage_range_item;
dosage_range_item.med_name := drug_name;
dosage_range_item.match_found := (match_found_list[ind] = true) or (match_found_list[ind]=1);
dosage_range_item.dosage_type := dose_type_list[ind];
dosage_range_item.is_range := true; // ItemCatalog is always a range value
dosage_range_item.lower_dose := range_low_codes[ind];
dosage_range_item.upper_dose := range_high_codes[ind];
dosage_range_item.is_PER_WT := is_PER_WT_list[ind];
dosage_range_item.is_PER_M2 := is_PER_M2_list[ind];
uom_conversion_factor := uom_conversion_factor_list[ind];
conversion_factor := uom_conversion_factor;
if (dosage_range_item.dosage_type = "single") then order_med_per_uom := single_order_calc_per_uom;
elseif (dosage_range_item.dosage_type = "average") then order_med_per_uom := average_order_calc_per_uom;
else order_med_per_uom := total_order_calc_per_uom;
endif;
per_units := range_per_core_uoms[ind];
if (order_med_per_uom = per_units) // dose per
then
dosage_range_item.dose_calc_method := dose_per_string;
corrected_uom := range_uoms[ind] || "/" || per_units;
else // dose reg
dosage_range_item.dose_calc_method := dose_reg_string;
if per_units is null
then
corrected_uom := range_uoms[ind];
dosage_range_item.unit_of_measure := range_uoms[ind];
else
corrected_uom := range_uoms[ind] || "/" || per_units;
dosage_range_item.unit_of_measure := range_uoms[ind] || "/" || per_units;
per_weight_list := (core_uom_const.kg_string, core_uom_const.gm_string, core_uom_const.lb_string, core_uom_const.ounce_string);
per_weight_conversion := (1000, 1, 453.6, 28.35);
if (per_units in per_weight_list)
then
dosage_range_item.is_PER_WT := true;
dosage_range_item.unit_of_measure := range_uoms[ind] || "/" || per_units;
if wt_kg is number and wt_kg > 0
then
wt_gm := wt_kg * 1000;
weight_conv_factor := (last (per_weight_conversion where per_units = per_weight_list));
per_weight := wt_gm / weight_conv_factor;
conversion_factor := conversion_factor / per_weight;
else
conversion_factor := -1 * abs(conversion_factor);
dosage_range_item.match_found := false;
endif;
elseif per_units = core_uom_const.M2_string
then
dosage_range_item.is_PER_M2 := true;
dosage_range_item.unit_of_measure := range_uoms[ind] || "/" || per_units;
if BSA_number_rounded is number
and BSA_number_rounded > 0
then
conversion_factor := conversion_factor / BSA_number_rounded;
else
conversion_factor := -1 * abs(conversion_factor);
dosage_range_item.match_found := false;
endif;
endif;
endif;
endif;
dosage_range_item.corrected_uom := corrected_uom;
dosage_range_item.calc_per_core_uom := per_units;
dosage_range_item.is_multum := false;
dosage_range_item.route := routes[ind];
dosage_range_item.route_id := route_ids[ind];
dosage_range_item.med_route := order_med_route;
dosage_range_item.med_route_id := order_med_route_id;
dosage_range_item.dnum_ic_match_found := cat_item_match_list[ind] not in (1, true);
dosage_range_item.estimated_age_used := estimated_age_used_list[ind];
route_conversion_issue := route_conversion_issue_list[ind] in (1, true);
if is_generic_route
then
dosage_range_item.unrecognized_route_conversion_issue := route_conversion_issue;
else
dosage_range_item.inapplicable_route_conversion_issue := route_conversion_issue;
endif;
dosage_range_item.uom_conversion_factor := uom_conversion_factor;
dosage_range_item.conversion_factor := conversion_factor;
dosage_range_item.uom_conversion_issue := uom_conversion_issue_list[ind] in (1, true);
criteria_type := criteria_type_codes[ind];
dosage_range_item.is_default := criteria_type = "age" and
(gender_codes[ind] in (null, "", "U"));
criteria_low_str := criteria_type_low_codes[ind];
criteria_high_str := criteria_type_high_codes[ind];
criteria_uom_str := criteria_type_facility_uoms[ind];
criteria_str := ">=" || criteria_low_str || " " || criteria_uom_str || " and " ||
"<" || criteria_high_str || " " || criteria_uom_str;
if criteria_type = "age"
then
dosage_range_item.age_criteria:= criteria_str;
elseif criteria_type = "bsa"
then
dosage_range_item.BSA_criteria:= criteria_str;
elseif criteria_type = "weight"
then
dosage_range_item.weight_criteria:= criteria_str;
endif;
case_id := criteria_str;
gender_criteria := facility_gender_codes[ind];
if facility_gender_codes[ind] not in (null, "", "U")
then
dosage_range_item.gender_criteria := gender_criteria;
case_id := case_id || gender_criteria;
endif;
dosage_range_item.case_id := case_id;
enddo;
uom_conversion_issue := any item_cat_dosage_range_list.uom_conversion_issue;
endif;
/* Always conclude true to return variables to calling MLM */
CONCLUDE TRUE;
;;
action:
return (item_cat_dosage_range_list, missing_route, unmapped_route, missing_uom, unmapped_uom, uom_conversion_issue);
;;
end: