What is the Rule resolution process in Pega?
What are the inputs for the Rule resolution process?
- Rule key - Apply to class, Rule name, and Rule type. Ex: Section CL: TP-Training-Work ID: PHTemplate
- User's Ruleset stack(list)
- Class inheritance of the current rule's applies to class.
- Circumstance (Property and Date).
- Rule availability
- User's access roles and privileges
How the rule resolution process works?
Rule instances are found in the Rules cache
- Find rule in the rules cache
- Find the best instance and check for duplicates
- Confirm the rule is available for use (Availability is not set to Block).
- Verify the user is authorized to use the rule
Rule instances are not found in the Rules cache
Populating rules cache
- Choose all instances with the correct purpose.
- Discard rules where Availability = Not Available
- Discard inapplicable rulesets and versions.
- Discard all candidates not defined in a class in the ancestor tree.
- Rank remaining rule candidates.
1. Rule instances are found in the Rules cache
- Find rule in the rules cache
- Find the best instance and check for duplicates
- Confirm the rule is available for use (Availability is not set to Block).
- Verify the user is authorized to use the rule
1.Find the rule in the rules cache.
2. Find the best instance and check for duplicates.
3. Confirm the rule is available for use.
4.Verify the user is authorized to use the rule.
2. Rule instances are not found in the Rules cache.
- Choose all instances with the correct purpose.
- Discard rules where Availability = Not Available
- Discard inapplicable rulesets and versions.
- Discard all candidates not defined in a class in the ancestor tree.
- Rank remaining rule candidates.
1. Choose all instances with the correct purpose.
S.No |
Apply to class |
Rule type |
Rule name |
Availability |
Ruleset |
Version |
Qualifier |
1 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Not Available |
ServiceRequest |
02-02-01 |
|
2 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-02-01 |
|
3 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Withdrawn |
ServiceRequest |
02-01-10 |
|
4 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
5 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
6 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Blocked |
ServiceRequest |
01-01-01 |
|
7 |
TP-Training-Work-Complaints |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
8 |
TP-Training-Work-Complaints |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
01-01-01 |
|
9 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Not Available |
ServiceRequest |
02-01-01 |
|
10 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
11 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Circumstance) |
12 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Date) |
13 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
14 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
01-01-01 |
|
15 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
03-01-01 |
|
16 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
02-10-01 |
|
17 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
02-10-01 |
|
18 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
02-01-01 |
|
19 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
01-01-01 |
|
20 |
PH-Online-Work-OneHelp |
Rule-HTML-Section |
AllocateBudget |
Available |
OneHelp |
01-01-06 |
|
21 |
PH-Online-Work- OneHelp |
Rule-HTML-Section |
AllocateBudget |
Not Available |
OneHelp |
02-01-05 |
|
22 |
PH-Online-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
OneHelp |
01-01-01 |
|
23 |
PH |
Rule-HTML-Section |
AllocateBudget |
Available |
PH |
01-01-01 |
|
2. Discard rules where Availability = Not Available
S.No |
Apply to class |
Rule type |
Rule name |
Availability |
Ruleset |
Version |
Qualifier |
1 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-02-01 |
|
2 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Withdrawn |
ServiceRequest |
02-01-10 |
|
3 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
4 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
5 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Blocked |
ServiceRequest |
01-01-01 |
|
6 |
TP-Training-Work-Complaints |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
7 |
TP-Training-Work-Complaints |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
01-01-01 |
|
8 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
9 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Circumstance) |
10 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Date) |
11 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
12 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
01-01-01 |
|
13 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
03-01-01 |
|
14 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
02-10-01 |
|
15 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
02-10-01 |
|
16 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
02-01-01 |
|
17 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
01-01-01 |
|
18 |
PH-Online-Work-OneHelp |
Rule-HTML-Section |
AllocateBudget |
Available |
OneHelp |
01-01-06 |
|
19 |
PH-Online-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
OneHelp |
01-01-01 |
|
20 |
PH |
Rule-HTML-Section |
AllocateBudget |
Available |
PH |
01-01-01 |
|
3. Discard inapplicable rulesets and versions.
- Each rule in the lit must belong to a ruleset in the operator's ruleset list.
- Each rule's ruleset Major version must have the same as the operator's ruleset Major version.
- Each rule's Minor version less than or equal to the specified Minor version number listed in the operator's ruleset list.
- Rulesets that are not there in the Operator's ruleset stack will be eliminated. In this example, OneHelp and PH rulesets are not listed in the operator's ruleset list.
1 | TP-Training-Work-ServiceRequest | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-02-01 |
|
5 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Blocked |
ServiceRequest |
01-01-01 |
|
7 | TP-Training-Work-Complaints | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 01-01-01 |
|
12 | TP | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 01-01-01 |
|
14 | TP | Rule-HTML-Section | AllocateBudget | Available | TP | 02-10-01 |
|
15 | TP | Rule-HTML-Section | AllocateBudget | Available | TP | 02-10-01 |
|
16 | TP | Rule-HTML-Section | AllocateBudget | Available | TP | 02-01-01 |
|
17 | TP | Rule-HTML-Section | AllocateBudget | Available | TP | 01-01-01 |
|
18 | PH-Online-Work-OneHelp | Rule-HTML-Section | AllocateBudget | Available | OneHelp | 01-01-06 |
|
19 | PH-Online-Work | Rule-HTML-Section | AllocateBudget | Available | OneHelp | 01-01-01 |
|
20 | PH | Rule-HTML-Section | AllocateBudget | Available | PH | 01-01-01 |
|
After eliminating the above 11 rules which are not satisfied with the conditions we have 9 rules on the list.
S.No | Apply to class | Rule type | Rule name | Availability | Ruleset | Version | Qualifier |
1 | TP-Training-Work-ServiceRequest | Rule-HTML-Section | AllocateBudget | Withdrawn | ServiceRequest | 02-01-10 |
|
2 | TP-Training-Work-ServiceRequest | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-05 |
|
3 | TP-Training-Work-ServiceRequest | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-01 |
|
4 | TP-Training-Work-Complaints | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-01 |
|
5 | TP-Training-Work | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-05 |
|
6 | TP-Training-Work | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-05 | Yes (Circumstance) |
7 | TP-Training-Work | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-05 | Yes (Date) |
8 | TP-Training-Work | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-01 |
|
9 | TP | Rule-HTML-Section | AllocateBudget | Available | TP | 03-01-01 |
|
4. Discard all candidates not defined in a class in the ancestor tree.
In this step, the algorithm uses the Ancestor tree which is nothing but Rule's inheritance. The algorithm examines rules (Here the rule is Section -AllocateBudget) Apply To class (TP-Training-Work-ServiceRequest) to determine if the rules from the above list are there in the inheritance hierarchy of the referenced rule (section in this case).
From the above list of 9 rules, the algorithm identified 1 rule which is not there in the inheritance path.
Below rules Apply to class is not there in the ancestor tree of the referenced rule.
4 | TP-Training-Work-Complaints | Rule-HTML-Section | AllocateBudget | Available | ServiceRequest | 02-01-01 |
|
after removing the disqualified rule we have 8 rules in the list as shown below.
S.No |
Apply to class |
Rule type |
Rule name |
Availability |
Ruleset |
Version |
Qualifier |
1 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Withdrawn |
ServiceRequest |
02-01-10 |
|
2 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
3 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
4 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
5 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Circumstance) |
6 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Date) |
7 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
8 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
03-01-01 |
|
5. Rank remaining rule candidates.
A.Sort the remaining rule candidates.
- Class
- Ruleset
- Circumstance
- Circumstance Date
- Data/time Range
- Version
Class - If the Apply to a class of the rule from the remaining list is closer to the referenced rule's apply to class then it will be ranked higher.
Ruleset - Within each class, rules are sorted according to the operator's ruleset stack.
Circumstance, Circumstance Date, and Date/time range - are used as qualifiers to further refine the rules.
Version - Lastly rules are sorted with the ruleset versions to ensure circumstanced rules are not overridden if the base rule is updated recently.
After considering the above criteria, the algorithm sorts the remaining rules as shown below. Row number 4 from the above list will come after row number 5.
S.No |
Apply to class |
Rule type |
Rule name |
Availability |
Ruleset |
Version |
Qualifier |
1 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Withdrawn |
ServiceRequest |
02-01-10 |
|
2 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
3 |
TP-Training-Work-ServiceRequest |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
4 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Circumstance) |
5 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Date) |
6 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
7 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
8 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
03-01-01 |
|
B. Remove rule candidates with an Availability set to Withdrawn
Once we have the sorting order, the algorithm removes the rules where availability is withdrawn.
If the rule availability is "Withdrawn" indicates that the Withdrawn version and below (lower) versions of the same rule (same rule type, name, and class) will not be selected during the rule resolution process.
From the above list, rule (row number 1) in 02-01-10 is Withdrawn, so the current version and lower versions of the same type, name, and class will be removed. In this example row numbers, 1,2, and 3 are removed from the list.
S.No |
Apply to class |
Rule type |
Rule name |
Availability |
Ruleset |
Version |
Qualifier |
1 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Circumstance) |
2 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Date) |
3 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
4 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-01 |
|
5 |
TP |
Rule-HTML-Section |
AllocateBudget |
Available |
TP |
03-01-01 |
|
C. Determine default rule candidate.
In this last step of the ranking process, the algorithm determines the default rule.
The default rule is the first rule from the list without any qualifiers (any circumstances). After identifying the default rule, the algorithm removes the rules below the Default rule from the list.
In this example, Row number 3 which is there in ServiceRequest:02-01-05 is the default rule and row numbers 4 and 5 will be removed from the list.
S.No |
Apply to class |
Rule type |
Rule name |
Availability |
Ruleset |
Version |
Qualifier |
1 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Circumstance) |
2 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
Yes (Date) |
3 |
TP-Training-Work |
Rule-HTML-Section |
AllocateBudget |
Available |
ServiceRequest |
02-01-05 |
|
6. Set the rules cache
After the Ranking process has been done, the algorithm sets the remaining rules into the rules cache. In this scenario, finally, we have 3 rules in the rules cache.
Algorithm successfully Populated rules cache, now algorithm uses below steps to finalize the rule, select and execute from the rules cache (already explained above as part of Rule instances are found in the Rules cache).
- Find rule in the rules cache
- Find the best instance and check for duplicates
- Confirm the rule is available for use (Availability is not set to Block).
- Verify the user is authorized to use the rule
Happy Learning 😃 Share with others. Sharing is Learning 😄
This comment has been removed by the author.
ReplyDeleteGlad..it helped you. Hope you will like other posts as well. Share with others.
DeleteThanks for the detailed explanation. Kudos to your team for the great effort.
ReplyDeleteThank you.
DeleteThanks a lot for such a clear explanations
ReplyDeleteThank you so much for sharing valuable knowledge
ReplyDelete