Put Your Information to Work
In the world of application development, requirements are stored in a variety of ways. As somebody who helps InRule customers implement our technology, I’ve seen great documentation and…well…some that’s not so great. Regardless of the quality though, one trend that we see is people leveraging Microsoft Excel to store requirements. Why not, right? It’s portable and a great way to organize information in a meaningful and structured format.
But how do you take this wealth of static information and transform it into actual rules that can be used by your application?
In most cases, rule authors manually work through the spreadsheets to build those rules one-by-one. Unfortunately, this sometimes ends up being the most practical solution when you have variations in the requirements or in the desired rule output. However, if your spreadsheet data follows a fixed pattern and you are willing to write a bit of code using the InRule SDK, this information can be leveraged to automate the process of building rules. This approach not only saves time up-front when building rules, it also ensures consistency in the generated rules, as well as minimizing future rework.
Great! So how do you do it? Enter irAuthor Extensions!
Extensions in irAuthor
Simply put, an Extension is a .NET assembly that implements specific interfaces and leverages the rule authoring framework exposed by the InRule SDK. The concept is very similar to a plugin. And like a plugin, an Extension gives you the ability to customize the rule authoring experience to meet your specific rule authoring needs. Any of the following can be accomplished with an irAuthor Extension:
- Change the behavior of existing features
- Add new features or functionality
- Remove features you want to hide from your rule authors
In this example, our extension will add a new button to the irAuthor ribbon that will allow you to browse for a spreadsheet and import it as a Decision Table into your rule application.
Where Do I Start?
In this example, the Extension will import data from Excel spreadsheet to build a Decision Table in the rule application. The following spreadsheet has been used to determine if the established premium for the insurance policy in a given State or Province is sufficient. If it is not, the policy is invalid.
First, you need to determine which column(s) in the spreadsheet will be evaluated as conditions and which column(s) define the action(s) the rule should execute. This concept maps directly to the Decision Table construct, which is comprised of two parts, Conditions and Actions.
In this example, the first column in the spreadsheet holds the value for the State/Province. Each unique value that appears in that column should be created as an option in your State/Province condition. The screenshot below shows what that condition would look like in irAuthor: the condition has a recognizable name, maps to a field in the authoring model, and consists of all of the valid options the rule author can then select.
Once you’ve created your first condition, the remaining spreadsheet columns, Limit and Base Premium, can be handled in the same way.
Next, you need to add your Actions. While a Decision Table can support multiple Actions, in this example, there is only one called “Invalid”. The Actions are built in a very similar manner as the Conditions. The Action will simply mark the entire policy Invalid when the premium is too low.
The final step is to build the rows in the Decision Table using your Conditions and Actions. Each spreadsheet row will map to a row in the Decision Table. At execution time, when all of the Conditions in a row evaluate to true, the Action will execute. Once you have created all of the Decision rows, the Decision Table is complete and, as you can see below, it looks very similar to the spreadsheet, except that it can now be consumed by your application.
“Extending” An Offer
We touched on just one of the capabilities that you have at your disposal with the InRule SDK and irAuthor Extensions. Whether you want to add a new window into irAuthor to provide alternate ways to view your rules or replace existing functionality with some of your own, irAuthor Extensions allow you to customize your authoring experience to meet your needs.
I encourage you to download a free trial of our solution. In addition to the software, you also get access to the InRule Support site, which contains additional information on how to build an irAuthor Extension as well as working samples in our Extension Exchange library. Each sample contains an explanation of what the Extension does as well as the source code.
If you have any ideas for irAuthor Extensions that you would like to see added to the Exchange, please let us know by commenting on the post.