Rule Evaluation With Alternative Values

  • Updated

This document describes how to create rule evaluation requests using alternative values.

As an example, consider that you want to evaluate Financial Services / Custody and Payment Services, and you are interested in the prospect and existingClient client statuses.

You need to encode the clientStatus attribute with a multi-value (a pipe separated list of alternative values):


  {"name":"clientStatus", "value":"*(prospect|existingClient)"},

If you want to produce results for all the alternative values, you must wrap the value list with an asterisk and parenthesis: *(…).
If you miss the asterisk or the parenthesis, you get only the result for the first alternative that arrives at an action node.
For example: *(prospect|existingClient).

 

Complete request

The code below shows how the complete request looks like.


    POST /api/v3/rules/eval HTTP/1.1
    Content-Type: application/json
    Apikey: ...
    Authorization: Bearer ...
    Host: rule-engine.apiax.io
    Content-Length: 542
    
    {
      "products": [
        {
          "productId": "Custody and Payment Services",
          "familyId": "Financial Services"
        }
      ],
      "regimes": [
        "CAN"
      ],
      "versionFilter": "latest",
      "attributes": [
        {"name":"marketingOrigination", "value":"proActiveMarketing"},
        {"name":"serviceCategory", "value":"creditCard"},
        {"name":"clientStatus", "value":"*(prospect|existingClient)"},
        {"name":"presentProspectClientEventCountry", "value":"CAN"},
        {"name":"presentFIEmployeeCountry", "value":"CAN"},
        {"name":"financialInstituteLicense", "value":"none"}
      ]
    }

 

The response contains a result structure for each alternative path. Paths pertain to a result. You can be found them at $.results[0].results[*].path.


    // Result for clientStatus == prospect will be at
    $.results[0].results[?(@.path.clientStatus.value=="prospect")] 
    
    // Result for clientStatus == existingClient will be at
    $.results[0].results[?(@.path.clientStatus.value=="existingClient")]

 

Complete response

The code below shows the complete response for the current request.


    {
      "priorityCountry": "CAN",
      "results": [
        {
          "resultId": "56df8724-f40f-4ea8-8b62-4a2238c80bef",
          "country": "CAN",
          "generatedFor": "CAN",
          "results": [
            {
              "actions": [
                {
                  "id": "cd9ac9c9-7a46-45c9-827e-aa2bc0050655",
                  "title": "[[activitiesCustody]]",
                  "message": ".",
                  "type": "CustomAction",
                  "specificInfo": {
                    "properties": [
                      {
                        "title": "provideServiceCustody",
                        "description": "[[provideServiceCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": ""
                      },
                      {
                        "title": "negotiateTermsCustody",
                        "description": "[[negotiateTermsCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": "[[remarkNegotiateConditionsProspects:definition]]"
                      },
                      {
                        "title": "explainExecutionCustody",
                        "description": "[[explainExecutionCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": "[[remarkSecuritiesDealing:definition]]"
                      },
                      {
                        "title": "receiveExecutionCustody",
                        "description": "[[receiveExecutionCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": "[[remarkSecuritiesDealing:definition]]"
                      }
                    ]
                  },
                  "originRuleSetId": [
                    "5ff48d38a36d165b16283705"
                  ]
                }
              ],
              "path": {
                "presentProspectClientEventCountry": {
                  "value": "CAN",
                  "operation": "=="
                },
                "financialInstituteLicense": {
                  "value": "none",
                  "operation": "=="
                },
                "clientStatus": {
                  "value": "prospect",
                  "operation": "=="
                },
                "presentFIEmployeeCountry": {
                  "value": "CAN",
                  "operation": "=="
                },
                "serviceCategory": {
                  "value": "creditCard",
                  "operation": "=="
                },
                "marketingOrigination": {
                  "value": "proActiveMarketing",
                  "operation": "=="
                }
              },
              "nodeId": "71"
            },
            {
              "actions": [
                {
                  "id": "8d4359e3-bdd3-4138-939b-04d168c66e75",
                  "title": "[[activitiesCustody]]",
                  "message": ".",
                  "type": "CustomAction",
                  "specificInfo": {
                    "properties": [
                      {
                        "title": "provideServiceCustody",
                        "description": "[[provideServiceCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": ""
                      },
                      {
                        "title": "negotiateTermsCustody",
                        "description": "[[negotiateTermsCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": ""
                      },
                      {
                        "title": "explainExecutionCustody",
                        "description": "[[explainExecutionCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": "[[remarkSecuritiesDealing:definition]]"
                      },
                      {
                        "title": "receiveExecutionCustody",
                        "description": "[[receiveExecutionCustody:definition]]",
                        "type": "Boolean",
                        "value": "no",
                        "reason": "[[remarkSecuritiesDealing:definition]]"
                      }
                    ]
                  },
                  "originRuleSetId": [
                    "5ff48d38a36d165b16283705"
                  ]
                }
              ],
              "path": {
                "presentProspectClientEventCountry": {
                  "value": "CAN",
                  "operation": "=="
                },
                "financialInstituteLicense": {
                  "value": "none",
                  "operation": "=="
                },
                "clientStatus": {
                  "value": "existingClient",
                  "operation": "=="
                },
                "presentFIEmployeeCountry": {
                  "value": "CAN",
                  "operation": "=="
                },
                "serviceCategory": {
                  "value": "creditCard",
                  "operation": "=="
                },
                "marketingOrigination": {
                  "value": "proActiveMarketing",
                  "operation": "=="
                }
              },
              "nodeId": "130"
            }
          ],
          "aggregationResult": false,
          "ruleSelectionLogicApplied": "[[selectedFromRequestRegimesList]]",
          "ruleSets": [
            {
              "id": "5ff48d38a36d165b16283705",
              "productFamilyId": "Financial Services",
              "productId": "Custody and Payment Services",
              "productFamily": "[[financialServicesRuleSetFamily]]",
              "product": "[[apiaxCustodyAndPaymentServices]]",
              "version": "22.2",
              "country": "CAN",
              "contentProviderId": "5acf2f957b13a61fa4304c96",
              "rulesetActivationState": "PROD",
              "countryOverviewId": "5ff3220b38f73116e3db4a33"
            }
          ]
        }
      ]
    }

 

Related documents

Refer to the following documents for additional information and details about Rule Evaluation.

 

 

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.

Still have questions?

Please submit a request and we will get back to you shortly.

Submit a request