Rule Evaluation With Iterative Rule Results

  • Updated

This document describes how to create rule evaluation requests with iterative rule results.

When evaluating rules with an incomplete or invalid set of attributes, the rule evaluation does its best to find a path to an action node. If this is not possible, then it produces an iterative result.

 

Incomplete request

The code below shows an example of an incomplete request.


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":"presentProspectClientEventCountry", "value":"CAN"},
        {"name":"presentFIEmployeeCountry", "value":"CAN"},
        {"name":"financialInstituteLicense", "value":"none"}
    ]
}

 

By creating an incomplete request, you get an interactive result.

 

Iterative result

Following the current example, evaluating the request above yields the following result.


{
    "priorityCountry": "CAN",
    "results": [
        {
        "resultId": "3cc80cc8-9ad9-4912-8fa8-55d81122c318",
        "country": "CAN",
        "generatedFor": "CAN",
        "results": [
            {
            "iterativeResult": {
                "path": [
                "0",
                "1",
                "2",
                "3",
                "4",
                "21",
                "22",
                "23",
                "24",
                "25",
                "26",
                "27",
                "28",
                "29"
                ],
                "property": "clientStatus",
                "type": "Text",
                "options": [
                {
                    "value": "prospect",
                    "operation": "=="
                },
                {
                    "value": "existingClient",
                    "operation": "=="
                }
                ]
            }
            }
        ],
        "aggregationResult": false,
        "ruleSelectionLogicApplied": "[[selectedFromRequestRegimesList]]",
        "ruleSets": [ ... ]
        }
    ]
    }

 

The iterative result contains information at $.results[0].results[0].iterativeResult.property about which regulatory property needs further specification.

You also get the possible options (values) for that property at $.results[0].results[0].iterativeResult.options.

Using this information, you can create a new attribute that you can then use in a subsequent rule evaluation with the previously defined attributes. For example, if you are interested in the prospect case {"name":"clientStatus", "value":"prospect"}.

 


...
"attributes": [
        {"name":"clientStatus", "value":"prospect"},
        {"name":"presentProspectClientEventCountry", "value":"CAN"},
        {"name":"presentFIEmployeeCountry", "value":"CAN"},
        {"name":"financialInstituteLicense", "value":"none"}
    ]

 

This evaluation / interactive result cycle repeats until you arrive at a result that contains actions.

 


{
    "priorityCountry": "CAN",
    "results": [
        {
        "resultId": "438ef171-5f34-4d58-9671-8f4efcf0e9f2",
        "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"
            }
        ],
        "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