Looking for best practice recommendations around the versioning of a rule. Our application will have 50-60 rule sets comprised of up to 70 rules each. The activation of many of the rules will be based on a processing date (inserted fact attribute).
The application processing date can be prior, equal, or after the system date.
For example, 2 rules, with slightly different logic
Eligibility rule version 1
//to be potentially activated for application processing time period prior to 2011
When
Car(color = “blue”)
Then
Terms(eligible = “yes”)
Eligibility rule version 2
//to be potentially activated for application processing time period 2011 and forward
When
Car(color = “blue”, type=”coupe”)
Then
Terms(eligible = “yes”)
We’ve come up with a couple of different ways to handle this:
- Add Date logic to LHS of the rule . i.e add “Control(processingDate < ‘01/01/2011’)” to 1st rule and “Control(processingDate >= ‘01/01/2011’)” to 2nd rule. First rule would activate
with processing date = 12/31/2010 and 2nd rule would activate with processing date = 07/31/2011. When originally authored, first rule would be written without date logic. When 2nd
rule is authored, data logic will need to get added to both.
- We explored a way of setting the session clock to the processing date and using the ‘date-effective’ and ‘date-expires’ attributes to do the filtering. i.e. 1st rule is effective until
12/31/2010 and 2nd rule is effective from 01/01/2011 to 12/31/9999. However, we could only figure out how to do this with a stateful knowledge session. Is it possible in a Stateless?
- We added metadata to the rules (@EffectiveDate and @ExpirationDate), and using agendafilter, we compared processing date to the metadata and return true or false dependent on comparison.
What are your opinions on these three methods? What are other options?
Thanks
Rob