The DMCommunity Challenge July-2022 “Team Performance” gives BR&DM vendors a good opportunity to demonstrate how to handle nested loops. I will describe how it can be done with OpenRules Decision Manager.
Here are the challenge requirements:
This problem deals with a tournament that includes several teams which players had shown different efficiencies during multiple games. It is quite natural to represent these concepts in the following glossary:
To calculate performance of each team, we need to iterate over all teams and for each team we need to evaluate performance of its players. It requires nested loops which can be implemented in OpenRules as follows:
Hopefully, this representation is self-explanatory and you don’t have to read further. However, below I will provide all details how to test, deploy, and execute this model locally and remotely.
We may define test data using tables “DecisionData” below. All players can be defined in this table:
Then we may describe teams:
And finally the tournament can be described as:
With a click on “test.bat” we execute this decision model locally and receive the following results:
With a click on “deployLambda.bat” we deploy this model as AWS Lambda function with the following Invoke URL:
We can run this AWS Lambda remotely using POSTMAN:
Here we used the automatically generate JSON test as a request:
And here is the produced response:
Our readers may run the same AWS Lambda from their own machines by using POSTMAN with these URL and JSON request. The entire project “TeamPerformance” is included in the standard OpenRules workspace freely available for downloads from here.