Intro to Clinical Rule Writing
Download
Report
Transcript Intro to Clinical Rule Writing
M.U.S.E. 2007
Tuesday Training
Intro to Clinical Rule Writing
Presented by:
Jason Medeiros
Rules Course Agenda
Overview
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
pt
pt
pt
pt
pt
pt
admit dr
admit dr mne
los
name
nok
oe wt kg
sex
30
10
3
30
30
6
1
Patient's admitting provider's name
Patient's admitting provider
Discharged patient's length of stay
Patient's name
Patient's next of kin
Patient's oe weight in kg
Patient's sex
Data Fields – Temporary data
Data may or may not be entered yet
lord col date
lord col day
rx ord type
rx order site
rx sig
ord ser dt
ord ser tm
8 Lab order collection date
3 Lab order collection day of wk
10 Rx's order type
10 Rx's order site
20 Rx's sig
8 Service date
4 Service time
Data Fields - Calculated
day of week
days old
lord lab test
lord lab today
lord get pt age
today
3
4
1
1
3
8
Current day of week
# Days before today()
Lab order lab test()
Lab test already ordered today()
Patient age
Today's date
Data Fields – Perform Action
rx msg
rx set billing code
rx set charge type
rx set rx comment
ord err msg
ord msg
ord reject
ord yes/no
60 Rx message()
60 Rx set billing procedure code to()
60 Rx set charge type to()
60 Rx set rx comment to()
60 Order error message()
60 Order message()
0 Order REJECT
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
Argument Required – Parentheses in
lookup
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
AGE
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:
1.
Assign a value to a variable
2.
Display a value on the screen
3.
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:
Operator Explanation
'
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
Relational Operators - Examples
Operation
Evaluation
5>2
True
“ABC”=“ABD”
False
3’>1
False
LOC=“3S”
?
“”=“”
Initially – True
Ultimately – False
Value
“”
When creating operations, you
should always be careful to not set
something = to nil. Even if the value
is nil, the final value of the operation
will become nil and will ultimately be
evaluated as false.
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
[f
[f
[f
pt facility]="A" [f lord use billcode]("A1234");
pt facility]="B" [f lord use billcode]("B1234");
pt facility]="C" [f lord use billcode]("C1234");
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]};
Prompt User
If user answers “Y”, then allow filing. If user answers
“N”, then do not allow filing.
Application Specifics - PHA
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
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
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 – Page 2
PHA- Page 3
PHA – Page 4
PHA Rule View
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
PHA – Global RX and Purge Rules
PHA- Print Profile routine
PHA- CALC Rules
Referenced by RX rule using [f rx calc]
PHA – BILL Rule
Charge Type
Dictionary
PHA - Important Data Fields
Field:
[f rx reject]
Description: Returns a nil value. This field is used to
return “” as a result of a condition specified in the
rule. User may NOT continue with the order.
*Seldom used.
PHA - Important Data Fields
Field:
[f rx set billing code]
Syntax:
[f rx set billing code](X)
Argument: X is the billing procedure code you intend
to set.
Description: Use this field to modify the billing code
for an Rx based on a condition. This billing code
must exist in B/AR database.
PHA - Important Data Fields
Field:
[f rx set charge type]
Syntax:
[f rx set charge type](X)
Argument: X is the charge type you would like to
default for this Rx.
Description: This field will set the charge type for this
Rx. The charge type must be valid in the Charge
Type Dictionary.
PHA - Important Data Fields
Field:
[f txn qry resp]
Syntax:
[f txn qry resp](X,Y)
Arguments: There are two arguments required for this
field. X is the value you are sending. Y is the MIS
query mnemonic you have setup to store the value
you are sending. This query is used on the B/AR side
and is attached to a CDS of type: BAR TXNS
Description: This field is used to send additional query
information to B/AR in an Rx rule evaluated at the
TXN level.
PHA - Important Data Fields
Field:
[refill rule msg]()
Syntax:
[refill rule msg](X)
Argument: X message to display on the Refill List
Description: Will print on the Refill List printout if the
rule fails and generates a message
PHA - Important Data Fields
Field:
[f rx last ver result]
Syntax:
[f rx last ver result](X)
Argument: X is the lab test mnemonic that you are
querying.
Description: Returns the last verified result stored in
LAB for this patient and test.
PHA - Important Data Fields
[f rx nth ver Res-COL](“PSA",1)
Returns result, collection date and collection time of
the most recent PSA TEST.
A argument: LAB TEST Mnemonic/print number
B argument: Which LAB result to retrieve. 1 is most
recent, 2 is next recent, 3 is third most recent
PHA - Important Data Fields
[f rx nth ver Res-RES](“PSA",1)
Returns result, result date and result time of the
most recent PSA TEST.
A argument: LAB TEST Mnemonic/print number
B argument: Which LAB result to retrieve. 1 is
most recent, 2 is next recent, 3 is third most recent
PHA - Important Data Fields
You can parse out the data from these keywords
Use String Extraction
Example:
TEST#"0,"^RES RESULT
TEST#"1,"^DATE DATE
TEST#"2,"^TIME TIME
PHA - Important Data Fields
Field:
[f pur do purge]
Syntax:
[f pur do purge]
Description: This field is used to return “” as a result
of a condition specified in the rule. Use this field to
purge the record.
PHA - Important Data Fields
Field:
[f pur do not purge]
Syntax:
[f pur do not purge]
Description: This field is used to return 1 as a result of
a condition specified in the rule. Use this field to
prevent the purge of the record.
PHA – Custom Keywords
Meditech allows PHA users to create your own
Custom Keywords. Use this feature to:
Access fields not available in lookup
Call custom NPR macros to:
Search pt profile for a Generic
Send a MOX message
Perform complex calculations
PHA – Custom Keywords
Custom Keywords in other Apps
The E/E Custom Keywords routine is
ONLY available in PHA
For OE/LAB/SCH, you may request
custom keywords from Meditech.
When doing so, BE SPECIFIC in your
request.
Application Specifics – LAB
Application Specifics - LAB Rule Types
BBUNIT# - Check format of BBK Unit numbers.
Assigned in the BBK Source/Destination Dictionary
BBASSN – BBK Assignment/Issue rules may allow or
disallow the assign/issue of blood units.
BCCHK – Check bar code formats
CHG – Add miscellaneous charges to certain tests
Application Specifics - LAB Rule Types
ORD – Order rules restrict ordering of LAB Tests
BSP/LSP/MSP/PSP – Control the selection of
specimens that use Selection Profiles
LBCAST – Control download of specs to analyzers
PQL – Customize Pathology Questionnaire Logic
Application Specifics - LAB Rule Types
PTID – Verify PT ID formats for external LABS
PURGE – Control purging of LAB records
REFLEX – Control reflex ordering of tests
SITE – Assign LAB Site to a requisition
VERIFY – Control results notification
POM Enabled?
POM Enabled? – Provide user options
Online help
LAB Rules – Where to Attach?
Test Dictionary – ORD/CHG/Site Rules
BBK Test/Product/Source/Destination
Dictionary – All BBK Rules
Micro- Procedure, Organism dictionary
LAB Rules – Where to Attach?
Order Group Dictionary – RFLX Rules
Pathology Questionnaire Dictionary – PQL
Rules
Analyzer Dictionary – LBCAST Rule
LIS Client Dictionary – PT ID Rule
New!
Attach multiple rules per TEST
LAB – Important data fields
Field:
[f lord lab test]
Syntax: [f lord lab test](X)
Argument: X is the LAB Test Mnemonic you are
checking for
Description: Returns a (Y)es if the Lab test has
been ordered during the same
requisitioning session.
LAB – Important data fields
Field:
[f lord lab today]
Syntax: [f lord lab today](X)
Argument: X is the LAB Test Mnemonic you are
checking for
Description: Returns a (Y)es if the Lab test has
been ordered today.
LAB – Important data fields
Field:
[f lsp last ver result]
Syntax: [f lsp last ver result](X)
Argument: X is the LAB Test Mnemonic you are
checking for
Description: Will return the last verified test result
for the test mnemonic in the argument.
LAB – Important data fields
Field:
[f lord gen info]
Syntax: [f lord gen info](X)
Argument: X is the Generic drug you are
checking for
Description: Returns the status of an RX that
contains the generic - AC/UNV/DC
You may also check for drug mnemonics using:
[lord drug info]
LAB – Important data fields
Field:
[f psp view rel find]
Syntax: [f psp view rel find]
Description: This field will display the Related
Findings screen in Pathology. This would typically be
used with a POST rule.
LAB – Important data fields
Field:
[f ppr set response]
Syntax: [f ppr set response](Mnemonic,Text)
Arguments: Mnemonic of the prompt you want to
set, TEXT to default into the prompt
Description: This field will set the response for
another prompt response within the questionnaire.
This field will typically be used with a POST rule.
Application Specifics - OE
Application Specifics - OE
Types of Rules
ORD – Evaluated when user FILES order
OUTPUT– Control printing of reqs
PTDATA – Evaluates entry of Patient Data in
E/E Administrative Data routine. *seldom
used
POM Enabled?
POM – Provide options to user
OE Rules – Where to attach?
ORD- Attached Page 1 Procedure
Dictionary.
OUTPUT – Attached Page 2 Procedure
Dictionary
PTDATA - Linked via a query attached in
the OE Parameters
Attach multiple rules
New!
OE– Important data fields
Field:
[f do not print]
Syntax: [f do not print]
Description: This data field will suppress the
printing of a requisition when used as the last
value of a rule.
OE– Important data fields
Field:
[f do print]
Syntax: [f do print]
Description: This data field will allow the
printing of a requisition when used as the last
value of a rule.
OE – Output Rules
Do Not print REQ if on a Weekend
Output Rule – Attach to Procedure
New!
Application Specifics – NUR
Generate Clinical Alerts when
Interventions are documented
Attached in Intervention Dictionary
NUR – Intervention dictionary
NUR Rule – Old school dictionary
MIS Notification Mnemonic, Level, Detail
NUR– Important data field
Field:
[f pt notification](ca,lev,det)
Syntax:
[f pt notification](“ALERT”,”Med”,MSG)
Description: This field generate an MIS Clinical
notification, as specified in the MIS
Notification dictionary.
Arguments:
“ALERT” – MIS Notification mnemonic
“Med” – Level
MSG – Detail to include on notification
For more information…..
Our I-Online Learning courses are a great way to present this
material to your entire staff simultaneously – for a fraction of
the cost of On-site training.
See our website for our Fall/Winter Course Schedule!
Iatric Systems
www.iatric.com
978 805 4100