Skip to main content

Adding and editing Risk rules

Updated over 2 months ago

Risk rules page overview

To view the risk rules page, click on Configuration in the left-hand menu, then select Risk → Risk Rules. The page will display a list of existing risk rules, or appear empty if no rules have been configured yet.

On the risk rules page, you can search for rules by name or details. You can also create new rules, or view and edit existing ones by clicking Edit next to the relevant rule.


Adding new risk rules

To add a new risk rule, click "Add new rule" at the top right.

Fill in the following fields and click Save:

  • Reason: the name of the risk rule. It will appear both on the risk rules page and in the risk assessment panel on the person’s page.

  • Weight: the multiplier that determines how important this rule is compared to others. This must be a positive number; decimal values are possible.

  • Details: add additional information to be shown in the person’s risk assessment panel. You can use the $param placeholder to dynamically display values from the query, for example: "Age calculated: $param".

  • Content: the SQL query that defines how the rule assigns a risk score. See an example below.

✏️ You can edit all of the above fields later from the rule's page.


Activating new risk rule

You can toggle the rule to Active before saving it, or save it as a Draft and activate it later.

To activate a draft version of a risk rule:

  1. Go to the rule’s page by clicking Edit

  2. Select the draft version you want to activate

  3. Click the three dots → Edit → Make version current

    1. Ensure that mandatory fields are filled

  4. The rule will become Active, and the selected version will be set as Current


Editing existing risk rules

To edit an existing rule, click Edit next to the rule on the Risk Rules page.

Editing the rule name

Click the edit icon next to the rule’s name to change it.

Editing the SQL query

To change the rule logic:

  • Click +New version to create a new version from scratch

  • Or duplicate an existing version by clicking three dots → Duplicate as Draft

The new version will be in Draft status. You can edit draft versions freely until you’re ready to make them Current.

💡Editing a rule that is already active:

  • Creating drafts of the rule does not affect the Current version; it continues to function as before.

  • After changing the Draft version to Current, it automatically starts using the new version.


Deactivating existing risk rules

To deactivate a rule, click the Deactivate button next to its status.

  • The rule’s status will change to Archived

  • Archived rules are no longer used in risk scoring

If needed, you can reactivate an archived rule by duplicating its last historic version as a draft, validating it, and making it Current again.


Example of a working risk rule

Example of a working Risk rule:

🔢 Risk rules are defined using SQL queries.

Here you can copy the content code

SELECT 
CASE
WHEN date_part('year', AGE(dob)) <=20
OR date_part('year', AGE(dob)) BETWEEN 61 AND 80 THEN 1
WHEN date_part('year', AGE(dob)) BETWEEN 81 AND 90 THEN 2
WHEN date_part('year', AGE(dob)) BETWEEN 91 AND 100 THEN 3
WHEN date_part('year', AGE(dob)) > 100 THEN 4
ELSE 0
END,
date_part('year', AGE(dob)) as age
FROM person WHERE id = $personId

❗️ Pay attention to the following:

  • The first field should always be a CASE statement that returns a risk level between 0 and 4 (0=low,1=low to medium, 2=medium, 3=medium to high, 4=high risk).

  • All other fields are optional but these can be used as dynamic parameters in the Details field.

Did this answer your question?