Example "LoanDynamics"

Describes a web application with dynamic interaction logic.

 

Dynamic Web Application "LoanDynamics"

Web-based GUI: Interaction Steps

Presentation Logic

Business Logic

Business Object Model

This web application supports dynamic business loan approval scenarios like this one: 
 
Events and Facts Loan Application Decision Comments
Peter Johnson applied for $50K loan Rejected Insufficient Income. But a loan officer noticed that they have a valuable client with the same address
Joe & Dawn Johnson agreed to be Peter's guarantors. They have a Housing Loan with Available Equity of $300K and Remaining Debt of $150K Accepted $100K surplus is a sound proposition. But conducting more detailed analysis, the officer noticed a joint borrowing on Mt. Johnson's file which is not with his wife
Joe Johnson and his partner Bill Smith (50/50) have a Business Loan for $200K with Available equity of $52K Accepted The remaining $26K surplus still meets requirements. But Bill and Susan Smith have other facilities outstanding against their property as well as the business loan
Bill & Susan Smith have a Housing Loan with Available Equity of $240K and Remaining Debt of $150K Accepted Still a surplus. But a lending clerk noticed a secured personal loan in the name of Tommy Smith for $50K secured by his parents
Their son Tommy Smith has $50K loan secured by his parents Rejected Accumulated remaining equity is less than the requested loan amount. The initial debt to Peter Johnson would be $8.8K short on cover

Web-based GUI: Interaction Steps

The following screens represent different interaction steps for the above scenario. They are created using OpenRules Web Forms.

 

Step 1. Entering Borrower Personal Data

After validating SSN correctness,  the button "Next" moves a dialog to the next interaction step.

Step 2. Entering Loan Request Information

This step validates the requested loan amount for min/max limits, and checks such conditions as "Loan term cannot be more than 36 months for amount < $5,000".

Step 3. Entering Related Facts (securities that may affect accept/reject decision)


Initially there could be no related facts/securities. By clicking "Add Security", you can add new rows to this table and enter the related information. Buttons "Del" allow to delete previously entered securities. Securities have a flag "Active" allowing to include or exclude them from the total loan evaluation process. The button "Next" executes the rule engine "validateIncomeWithEquities" that recalculates the total equity and total remaining debt using ALL related securities and then it makes an Accept/Decline decision.

Step 4. Displaying Rule Engine Results with Explanations

By clicking "Prev", a user can go back and make changes in the loan amount or related securities.

Implementation

Presentation Logic. Here is a list of four interaction steps and rules that should be executed before displaying the proper screens:

All screens (interaction steps) above are defined as Layout tables in Excel. Please note that before generating the Results view, we direct system to execute business rules presented in the rules table "validateIncomeWithEquities".  The interaction logic that specifies which processing steps should be executed upon which events is presented in the following rules table ("state machine"):

In particular, it defines that if a user clicks to the button "Next" on the last screen "Results", it would be taken to the first screen "BorrowerData". By clicking "Prev", a user always can go back to the "Securities" view to add/remove related securities.

Here are the screen layouts themselves that can be easily associated with their actual web views above.

Step 1

Here we are using a standard input validator "validateSSN" that will generate an error message if the entered SSN does not have a valid format.

Step 2

Here we are using two custom input validators:

1) "validateLoanAmount" that will generate an error message if the entered Loan Amount violates min/max limits

2) "validateLoanTerm" that will generate an error message if Loan Term is larger than 36 months while Loan Amount is less that $5,000. Here are Excel tables, in which we defined these validators:

 

Step 3

This layout can be dynamically changed: a user can add/delete rows in the table of securities. So, we will build this dynamic layout "on the fly" using the method  "securityTableContent":

This method takes a fixed layout "securityTableHeader"

and attaches (merges) to it all security rows known by that moment and saved in the object SecurityList. Each row is formed based on the following layout:

 

The buttons that allow a user to add or delete securities are defined in the following methods:

 

Step 4

All these layouts in different moments (defined by the processing flow rules above) play role of the current layout if the following generic layout:

And finally, the main of the LoanDynamics application that will be executed on every client-server interaction presented in this Excel table:

Business Logic. Business rules used in this application should evaluate borrower's income and debt with respect to all related securities. We will use simple formulas that calculate the total equity and total remaining debt to makes an Accept/Reject decision. The proper rules and formulas are presented in the following Excel tables:

Business Object Model. To represent a business object model for this application we use 4 simple Java classes:

Class Name

Class Properties and Methods

Borrower (Java bean) String fullName;
String SSN;
double monthlyIncome;
double monthlyDebt;
LoanApplication (Java bean) Borrower borrower;
double loanAmount;
int loanTerm;
String purpose;
String status;
String comments;
Security (Java bean) String id;
String type;
String securedBy;
double equity;
double debt;
boolean active
SecurityList
(inherited from java.util.ArrayList)
Maintains a list of securities.

public double calculateTotalEquity()
{
  double total = 0;
  for(int i=0; i<getLength(); i++)
  {
      if (getSecurity(i).isActive())
         total += getSecurity(i).getEquity();
  }
  return total;
}

public double calculateTotalDebt()
{
  double total = 0;
  for(int i=0; i<getLength(); i++)
  {
     if (getSecurity(i).isActive())
        total += getSecurity(i).getDebt();
  }
  return total;
}

 

The actual implementation is included in the standard OpenRules installation - see the example LoanDynamics - LoanDynamics.xls, LoanRules.xls, LoanForms.xls, LoanData.xls.

More examples of dynamic interaction scenarios are described here.

 

 

 

 

Welcome
Welcome
Business Rules Repository Decisions Top-Down Semantics In Concert Business Analyst Decisioning
Welcome
themed object
Business Rules - Time to Excel
Bookmark and Share