Anatomy of a rule
A rule consists of a trigger, optional conditions on event attributes, and one or more actions. The engine offers nine trigger types: a change of permit status, an alarm, no movement, SOS, an external event, a schedule, a change of equipment location, a worker's presence and a change of report status.
The actions are e-mail, push, a team notification, a webhook and opening a permit from a template. Each of them has a different cost in terms of the recipient's attention: a push interrupts work, an e-mail waits in the inbox, a webhook goes into a system. Matching the action to the urgency of the event is the first rule against flooding.
Rules for choosing the trigger and the conditions
Choose the narrowest trigger that describes the need. A rule about a change of permit status is better than a rule about every event in a module, if you only care about approval.
Narrow it down with conditions. The rule wizard in the panel works with icon tiles in two steps: choosing the trigger, then the filters. Several filters are combined with AND, so every added filter reduces the number of matches. Fields that point to system objects have selectors instead of identifier numbers, which lowers the risk of a configuration mistake.
Conditions checked at the moment of matching
Some condition attributes are checked at the moment of matching, not read from the event. For example, whether a person is online right now comes from the current key in Redis. A rule with such a condition gives a result that depends on the moment of execution, not on the content of the event, and such a test is worth running twice: with the person active and with the person inactive.
Elements of the rules engine
Rules for choosing actions and recipients
Match the channel to the urgency. SOS and no-movement alerts deserve a push and a team notification; a change of report status is usually enough as an e-mail or a channel entry. If one rule triggers several actions, each of them should have a separate recipient, not the same team three times.
Avoid rules that trigger each other. An action that opens a permit from a template changes the permit status, and that status may be the trigger of another rule. The chain has to be drawn on paper before it goes into production.
A failed automation does not stop the work
Matching a rule sends a message for asynchronous processing, and the rules subscriber never raises an exception. A failure of automation therefore does not block the approval of a permit or a change of report status. This is the right design for OHS, but it has a consequence: a rule error is silent. It has to be detected through tests and periodic review, not by waiting for a signal from the system.
Good practice: once a quarter, run every rule with test data and check that the effect reaches the recipient. A rule that stays silent may be either correct or broken, and only a test can tell the difference.
How to introduce rules in waves
Start with one rule of high value, for example team notifications for SOS. After a week, assess whether the recipients read it. Only then add the next ones. Too many rules at once make it impossible to tell which of them is producing the noise.
Every rule should have a description of its purpose and an owner. After half a year nobody remembers why a rule exists, and without that knowledge it cannot be safely switched off.
Checklist
Video
Frequently asked questions
Will a rule failure block the approval of a permit?
No. The rules subscriber never raises an exception, so an automation failure does not block the approval of a permit or a change of report status.
How do I combine several conditions in one rule?
Several filters are combined with AND, so the rule fires only when all of them are met.
How does a rule know whether a person is online?
This attribute is checked at the moment of matching, based on the current state, and is not read from the event.
Rules that people actually read
We will help you choose triggers, conditions and actions so that the number of notifications matches what your team can handle.
Let's talk