960 likes | 1.4k Views
Iatric Systems M.U.S.E. 2006 International Tuesday Training Intro to Clinical Rule Writing. Presented by: Jason Medeiros Iatric Systems. Rules Course Agenda. Basic Rule Syntax Using Data fields, queries IF Statements Use of Local Variables How to apply rules in your application
E N D
Iatric SystemsM.U.S.E. 2006 InternationalTuesday TrainingIntro to Clinical Rule Writing Presented by: Jason Medeiros Iatric Systems
Rules Course Agenda • Basic Rule Syntax • Using Data fields, queries • IF Statements • Use of Local Variables • How to apply rules in your application • Different types of rules • Output • Where are rules attached? • Important data fields in each application
Functions of Clinical Rules Rules allow you to evaluate criteria and perform a response • Restrict ordering of medications/tests • Send notifications to staff via MOX • Calculate LAB values for RPh review • Change a field value • Generate notification of NUR intervention
Rule Syntax Basic Guidelines • All rules must end with a semi-colon • Every line within the Rule editor must end in a comma or semi-colon • Each line of programming code is limited to the visual space provided in the Rule editor. “This is my warning message to the Meditech user"^MSG, IF{[f pt sex]="M" [f rx msg](MSG); [f rx ok]};
Accessing/Utilizing Data Fields: • Data Fields reference Permanent and/or Temporary information. • Data fields may perform action or Calculations • Access: • Use the “get” key (F4 on PC) • Then “F” space and your lookup key • You may ‘seed the lookup’ to quickly find fields
Data Fields – Permanent data Always available in Rules • pt admit dr 30 Patient's admitting provider's name • pt admit dr mne 10 Patient's admitting provider • pt los 3 Discharged patient's length of stay • pt name 30 Patient's name • pt nok 30 Patient's next of kin • pt oe wt kg 6 Patient's oe weight in kg • pt sex 1 Patient's sex
Data Fields – Temporary data Data may or may not be entered yet • lord col date 8 Lab order collection date • lord col day 3 Lab order collection day of wk • rx ord type 10 Rx's order type • rx order site 10 Rx's order site • rx sig 20 Rx's sig • ord ser dt 8 Service date • ord ser tm 4 Service time
Data Fields - Calculated • day of week 3 Current day of week • days old 4 # Days before today() • lord lab test 1 Lab order lab test() • lord lab today 1 Lab test already ordered today() • lord get pt age 3 Patient age • today 8 Today's date
Data Fields – Perform Action • rx msg 60 Rx message() • rx set billing code 60 Rx set billing procedure code to() • rx set charge type 60 Rx set charge type to() • rx set rx comment 60 Rx set rx comment to() • ord err msg 60 Order error message() • ord msg 60 Order message() • ord reject 0 Order REJECT • ord yes/no 60 Order ask yes/no()
Using Query Values in Rules • You may pull Customer Defined Query values into Rules to be evaluated. • Access: • Use the “get” key (F4 on PC) • “Q” space and your lookup key • You may ‘seed the lookup’ to quickly find queries
Using Query Values in Rules - Issues • Queries may not have a value when the particular rule is running • If your value does not work as designed, try this trick: Example: [f rx msg](“Allergy1: “_[q OE.ALL1]); This syntax will display the value of OE.ALL1 in a yellow box. You will then be able to determine if the rule is getting the query value properly.
What is an Argument? • Definition:An argument is a value that is passed into the data field to be used by that data field. • An Argument may be: • Text message • Another Rule Mnemonic (CALC Rule) • Local Variable
Some data fields require an argument • If parentheses appears in the lookup for the data field then an argument is required • You will receive an ERROR message from the syntax checker if an argument is not utilized • If there is a comma in the lookup, then two arguments are required
What should my argument be? • There is no easy way to tell what the argument of a data field should be, although it is usually possible to discern this from the field name/description • Consult the Meditech L list • Other expert sources?
Local Variables • Used for the temporary storage of information during the processing of the rule • Used to: • Store information for future processing, such as calculated values • Store large strings into smaller names in order to conserve space in the Rule Text Editor • Your local variables are created and available only during the processing of the current rule
Local Variables – How to create Example: "This is my warning message to the Meditech User."^MSG, IF{[f pt sex]="M" [f rx msg](MSG); [f rx ok]}; • Use local variable MSG to store the message • Refer to MSG in the IF/THEN statement
Local Variables- Naming Conventions • Use Capital-Alpha-Numeric characters • Use at least 3 characters • Use short, descriptive, meaningful names Example: MSG CREAT NAME LNAME FNAME
Local Variables – what NOT to use • Meditech uses its own local variables while the screen is functioning. You should take care not to overwrite the following local variables in your code: • X ANS R S • A B C Can you think of others?
The Assignment Operator () • Shift-6 on your keyboard • Used to: • Assign a value to a variable • Display a value on the screen • Erase a value Example: “Please change inventory to MAIN”^MSG, We read this as “Message text goes to local variable MSG.”
Relational Operators • Used to compare values to determine a TRUE/FALSE relationship • MAGIC Relational Operators: OperatorExplanation ' Not = Equal to ‘= Not Equal to > Greater Than < Less Than ‘> Not Greater Than (less than or equal to) ‘< Not Less Than (greater than or equal to)
Relational Operators - Example "Please obtain parental consent.“^MSG, IF{[f pt cur age]<18 [f lord msg](MSG); [f lord ok]}; • Store the display text in MSG • Check pt current age and if less than 18, display the message to user
Relational Operators – Nil vs. Non-nil In Magic, each operation will maintain a value • If the evaluation is true, the value on the LEFT side becomes the value of the operation • 5>4 ……………TRUE ………..…..5 is the value • If the evaluation is false, nil becomes the value of the operation • 4>5 …………….FALSE ………… “” is the value
IF/THEN/ELSE Statements -Syntax IF/THEN: IF{condition response1;response2} Example: IF{[f pt sex]="M" [f rx yes/no](“Drug is male-specific. Order anyway?"); [f rx ok]}; • There is a space between the condition and response. The space represents the “THEN" portion of the IF/THEN statement. • The semi-colon represents the separation between the first condition/response pair. The semi-colon is the "ELSE" portion of the IF/THEN/ELSE statement.
Multiple Condition Statements IF{condition1 response1; condition2 response2; response3} • Each condition will be evaluated moving from left to right • If condition 1 is true, then response 1 will be performed and no other conditions will be evaluated. • If condition 1 is false, then condition 2 will be evaluated. If condition 2 is true, response 2 is performed. • If both conditions 1 and 2 are false, then response 3 is performed.
IF/THEN/ELSE Statements –Syntax (ctd) Example: IF{[f pt facility]="A" [f lord use billcode]("A1234"); [f pt facility]="B" [f lord use billcode]("B1234"); [f pt facility]="C" [f lord use billcode]("C1234"); [f lord ok]}; Note: Indentation of the conditions – proper formatting
Boolean Operators • Compare using AND and OR relationships. • For example: • Display a message if the patient is male AND older than 65. • Notify user to order test as STAT if the patient is in the location of ICU OR CCU.
Boolean Operators (ctd) Operator Boolean Equivalent ! OR & AND
Boolean Operators - Examples "Ask for date of LMP.“^MSG, IF{[f pt sex]="F"&([f pt cur age]>15) [f lord msg](MSG); [f lord ok]}; • If both conditions are TRUE, display message "Cannot order test.“^MSG, IF{[f pt sex]="M"!([f pt cur age]<10) [f lord msg)(MSG); [f lord ok]}; • If either condition is TRUE, display message Note: Parentheses used in the expression!
Application Specifics – Similarities OE/LAB/PHA share some common characteristics: • Data fields– In all apps, there are data fields which will perform a function such as display a message to a user: [f lord msg](“Please call LAB regarding this test!”)
Application Specifics – Similarities • Certain fields will allow the user to file or reject the order. • In general, a rule will allow filing if its FINAL VALUE is a non-nil value. If the final value is nil, the user is stopped. [f ord ok] – Order is ok, allow filing. [f ord reject] – Order is not ok, do not allow filing. [f rx err msg](“Patient is Male. You may not place this order.”) • Error message- Do not allow filing.
Application Specifics – Similarities • Prompt user to continue “Current time is after hours. Order anyway?”^MSG, IF{(0700>[f now])!(1500<[f now]) [f lord yes/no](MSG); [f lord ok]}; If user answers “Y”, then allow filing. If user answers “N”, then do not allow filing. Prompt User
Application Specifics - PHA Types of Rules • RX Rules • Calc Rules • Bill Rules • Purge Rules • Adj Rules – seldom used • DUE Rules – seldom used
PHA – RX Rules Evaluate at MED - When the medication is identified DOSE - When the dose is specified FILE - When the Rx is filed TXN - During the billing compile before Rx is sent to B/AR REFILL – When Refill List is run or Check Refill Rules routine is run STOP - When you enter a Stop Date and file the order
PHA- POM Enabled (ctd) • POM MED – Identify the MED in POM • POM DOSE- Enter a DOSE in POM • POM FILE – Enter a stop date for an order in POM
PHA RX Rules– Where to attach? • Global Rules – Attached in Customer Defined Parameters – Page 4 • Evaluated for ALL orders • Drug Specific Rules – Attached in the PHA Drug Dictionary – Page 4 • Evaluated only for this drug