Ruleset Skill
Making Complex Decisions
In your Mattr workflows, a simple "if/else" condition can handle basic decisions (e.g., if loanAmount > 5000 ). But what if your decision logic is much more complex, with multiple nested conditions involving ANDs, ORs, and different data points?
The Ruleset Skill is your workflow's sophisticated decision-maker. It allows you to apply a predefined set of complex rules to your input data and make dynamic decisions based on the outcome. This is perfect for managing logic that is too complex for simple conditional transitions.
Automated Underwriting for Loan Applications
Imagine your workflow processes incoming loan applications. You need to automate the initial approval decision, but your criteria are complex: the decision depends on the applicant's credit score, income, debt-to-income ratio, and loan amount, with different tiers and nested conditions. For example, if (Credit Score > 700 AND Debt-to-Income < 35%) OR (Loan Amount < 5000 AND Years of Employment > 2) then Approve.
The Challenge:
Building this kind of complex, nested logic with simple conditional nodes can become messy, hard to read, and difficult to manage.
The Solution:
By using a Ruleset Skill, you can define all these complex rules in a single place. The Skill will take the applicant's data as input, evaluate it against all your rules, and then output a clear decision (e.g., Approved, Rejected, or ManualReview), which your workflow can then act on.
Setting Up the Ruleset Skill
Let's walk through how to set up this Skill for automated underwriting.
Locate the Skill: Drag and drop the Ruleset Skill onto your Workflow Builder canvas. Place it in your workflow after you have collected all the necessary applicant information.
Configure "Ruleset ID": This is the core of the Skill. You'll need to create your complex rules in a dedicated Ruleset Builder and then reference them here by their unique ID.
Click on the Ruleset Skill to open its configuration panel.
In the "Ruleset ID" field, select the ID of the ruleset that contains your underwriting logic.
Define "Mappings": This tells the Skill how to match the data from your workflow to the "facts" defined in your ruleset.
A ruleset might need a CreditScore fact, but your workflow has that data in a field called applicant.credit_score. Mappings bridge this gap.
In the "Mappings" section, you'll create a list of
sourcetotargetpairs.Source: The path to the data in your workflow (e.g., $input.applicant.credit_score).
Target: The name of the corresponding fact in your ruleset (e.g., Credit Score).
Understanding the Outcome
After the Ruleset Skill runs, it emits an event based on which rules were matched. This is how your workflow takes its next steps.
events : The output is a list of events. Each event contains an event name and a set of params.
Example: If the applicant's data met the criteria for an automated approval, the output might be:
JSON
If multiple rules are met (e.g., a "Pass" rule and a "Flag for Manual Review" rule), the events list will contain both outcomes.
statusCode : A number indicating the result (200 for success, 400 if no rules were matched or there was a mapping error).
By using the Ruleset Skill, you can centralize and manage complex business logic without writing code, and even empower business users to update the rules as needed!
Last updated