Skip to content

How-to-config-Decision-Point

Decision Point is the connection point between application and Themis (risk) system. When application wants Themis to make a decision. It must provide a decision point name and all input variables needed.

How to add a new decision point?

Add a new section in risk-decision-points-config.json in risk-configuration repo, make a PR and wait the risk-configuration to be deployed.

Themis loads decision points from following place:

risk-configuration/{environment}/risk-decision-points-config.json

risk-decision-points-config.json example
{
  "decisionPoints": {
    "PSP_Transaction": {
      "id": 5,
      "features": [
        "userId.KycVerified.Days",
        "userId.PspDeniedTransactionCount.InLast1Hour"
      ],
      "actions": [
        "RiskBlockUserAction"
      ],
      "isActive": true,
      "referencedDecisionPoints": null
    },
    "Dev_DecisionPoint_NotInS3": {
      "id": 101,
      "isActive": true,
      "features": [
        "userId.KycVerified.Days",
        "userId.PspDeniedTransactionCount.InLast1Hour.DecisionPoint_NotInS3"
      ]
    }
  }
}

Where do I get id of a decision point?

You give whatever number you like. But it is better to avoid duplications.


How to declare features to be used in a decision point?

1. add the feature to risk-configuration/{env}risk-features-config.json
2. reference the feature in risk-configuration/{env}/risk-decision-points-config.json

In risk-decision-points-config.json, inside each decision point object, there is "features" property. It should be a list (array) of feature display names. As you may know, feature display name is just the text displayed in UI. The real feature name used by rule engine is defined in another file "risk-features-config.json" in the same repo.

risk-features-config.json example
{
  "features": {
    "userId.KycVerified.Days": {
      "featureName": "userId/KycSuccessfullyVerifiedEvent/*/timestamp/first/days_since/double",
      "description": ""
    },
    "userId.PspDeniedTransactionCount.InLast1Hour": {
      "featureName": "userId/PspFundingOrderCompletedEvent/last1h/amountFailed/count/int",
      "description": ""
    },
    "userId.PspDeniedTransactionCount.InLast1Hour.DecisionPoint_NotInS3": {
      "featureName": "userId/PspFundingOrderCompletedEvent/last1h/amountFailed/count/int",
      "description": ""
    }
  }
}

So, to add a new feature to the decision point. You add it into risk-features-config.json and then add it to the risk-decision-points-config.json under your decision point. It is suggested to search risk-features-config.json first to check if the feature has been defined already. It is not recommended but it is supported that you define the same feature again with a different display name.


How to rename a feature display name

Just make a good name from the beginning

But, if you want to rename it. Here is the steps
1. Prepare the old name and new name
1. Replace the old name with new name in risk-features-config.json
2. Replace the old name with new name in risk-decision-points.json


What is a good feature display name

When it is used, feature display name is a part of English like logical expression. So, the general rule is *Make it easy to be read in English sentence.

Here are some examples (I feel are good but it's definitely subjective):

feature display name description
user.KycVerified.Days Then you read something like this if user.KycVerified.Days is less than 14 then Deny
user.PspTransactionCount.InLast1Day It starts from aggregation point, the current user. Then the area (Psp) and variable (transaction count). And the velocity period as the last part
merchantId.IsBlocked It is a good name until you would like to know where to block/unblock a merchant
merchantId.IsInMerchantBlocklist A little better than previous one by putting list name MerchantBlocklist in the display name
countryCodeAlpha2.IsInCountryCodeBlocklist Here we put alpha2 in the name. So, it is clear that we put SE in CountryCodeBlocklist to block Sweden. Neither SWE nor 752 will work