A lightweight serverless rule engine that saves you tons of repeated development work

so that you can focus on your core priorities

Photo by Tim Gouw on Unsplash

It was a horrible Monday morning for Krish at work. He had just received an email from his product manager Ram, about a set of changes on the super-critical credit risk module Krish had released a month ago.

This was one module where had sweat blood on… A module so complex & involved with data based decisions… and the management team was directly involved & took more than two weeks to sign-off the logic.

The thought of modifying this logic once again made him cringe. Being a star performer at work, Krish hated repetitive work.

Later in the day, Krish met Ram over coffee….

Krish: Ram, why are the requirements changing again man?

Ram: The module is running fine in production, but the Chief Risk Officer found out that a few critical parameters were left out and also a few threshold values had to be modified based on real life cases.

Krish: So, basically, we are saying that the parameters keep changing once in a while?

Ram: Yes, the parameters can potentially change based on new credit products we launch & we may also add new parameters based on how well the model fares in reality.

Krish: But, you know the amount of pain we went through to roll this module out to production right?

Ram: I totally understand, but the product must cater to the business requirements and business requirements are never set in stone!

Krish: Yep… but .. whatever, let me think through a robust way to solve this problem. I hate to modify the code once again!

Ram: Yo man! That’s the spirit! Let’s circle back in a week to track the progress you made!

What would have Krish done in that one week? Does the above story resonate with you?

Decision making has always been at the heart of any business. In certain industries (such as Lending), some of the decisions made are so dynamic & at a flux that programming these decisions by hand is counter-productive.

Take the example of the decision of giving someone a loan. It primarily involves ascertaining two fundamental factors:

  • Ability to repay the loan.
  • Intent to repay the loan.

When you start assessing a borrower based on above, you typically get all facts required to make a decision (such as Bureau score, bank statements etc.) and you will pass these facts through a decision matrix to arrive at

  • A composite score on a scale that gives an indication of whether the borrower will repay the loan (intent)
  • A recommendation of how much loan should be given to the borrower. (ability)

The aforementioned decisions involve evaluation of multiple parameters. You simply cannot write a program to solve such complex scoring or decision problems:

  • The evaluations and/or scores will always change over a period of time to adjust to business needs
  • The rules will also change based on the nature of the business product.
Such dynamic decision making problems warrant a solution that abstracts the decision making into a framework, segregates data from the rules and provides a standard declarative way to model the decisions.

Krish ended up doing exactly that. He created a rule based framework that allows declarative modelling of business decisions, which then could be used for any business decision making.

Since Krish did not want others to experience pain like he did, he went one step ahead and deployed this as a serverless micro-service which other business units could consume with little-to-zero effort!

You can take a look at the framework at https://github.com/jeyabalajis/simple-serverless-rule-engine

Hope you found this post useful! if yes, please do clap :) and drop in your thoughts or comments!