xLAB Reflex Tools
xLab provides an extensive feature rich Script language designed to enable the user to create Reflex Rules for virtually any logic and equation required. The ultimate goal of the Reflex Tools it to cause one or more tests to by reflexively Orders or Removed..
Any number of Reflex Rules may be defined. Each Rule is treated separatly at:
- Order Entry
- EMR Orders in
- xPortal Orders in
- Worklist Validation
The Reflex Rule Script consists of three parts,
Conditional,
Then,
Action:
- The Conditional - A Conditional statement os one that is made up of valid Functions and Operators that ultimately returns a 'True' or 'False'.
- The Then operator - The Key Word 'Then' which separates the Condition from the Action
- Action - in the case of Relex Rules the Tests you wish to have orders or deleted if the Condition is true.
Conditional:
The conditional consists of Funtions and Operators that ultimatly resolve to either a True or False.
Then:
This is simply a Key Word separator used by xLab to separate the Conditional from the Action. It is always the word Then without quotes
Action:
The action is the what you want to happen, either Order a Test or Delete a Test, Multiple tests can be ordered or deleted. NOTE: If a Test has validated results, even if you set the Test as Deleted, it will not be removed from xLab.
Examples:
Let's do a few examples to tie this all together;
Example 1 Assume you wish to Auto Request a Test NRScreen If a CONFIRM is requested and a Screen is not requested.:
We start by clicking on "Create New Rule" and giving our Rule a name. Then we enter the "Script" for our New Rule. (see below)
Note: All xLab Scripts support Comment lines that are ignored so that you can comment your script for others to understand your intent.
Then we simply enter the
- Condition
- In this case the Contition is: if the CONFIRM is orders and the Screen is not ordered, then the Condition evaluates to True, otherwise the Condition evaluates to false.
- Then - the Key Word Then
- Action
- In this case the Action is to Order a NRScreen test
You Must Validate the Rule before you can save it to verify Syntax.
In this case the Rule (Script) was valid and would result with an Action of Ordering the NRScreen. Click on Save and your new Rule is saved!
Example 2 Reflexively order a Test based upon values of results and patient attributes
Simply stated, if the result of a BUN is > 8.4 and the result of a GLU is < 100 and if the patient sex is Male, then order Test 'Testa';
Result('BUN') > 8.4 and Result('GLU') < 100 and Sex()='M'
then
Order('Testa')
The xLab Scripting language is comprised of 'Functions', 'Operators', 'Keywords' and 'Conditionals'.. The tables below summarizes all of these items
Functions:
| Function | Description |
|---|---|
| Result('Code') | Returns the result value of the specified result 'Code' |
| Rflag('Code') | Returns the result reference range flag for the specified result 'Code' |
| Dflag('Code') | Returns the Delta Flaf for the specified Result 'Code' |
| DOB() | Returns Patient's Date Of Birth |
| Age('Units') | Returns the patient's age in the specified units ('H' = Hours, 'D' = days, 'M' = months, 'Y' = years) |
| Sex() | Returns the patient's sex (M,F,U) |
| Height('Units') | Returns the patients height in the specified units ('IN' inches, 'CM' centimeters) |
| Weight('Units') | Returns the patients weight in the specified units ('LBS' = pounds, 'KG' - Kilograms) |
| OrdDoc() | Returns the Sample Ordering Doctor Code |
| OrdLoc() | Returns the Sample Ordering Location Code |
| Fasting() | returns True if patient is fasting, else False |
| Sqrt(value) | Returns the Square Root of the value |
| Log10(value) | Returns the base 10 log of the value |
| Exp(value) | Returns e raised to the power of value |
| Log(value,base) | Returns the log of value in the specified base |
| Pow(value,power) | Returns value raised to power |
| Round(value,digits) | Rounds value to digits |
| IsOrdered('Code') | Returns a True of the Test Code is Ordered, else returns false |
| Order('Code') | Casues the Test Code to be ordered |
| Delete('Code') | Casues the Test Code to be deleted |
Operators:
| Operator | Meaning |
|---|---|
| =, == | Equals |
| !=, <> | Not Equal |
| < | Less Than |
| > | Greater Than |
| <= | Less than or Equal |
| >= | Greater Than or Equal |
| &&, and | And |
| ||, or | OR |
| ( | Left hand Parenthesizes (in the algebraic sense) |
| ) | Right Hand Parenthesis (in the algebraic sense) |
Arithmetic Operators listed in order of precedence:
| Operator | Description |
|---|---|
| () | Grouping operator |
| !, not | Logical negation |
| *,/ | Multiplicative operators |
| +,- | Additive operators |
| <,>,<=, >= | Relational operators |
| =,==,!=,<> | Equality operators |
| &&, and | Logical AND |
| ||,or | Logical OR |
Keywords: There are several Keywords used by the script language to help make writing the script easier;
| Keyword | Description |
|---|---|
| JRSF | Right Justify, space fill |
| JRZF | Right Justify zero fill |
| JR | Right Justify |
| LBS | Pounds |
| KG | Kilograms |
| IN | Inches |
| CM | Centimeters |