maintenance: title: Ordering Conditional Manditory field;; mlmname: FORM_LAB_GENERIC_MANDITORY;; arden: version 2;; version: 4.50;; institution: St Clair Isolation Set MLM;; author: Mary Sieger, Mary.Sieger@stclair.org, 412-942-1194;; specialist: Eclipsys Corporation;; date: 2006-10-09;; validation: testing;; library: purpose: Based on a value provided in one field, make another field manditory. ;; explanation: This generic MLM can be called from several Micro order forms: - LAB Ser Nsg Col_Ser1 - LAB_Micro_BodyFldCul - LAB_Micro_ExudateCul - LAB BBank Type & Scr - LAB_Micro_Blood Cul - LAB BBank Prod RBC - LAB BBank Prod PLT - LAB BBank Prod FFP - (others?) Rules: Use lists of forms, fields to test on the form, values to test for, fields to make manditory (if the value is present). change history 06.18.2008 DW Remove code to require an indication when Transfusion is selected from Surgery or Transfusion list 2/26/2015 STH CSR# 32765 - updated to call the user lab priority options MLM to display the user firendly lab priorities when approriate. 11.29.2017 DW CSR# 36079 - change "line draw" to "other" on the Blood Culture order form ;; keywords: Called MLMs, Form fields, generic, field test, manditory ;; knowledge: type: data-driven;; data: /***********************Make Changes To Spelling And Flags In This Section************************/ //NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHING LISTS!!! //MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM: //"FORM_NAME|FIELD_NAME_TO_TEST|VALUEs_TO_TEST_FOR|FIELD_TO_MAKE_MANDITORY" form_map_list := ("LAB Ser Nsg Col_Ser1|LAB_M_VO_OBR15_SpecType_Ser1|Skin (SKN),Tissue (TIS)|LAB_VO_FT_Ser_SkinInfo" ,"LAB_Micro_BodyFldCul|LAB_RC_SDES_MicroBodyFld|Body Fluid (FLD)|LAB_SREQ_VO_FT_MicroTypeIn" ,"Lab_Micro_BodyFldCul|Lab_RC_SDES_MicroBodyFld|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid" ,"LAB_Micro_ExudateCul|LAB_RC_SDES_MicroExCul|Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn" ,"LAB BBank Type & Scr|LAB_Yes or No|YES|BB_Date_ Proc Surgical Procedure" // DW 11.29.2017 36079 Changed "line draw" to "other" //,"LAB_Micro_Blood Cul|LAB_SREQ_VO_DI_Line_PeripDraw|Line Draw|LAB_SREQ_VO_FT_LineDrawDescrip" ,"LAB_Micro_Blood Cul|LAB_SREQ_VO_DI_Line_PeripDraw|Other|LAB_SREQ_VO_FT_LineDrawDescrip" ,"LAB BBank Prod RBC|BB Blood Prod Surg-Transfusion|Product for Surgery|LAB_VO_DI_BBProd Surgical Proc" // Removed per ED CPOE project 06.18.08 DW // ,"LAB BBank Prod RBC|BB Blood Prod Surg-Transfusion|Product for Transfusion|LAB_VO_DI_BBProd Trans Ind RC" ,"LAB BBank Prod PLT|BB Blood Prod Surg-Transfusion|Product for Surgery|LAB_VO_DI_BBProd Surgical Proc" // Removed per ED CPOE project 06.18.08 DW //,"LAB BBank Prod PLT|BB Blood Prod Surg-Transfusion|Product for Transfusion|LAB_VO_DI_BBProd Trans Ind Plt" ,"LAB BBank Prod FFP|BB Blood Prod Surg-Transfusion|Product for Surgery|LAB_VO_DI_BBProd Surgical Proc" // Removed per ED CPOE project 06.18.08 DW // ,"LAB BBank Prod FFP|BB Blood Prod Surg-Transfusion|Product for Transfusion|LAB_VO_DI_BBProd TransInd FFP_Cryo" ,"Lab_Micro_FungusSmea|Lab_RC_SDES_MicroSource_FungusSmear|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid" ,"Resp Vent Adult Vol|Resp Vent Flow By|TRUE|Resp Vent Base Flow" ,"Resp Vent Adult Vol|Resp Vent Flow By|TRUE|Resp Vent Flow Sensitivity" ,"DIET_Diet_All Option|RequestedTime|OVERDUE|DIET_Non Routine Trays" ,"LAB_Micro_GramStainO|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites" ,"LAB_Micro_GramStainO|LAB_Micro_CB_SpecimenNotInList|FALSE|LAB_RC_SDES_MicroSource_GramStainOnly" ,"LAB_Micro_GramStainO|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn" ,"LAB_Micro_GramStainO|LAB_RC_SDES_MicroSource_GramStainOnly|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript" ,"LAB_Micro_GramStainO|LAB_RC_SDES_MicroSource_GramStainOnly|Synovial Joint Fluid (SYN)|LAB_SREQ_VO_DI_SiteSynovialJointFluid" ,"Lab_Micro_AFBSmearOn|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites" ,"Lab_Micro_AFBSmearOn|LAB_Micro_CB_SpecimenNotInList|FALSE|Lab_RC_SDES_MicroSource_AFBSmearOnly" ,"Lab_Micro_AFBSmearOn|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn" ,"Lab_Micro_AFBSmearOn|Lab_RC_SDES_MicroSource_AFBSmearOnly|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript" ,"Lab_Micro_AFBSmearOn|Lab_RC_SDES_MicroSource_AFBSmearOnly|Synovial Joint Fluid (SYN)|LAB_SREQ_VO_DI_SiteSynovialJointFluid" ,"Lab_Micro_FungusCul|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites" ,"Lab_Micro_FungusCul|LAB_Micro_CB_SpecimenNotInList|FALSE|LAB_RC_SDES_MicroSource_FungusSmear" ,"Lab_Micro_FungusCul|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn" ,"Lab_Micro_FungusCul|LAB_RC_SDES_MicroSource_FungusSmear|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript" ,"Lab_Micro_FungusCul|Lab_RC_SDES_MicroSource_FungusSmear|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid" ,"LAB_Micro_TBCulture|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites" ,"LAB_Micro_TBCulture|LAB_Micro_CB_SpecimenNotInList|FALSE|Lab_RC_SDES_MicroSources_TBCul" ,"LAB_Micro_TBCulture|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn" //NOTE: for TB Cultures, Additional Information (LAB_SREQ_VO_DI_MicroDescript) is NEVER Manditory! per Mary //,"LAB_Micro_TBCulture|Lab_RC_SDES_MicroSources_TBCul|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript" ,"LAB_Micro_TBCulture|Lab_RC_SDES_MicroSources_TBCul|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid" ,"LAB_Micro_Legionella|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites" ,"LAB_Micro_Legionella|LAB_Micro_CB_SpecimenNotInList|FALSE|LAB_RC_SDES_MicroSource_LegionellaCul" ,"LAB_Micro_Legionella|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn" //,"LAB_Micro_Legionella|LAB_RC_SDES_MicroExBF_Sites|Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn" ,"LAB_Micro_Legionella|LAB_RC_SDES_MicroSource_LegionellaCul|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript" //NOTE: for Legionella Cultures, no Synovial Box, per Mary //,"LAB_Micro_Legionella|LAB_RC_SDES_MicroSource_LegionellaCul|Synovial Joint Fluid (SYN)|LAB_SREQ_VO_DI_SiteSynovialJointFluid" ,"YOUR_FORM_NAME_HERE|YOUR_TEST_FIELD_HERE|VALID_VAL1,VALID_VAL2|MANDITORY_FIELD_HERE" ); /**************************************************************************************JAB********/ // This MLM is passed three arguments, of types // communication_type, form_type and client info object respectively. (this_communication, // Communication object this_form, // Form object client_info_obj //Arden ClientInfo object ) := argument; //Initialize MLM pointers: str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; chk_overdue_time := MLM {{{SINGLE-QUOTE}}}overdue_req_time{{{SINGLE-QUOTE}}}; gen_dsply := mlm {{{SINGLE-QUOTE}}}FORM_GENERIC_Display{{{SINGLE-QUOTE}}}; // Display any realated fields first: (this_communication, this_form) := call gen_dsply with this_communication, this_form, client_info_obj; // Initialize error message error_message:=""; // Initialize lists test_form_name_list := (); test_field_list := (); test_manditory_field_list := (); // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; //*****BEGIN ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}}; DisplayNewScheduled := first of (field_list.Value where field_list.DataItemName = "LAB_CB_Alternate Priorities"); //*****END ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities CallingForm := this_form.name; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; if called_by_editor then CallingForm := "LAB Ser Nsg Col_Ser1"; CallingEvent := "FieldChange"; CallingField := "LAB_M_VO_OBR15_SpecType_Ser1"; endif; for i in 1 seqto count form_map_list do // initialize vars: manditory_field := null; trigger_field := null; // parse the form mapper: form_element_list := call str_parse with form_map_list[i], "|"; test_form_name := form_element_list[1]; //Lookup form name from map list // Test for proper form if CallingForm = test_form_name then test_manditory_field := form_element_list[4]; //Lookup manditory field from map list manditory_field := first of (field_list where field_list.DataItemName = test_manditory_field); // Set open form defaults if exists manditory_field then test_field := form_element_list[2]; //Lookup test field from map list trigger_field := first of (field_list where field_list.DataItemName = test_field); //check for {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} fields if manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then Right_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Right" ); Superficial_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Superficial" ); Left_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Left" ); Deep_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Deep" ); endif; // Test for proper field if exists trigger_field then //Lookup list of valid values for the test field test_val_list := call str_parse with form_element_list[3], ","; //Check for time field if trigger_field.dataitemname = "RequestedTime" and "overdue" is in test_val_list then if exists trigger_field.value.reqtimevalue then time_type := "scheduled"; time_val := trigger_field.value.reqtimevalue; else time_type := "coded"; time_val := trigger_field.value.reqtimecode; endif; // check for overdue time time_is_overdue := call chk_overdue_time with time_val, time_type; endif; if (trigger_field.value as string) is in test_val_list or time_is_overdue then // Mandate the field and, if necessary, make it visible manditory_field.control_visible := true; manditory_field.control_mandatory := True; manditory_field.control_read_only := False; // make {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} settings writable if manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then Right_box.control_visible := True; Right_box.control_read_only := False; Superficial_box.control_visible := True; Superficial_box.control_read_only := False; Left_box.control_visible := True; Left_box.control_read_only := False; Deep_box.control_visible := True; Deep_box.control_read_only := False; endif; // i := count form_map_list; else // manditory_field.control_visible := false; manditory_field.control_mandatory := False; if trigger_field.dataitemname <> "RequestedTime" then manditory_field.control_read_only := True; endif; manditory_field.value:=""; if manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then // set all {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} boxes to read-only Right_box.control_mandatory := False; Right_box.control_read_only := True; Right_box.value:=""; Superficial_box.control_mandatory := False; Superficial_box.control_read_only := True; Superficial_box.value:=""; Left_box.control_mandatory := False; Left_box.control_read_only := True; Left_box.value:=""; Deep_box.control_mandatory := False; Deep_box.control_read_only := True; Deep_box.value:=""; endif; // manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" endif; // (trigger_field.value as string) is in test_val_list /* // FOR DEBUGGING PURPOSES: display a message to the user this_communication.Message := "callingform = "|| callingform || "\nCallingEvent = " || CallingEvent || "\ntest_form_name = " || test_form_name || "\ntest_field = " || test_field || "\ntest_manditory_field = " || test_manditory_field || "\ntrigger_field.value.reqtimecode = " || trigger_field.value.reqtimecode || "\ntrigger_field.value.reqtimevalue = " || trigger_field.value.reqtimevalue || "\nmanditory_field = " || manditory_field.dataitemname || "\ntest_val_list = " || test_val_list || "\ncfg_end = " || cfg_end || "\ncurr_time = " || curr_time || x; this_communication.MessageType := "Informational"; */ endif; // exists trigger_field endif; // exists manditory_field endif; // CallingForm = test_form_name enddo; // for i in 1 seqto count form_map_list //****BEGIN***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked if (DisplayNewScheduled) then //Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}}; (this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj); endif; //****END***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked ;; evoke: // No evoke statement ;; logic: conclude true; ;; action: // This MLM returns two parameters, of types //communication_type and form_type respectively. return this_communication, this_form; ;; end: