Create Rules to Evaluate Conditions Using the Rule Editor
Once you have created a rule in the configuration application, you can access the InterSystems® Healthcare Action Engine Rule Editor to define conditional evaluation logic for the rule.
To access the Healthcare Action Engine Rule Editor for a specific rule:
-
Select Rules.
-
On the row for your desired rule, select the “open In Rule Editor” icon from the Actions column. This opens the Rule Editor for that rule.
Edit Rule Logic Elements
You create rule logic by adding rule elements that relate to one another.
The manner in which you select an element changes the context in which you can edit the element:
-
You can single-click an element to:
-
Add a nested element.
-
Delete the element, along with any nested elements.
-
-
For certain elements (such as the expression element illustrated above), you can double-click to edit the element itself.
Add Rule Logic Elements
When you open a new rule in the Rule Editor, it will contain a single rule element in the canvas. Depending on which element has been selected in the canvas, your options for adding nested elements varies.
Rule
This section explains the rule element, which is a subset of a Healthcare Action Engine “rule” that is the equivalent of a CDS Hooks “service.”
A rule element contains conditional logic. When you create a new rule in the configuration application, it will contain a single rule element in the Rule Editor canvas. You can add nested rule elements that are executed as the result of specific conditions.
Assign
An Assign element assigns a value to a variable. Once created, you can reference this variable throughout your rule in an expression element.
You can assign the following types of values to a variable name:
Expression
There are three ways to create an expression:
-
Using an existing Assign variable.
-
Using a variable associated with the trigger. This would contain data being passed as an argument to the rule via the trigger.
-
Building a FHIR query. You can search for (and perform basic operations on) data elements present in the HL7® FHIR® patient record.
If you choose to construct a new FHIR query, you will be presented with a series of steps that assist you in building your FHIR query.
Comment
A comment is text for the reader or editor of a rule. A comment does not affect the rule evaluation logic.
Condition
A condition is the primary element for creating logic within a rule element. In its most basic form, it contains an if clause with an expression element.
To add multiple conditional clauses (which appear as else if), select the element tag of the rule and click +condition again.
To add an else clause, select the element tag of the rule and click +else
AND
You can use an AND operator to combine expressions within a condition, so that the condition is “true” if and only if all expressions are true.
OR
You can use an OR operator to combine expressions within a condition, so that the condition is “true” if and only if one or more expressions are true.
Return
A return element references a card or a system actions array for output. If the prior conditions have been met for this return action to be executed, the rule evaluation is complete and the specified card or system actions array is returned to the client application. A return element returns either a single card, a single system actions list. If no card is specified, the return element still terminates the evaluation process.
After creating a new card or system actions array in the HAE configuration application, you can specify it as the response object for a return element by performing the following steps:
-
Within the Rule Editor, double-click the return element to access the Select a Card to Return modal dialog.
-
Use the Choose a Response Object Type toggle switch to select the object type you want to return (Card or System Actions).
-
From the table, choose the response object to return by selecting the button. Select the button to preview the response object.
-
Select OK.
Build a FHIR Query
One of the types of expressions you can assign to a variable is a FHIR query. This allows you to incorporate data from FHIR resources in your rule logic evaluation.
To build a FHIR query to reference in an expression:
-
Select Rules.
-
On the row of your desired rule, find the Actions column and select the icon. This opens the Rule Editor for that rule.
Note:If you are unsure of which icon accesses the Rule Editor, hover over each icon until you see text that reads “Open In Rule Editor.”
-
Select a blank area of the rule canvas to ensure you are in the proper context, and select + assign.
-
Double-click the new assign element.
-
In the Create a Variable modal dialog:
-
Specify a Variable Name.
-
Select Expression as the Value for this variable.
-
Select the Next button.
-
-
On the next page, select the option to Build a FHIR query.
-
Follow the instructions which appear to build an expression based on a FHIR resource from your data source. The options presented to you in the query builder are determined by the FHIR package you specified while creating your rule. After you select a resource, you can select profile elements to build a query based on one of the supported profiles for the resource, with some of the search parameter values preconfigured. For example, the unit code for the value of a cholesterol Observation resource is preconfigured as mmol/L. Alternatively, you can define a query parameter manually.