Skip to main content

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:

  1. Go to the configuration application.

  2. Select Rules.

  3. On the row for your desired rule, select the Open “open In Rule Editor” icon from the Actions column. This opens the Rule Editor for that rule.

Rule Editor — Basic Actions

At the top of the page, you can see the name of the rule as well as the following buttons:

  • New — Create a new rule.

    Important:

    In this version of the Healthcare Action Engine, it is recommended that you do not select New.

  • Open — Open an existing rule to edit.

  • Save — Save any changes you have made to the rule.

    Note:

    Saving does not compile your rule. If you have made changes to your rule but are not ready to compile, you should use this option.

  • Compile — Save and compile any changes you have made to the rule.

Below this you can see the toolbar, with the following global operations:

Icon Action
Undo change
Undo your last change.
Redo change
Redo the last change that you undid.
Zoom in
Zoom into the Rule Editor canvas.
Zoom out
Zoom out of the Rule Editor canvas.
Expand All
Expand all elements.
Collapse All
Collapse all elements.

When a given action is not supported for the selected item, the corresponding icon is grayed out.

Below the toolbar is the rule editor canvas, your workspace for creating rule evaluation logic. Your logic consists of elements, such as conditions, assign actions, and return actions.

Edit Rule Logic Elements

You create rule logic by adding rule elements that relate to one another.

Example ‘If’ Element
An example expression element with a numerical expression
Example ‘Expression’ Element
An example expression element with a numerical expression

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

Note:

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

Note:

When creating expressions, it can be useful to add shortcuts for unit codes and unit systems.

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:

  1. Within the Rule Editor, double-click the return element to access the Select a Card to Return modal dialog.

  2. Use the Choose a Response Object Type toggle switch to select the object type you want to return (Card or System Actions).

  3. From the table, choose the response object to return by selecting the Select Response Objectbutton. Select the Preview Response Objectbutton to preview the response object.

  4. 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:

  1. Go to the configuration application.

  2. Select Rules.

  3. On the row of your desired rule, find the Actions column and select the Open 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.”

  4. Select a blank area of the rule canvas to ensure you are in the proper context, and select + assign.

  5. Double-click the new assign element.

  6. In the Create a Variable modal dialog:

    1. Specify a Variable Name.

    2. Select Expression as the Value for this variable.

    3. Select the Round button with right arrow signifying next Next button.

  7. On the next page, select the option to Build a FHIR query.

  8. 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.

FeedbackOpens in a new tab