Complex Decision Making using DMN in Oracle Process Cloud Service

In a previous blog post, I wrote about the new Decision Modeling capability introduced in Oracle Process Cloud Service. The blog provided an introduction to DMN and a usage scenario along with a working prototype.

The decision modeling and notation standard released by OMG is a very powerful framework providing an implementation and modeling specification for solving many complex operational and strategic decision in an organization. In this second blog post of the series, I will put the DMN engine in Oracle PCS through a litmus test by implementing a complex decision modeling use case.

To make matters more interesting, I have now selected a decision modelling scenario published as an open challenge in the Decision Management Community in February. The solution shared in this post has been accepted and validated by the community moderator.

The modeling approach shared in this blog is based on the principle of “Inherent Simplicity” which says that every situation, no matter how complex it initially looks, is exceedingly simple. I chose this use case as it shows how principles of decision modeling can allow us to break a layered problem into simpler and easy to implement fragments.

At the end of the post, I will also provide a link to where you can download the sample application. Buckle up, read on and enjoy!

The decision modeling and notation standard released by OMG is a very powerful framework providing an implementation and modeling specification for solving many complex operational and strategic decision in an organization.

Problem Statement

The problem statement was shared on the Decision Management Community website in February 2017 and an abstract of it is presented here:

Your decision model should determine potential fraud during an online product booking process. It’s based on an automatically calculated Fraud Rating Score that should be less than 200 to allow automatic booking. Fraud Rating Score depends on the following factors:

  • If Booked Product Type is POST-PAID-HOTEL add 5 to the score
  • If Booked Product Type is INTERNAL-FLIGHT add 100 to the score
  • If Booked Product Type is INTERNATIONAL-FLIGHT add 25 to the score
  • If Booked Product Type is CAR add 10 to the score
  • If Booked Product Type is PRE-PAID-HOTEL add 5 to the score
  • If there were no previous orders from this customer add 100 to the score
  • If Number of Orders from this customer between 1 and 10 including bounds add (100 – Number of Orders * 10) to the score
  • If Customer has previous disputes add 190 to the score

Solution

Decision Requirements Diagram

The problem statement can be broken down into different decision elements each producing outcomes which can roll up to provide the final interpretation. Since we are leveraging Decision Modeling and Notation to solve this, the complete solution is presented in form of both a decision model diagram and a decision logic representation. 

To evaluate the overall scenario as part of this use case, the overall decision model is broken down into decisions and sub decisions as shown below:

Determine Booking Fraud DRG

The decision requirements diagram shows how the desired outcome can be achieved by combining modular sub decisions explained here:

  • Determine Booking Fraud is the top level decision that asserts a Boolean flag of true|false as a final interpretation of the sub decisions. The flag is based on the Compute Fraud Score  decision value (true for fraud score greater than 200 and false for fraud score less than 200 )
  • Check Active Disputes is a sub decision that iterates over all Dispute elements of a booking request and if any dispute is valid asserts a constant fraud score (190 in this case)
  • Check Past Orders is a sub decision that iterates over all Order elements of a booking request and if there are any past orders,  asserts a calculated fraud  score (100 – Number of Orders * 10)
  • Calculate Product Type Fraud Score is a sub decision that loops through all Products in a booking request and based on the product type, assigns a fraud score. It also rolls up a sum of all assigned fraud score for each product type.
  • The Compute Fraud Score sub decision invokes the above sub decisions and sums up the evaluated fraud score from each.

Input Data Definition

In order to implement the decision logic for this scenario, we would need to create a root level Booking request input data type. The data structure for the decision model is depicted below:

InputData

  • A Booking can have one or more Products. Each product has a unique productId. A product element also has a sub-element representing the productType.
  • A Booking can have one or more Orders. Each order has a unique orderId. The bookingState sub element represents if it is a current order or a completed one.
  • A Booking can have one or more Disputes. Each dispute has a unique disputetId. The disputeState sub element represents if it is a confirmed or an active dispute. Active disputes are currently under investigation.

Decision Logic Level

As I stated in my previous blog, decision requirements diagram do not convey how the decision is implemented. This is done through decision logic elements. The overall decision model is broken down into individual decisions that are modular with the top level decision determine if the booking is a fraudulent one or not. The sub decisions uses different types of boxed expression to compute a fraud score for every scenario covered in the use case.

I started the solution implementation in Oracle PCS by creating a new Decision Model application. Then added input data elements based on the structure of the Booking element described earlier.

Booking Type

The final implemented decision logic was aligned to the decision requirement diagram. Here is a teaser of the final decision model showing the input data elements and the individual decision logic elements.

Overall Decision Model PCS

The top level decision and each of the underlying decisions is explained in more details in the following section:

Decision 1 – Check Active Disputes

Create a decision in the decision model editor using the configuration option provided here.

Decision Type Sub Decision
Boxed Expression Type If-then-Else
Decision Input Type Booking.Disputes[] (List)
Decision Output Type Dispute Fraud Score (Integer)
Question Does the booking request has any fraud score based on an unresolved disputes?
Allowed Answers 190,0

Check Active Disputes

The expression simply checks through an If-Then-Else construct if the count of Dispute elements in the Booking request is greater than 0. If a dispute is found (positive number count), then the decision assigns a fraud score of 190 else the fraud score is 0.

Decision 2 – Check Past Disputes

Create a decision in the decision model editor using the configuration option provided here.

Decision Type Sub Decision
Boxed Expression Type If-then-Else
Decision Input Type Booking.Orders[] (List)
Decision Output Type Dispute Fraud Score (Integer)
Question Does the booking request has a fraud score based on an any past orders?
Allowed Answers 0-100

Check Past Orders

The conditional expression checks if the count of Order elements in the Booking request is greater than 0. If a previous orders are found (positive number count), then it uses the number of order to determine the fraud score using the below formula.

100 – Number of Orders * 10

The higher the number of previous orders, the lesser is the fraud score. For example, if a booking has 9 previous orders, then the fraud score would be 10 as opposed to a fraud score of 90 if a booking has 1 past order.

Decision 3 – Calculate Product Fraud Score

Create a decision in the decision model editor using the configuration option provided here.

Decision Type Sub Decision
Boxed Expression Type Function with a Decision Table
Decision Input Type Product Type (String)
Decision Output Type Dispute Fraud Score (integer)
Question What is the fraud score for a particular product type?
Allowed Answers 0,5,25,100,10,5

This is a tricky sub decision to implement. There can be multiple products within a booking request and a fraud score has to assigned based on the product type for each product.

The sub decision is implemented as a function (a boxed expression that creates a parameterized logic to apply multiple times with different parameter values). The function accepts productType as an input and evaluates the fraud score based on a unique hit policy decision table.

Calculate Product Type Fraud Score

Needless to say, this function has to be invoked from another sub decision by passing the appropriate parameter value.

Decision 4 – Loop Through Products

Create a decision in the decision model editor using the configuration option provided here.

Decision Type Sub Decision
Boxed Expression Type Friendly Enough Expression Language (FEEL)
Decision Input Type Booking.Products[] (List)
Decision Output Type Fraud Score List (integer)
Question
Allowed Answers

The sub decision is implemented as a friendly enough expression language (FEEL) to loop over the Products in a booking and return a list of fraud score for each product type. This sub decision invokes the parameterized Calculate Product Fraud Score by passing the product type for each product in the loop.

Loop Over Products

Decision 5 – Compute Fraud Score

Create a decision in the decision model editor using the configuration option provided here.

Decision Type Sub Decision
Boxed Expression Type Friendly Enough Expression Language (FEEL)
Decision Input Type Booking
Decision Output Type Overall Fraud Score (integer)

This sub decision is again implemented as a friendly enough expression language (FEEL) to sum all the product scores determined by the previous decisions. It uses a summation function to calculate the sum of all product type fraud score retrieved from the Loop through Product decision and adds the result of the Check Past Orders and Check Active Disputes decisions.

Compute Fraud Score

Decision 6 – Determine Booking Fraud

Create a decision in the decision model editor using the configuration option provided here.

Decision Type Sub Decision
Boxed Expression Type If-then-Else
Decision Input Type Computed Fraud Score (integer)
Decision Output Type Booking Fraud Interpretation (boolean)
Question Does the computed fraud score confirm it is a fraudulent booking?
Answers True, False

The conditional expression checks if the value of the computed fraud score is greater than or less than 200. If it is greater than or equal to 200, then it asserts true otherwise false.

Determine Booking Fraud

This completes the implementation of the decision logic.

Creating a Decision Service

A decision model can expose multiple decision services which in turn are comprised of a combination of decision functions. I created a single decision service with an operation determineBookingFraud by associating the top level decision Determine Booking Fraud to it. After the decision model is deployed to the infrastructure, the decision service is available as a REST endpoint.

Services

Testing the Final Decision Model

The following section shows how the overall solution is unit tested. It also shows how the decision model is exposed as a decision service rest operation which can accept a JSON type request and assert an outcome. But before that, there is another powerful feature in Oracle PCS which allows design time unit testing the decision mode, that I want to talk about.

Unit Testing – Testing for Fraud

Request

Click on the blue arrow icon icon on your decision model to access the unit testing console. This will open a dialog that allows entering input data based on the defined data type. Let us say that for a fraudulent booking scenario, we enter the following data elements:

Rule Test Input

Response through Sub Decision Chains

When the decision model is executed, all the sub-decisions would execute too. The result for each of the decision functions for the above request through the decision functions would be:

Check Active Disputes 190
Check Past Orders 90
Calculate Product Fraud Score 5,100
Loop Through Products
Compute Fraud Score 385
Determine Booking Fraud true

Rule Test Output

Decision Service Testing

The decision model can also be deployed as a service which can be invoked as a REST POST operation (determineBookingFraud) from any external application or process.

Scenario 1 – Non Fraud Scenario

Request
 {
 "Booking": {
 "bookingId": "123213213",
 "product":
 [
 {
 "productId": "13213213",
 "category": "POST_PAID_HOTEL"
 },
 {
 "productId": "634344",
 "category": "INTERNATIONAL_FLIGHT"
 }
 ],
 "order":
 [
 {
 "orderId" : "12312214",
 "orderType" : "Hardware",
 "orderState" : "Completed"
 }
 ],
 "Dispute":
 [
 ]
 }
 }
 Response
 {
 "interpretation": false
 }

Rule Test Service - Non Fraud Scenario

The total score from the different combinations of products, orders and disputes is:

Products: 5+25=30; Orders:  90; Disputes: 0
Total: 120

The Calculated Fraud Score is 120 which is less than the threshold value of 200 and hence it is not a case of fraud.

Scenario 2 – Fraud Scenario

Request
 {
 "Booking": {
 "bookingId": "123213213",
 "product":
 [
 {
 "productId": "asdads",
 "category": "POST_PAID_HOTEL"
 }
 ],
 "order":
 [
 {
 "orderId": "1232",
 "orderType": "New",
 "orderState": "Progress"
 }
 ],
 "Dispute":
 [
 {
 "disputeId": "123213213",
 "disputeState": "Active"
 }
 ]
 }
 }
 Response
 {
 "interpretation": true
 }

Rule Test Service - Fraud Scenario

The total score from the different combinations of products, orders and disputes in this scenario is:

Products: 5; Orders: 90; Disputes: 190
Total: 285

The Calculated Fraud Score is 285 which is greater than the threshold value of 200 and hence it is a fraud.

Summary

This post covered a glimpse of the true power of decision modeling notation to model and implement real world complex decisions. It also provided a preview of the different types of boxed expressions available in the PCS decision modeling engine and how to create and combine them to create complex decisions.

The sample project can be downloaded from here.

In the previous blog, I explained how to get started with decision modeling and its meta-model through a simple use case. The blog post can be read here:

https://beatechnologies.wordpress.com/2017/05/09/introduction-to-decision-model-and-notation-in-oracle-process-cloud-service/

In the next blog post in this series, I will show how to work with lists and collections in Decision Model through another use case. If you have any comments, suggestions or feedback, please do not hesitate to share it here.

Introduction to Decision Model and Notation in Oracle Process Cloud Service

Introduction and Feature Preview

With the latest release of the Process Cloud Service (17.1.3), Oracle has released a preview version of its much awaited Decision Model and Notation (DMN) engine. The DMN standard provides a powerful meta-model, notation and semantics for modeling of operational decision and business rules. It is a critical addition in the process, case and decision modeling framework providing an open standard for modeling the data and logic associated within a process.

The notation standard aims at defining requirements and decision logic for manual and automated decision-making by representing a complete, executable model which can either be used independently or in conjunction with a business process. Similar to BPMN, it aims to support designing of decision models, providing guided operational decision and potentially automation of operational decisions. A combination of process and decision modeling simplifies business processes by eliminating and replacing sections of a process model with a decision model. The decision logic of the process model is captured as a separate yet linked model. By focusing on decisions and processes independently the requirements process is more focused. A decision-driven process acts on the outcome of the evaluation of decision logic in several possible ways, including:

  • Changing the sequence of activities that are taken after a decision, including what the next activity or process that is required to meet the directive of the process.
  • Selecting between the paths on the diverging or the splitting side of a gateway.
  • Deciding who or what participant should perform the needed activity.
  • Creating data values that will be consumed later in the process.

A decision  can be thought of as a meta gateway with merging inputs (events and data) and splitting outputs that direct the process in an overarching way (i.e., participants, tasks, and gateways).

Integrating business process modeling with decision modeling, as well as event processing, can create comprehensive, agile solutions that are easy to change and enhance. Without decision modeling, process modeling in BPMN can both overcomplicate a model with logic and miss critical design details. As decisions are modeled, things will be discovered that the process must do to accommodate the results of those decisions.

By associating a decision model with an activity in a business process model, it becomes an executable specification for the decision-making to be carried out in that activity. If the decision model is encapsulated in a decision service, the business process can execute the decision-making automatically at the correct point in the process. The following diagram provides a high level overview of how process and decision model can be used together.

image

This blog post intends to provide an introduction to the basic concepts of DMN, its constructs, illustration of a real like use case and how to get started with DMN in Oracle Process Cloud Service.

First Things First: DMN Fundamentals

The objective of a decision model is to create a shared understanding about logic, data and process that are fully traceable from business requirements to IT implementations. The Decision Modeling and Notation standard from the Object Management Group (OMG) is a notation that accomplishes these goals. The true value proposition of DMN lies in providing a common language that bridges the gap between across business, IT and analytics department within organisations, thereby improving collaboration, reuse and ability to implement accurate and consistent decision management solutions. The DMN semantics are based on the following principles:

  • Bridge the gap between requirements and technical implementation by mapping graphical notation to the underlying constructs of a business rule execution environment.
  • Specify standard and easy to understand decision requirements diagrams that communicates processing information.
  • Link business rules and analytics to business objects in order to share and tune decision information across process implementers.
  • Provide a format to share decisions and copy decision models between process improvement tools.

In the context of DMN, a Decision is an act of determining an output value, based on a number of input values, using logic defining how the output is determined from the inputs. A Decision Model is a formal model of an area of decision-making, expressed as decision requirements and decision logic. A decision model is defined in two levels, the Decision Requirements Level and the Decision Logic Level which is explained in a bit of detail here. At the decision requirements level, the notation is simple enough to make the structure of the model immediately apparent; yet, the decision logic level provides a specification of the decision-making which is precise enough to allow full automatic validation and execution.

Decision Requirements Level

The Decision Requirements Level is an abstract level of modeling comprising of a Decision Requirements Graph (DRG) represented in one or more Decision Requirements Diagrams (DRD). It defines the decisions to be made, the interrelationships, and the required components for the decision logic. The DMN decision requirements diagram is a notation depicting important elements of decision-making and their dependencies. The following table outlines the DMN decision diagram constructs, their symbols and meaning.

DRG Construct

DMN Notation

Description

Elements
Decisions image A decision element corresponds to the business concept of an operational decision. It is the act of determining an output value from a number of input values, using some decision logic. The inputs to a decision may be input data elements or the outputs of other decisions. The decision logic may include the invocation of one or more business knowledge models.
Input Data image An input data element corresponds to the business concept of data. It is a data structure whose component values describe the case about which decisions are to be made. Input data elements typically model high-level concepts of busi11111ness significance, e.g., “Application form”, “Claims history” or “Invoices.”Information used as an input by one or more decisions.
Knowledge Source image A knowledge source (with a wavy edge) defines an authority for decisions or business knowledge models — for example, a manager responsible for a decision, a policy manual, or a piece of legislation with which a set of rules must comply.
Business Knowledge Model image A business knowledge model (with clipped corners) corresponds to business concepts such as “expertise,” “know-how” or “policy.” It is a function that encapsulates an area of business knowledge as executable decision logic, possibly expressed as business rules, an analytic model, or an algorithm. The business knowledge model is parameterized, and is therefore a reusable component that may be called from multiple decisions, or from other business knowledge model.A function encapsulating business knowledge, in the form of business rules, decision table or analytic model.
Requirements
Information Requirement image Represents an input data or decision output required for a decision.
Knowledge Requirement image Represents an invocation of a business knowledge model.
Authority Requirement image Denotes the dependence of a decision requirement diagram element with another element that acts as a knowledge source or guidance.
Artifacts
Text Annotation image Consists of a square bracket to capture explanatory text or comment.
Association image It is a connector that links a text annotation to the decision requirement diagram element.

Decision Logic Level

A DMN diagram does not depict the decision logic of a particular decision. DMN decision logic level is used to specify a complete expression of logic, potentially sufficient for automation. Each decision in a decision model has a value expression that describes how a decision outcome is derived from its required input, possibly invoking a business knowledge model. In addition a decision logic level allows boxed expressions to be associated with elements in the decision requirements level. Boxed expressions allow the decision logic to be decomposed into small pieces that can be notated in a standard way and associated with elements at the decision requirements level. The type of DMN boxed expressions supported in Oracle PCS are:

  • Function Construct – Allows creating parameterized logic that can apply multiple times to a set of input with different parameter values.
  • If Then Else Construct – Decision function with three logic parts: If (Boolean test), Then (result if the test is true), and Else (result if the test is not true).
  • Context Construct – Provides a mechanism to create a list of named logic elements, where logic lower in the list may reference logic results higher in the list by name.
  • List Construct  – This construct provides a list of independent logic elements whose output contains outputs of all logic elements.
  • Relation Construct  – Allows creating a relational table where each cell contains a logic element. For example, a cell in a relation construct could be a function, decision table, expression or if-then-else.
  • Friendly Enough Expression Language (FEEL) – Create logic that evaluates to a single value by entering readable text.
  • Decision Table – A decision table comprises of rules with tests matching input on one side and output on the other side.

A lot of the information provided above can be summarized in an easy to visualize mind map that I have created. The mind map shows a relationship between a number of DMN components across both decision requirement diagram, decision logic and decision services.

DECISION MODEL

A Simple Use Case : Loan Straight Through Approval Decisioning

Imagine you are working at a bank in the personal lending fulfilment department. A customer wishes to make a request to determine his lending eligibility for a personal loan. Can you accept his request, determine and outcome and communicate to him the result? You have to make a business decision. What are the criteria for the correct decision and what information is your choice based on. The bank has standard rules and guidelines for handling the request, some of which are:

  • Customers need to provide collateral for personal lending above a certain amount.
  • The identity of the customer has to be properly verified
  • Moreover, which type of document is allowed depends on the customer’s nationality and lending value
  • Does the customer already have existing loans with the bank or other banks?

Decisions in DRD are represented by rectangles and input data by rounded rectangles. In the example DRD illustration shown below “Determine Lending Approval” is the top-level decision. “Determine Lending Eligibility” and “Determine Lending Limit” are sub decisions, the outcome of which is considered by top-level decision. They are also sub decisions because the questions they pose must be answered before the main question, “Determine Lending Approval”, is answered. The arrows depict a flow of the decisions into the top-level decision. There can also be more than one top-level decision. Third element types, called knowledge sources help us depict dependencies on policies or regulatory requirements. In this case, the “Determine Lending Limit” sub decision depends on “APRA #571.1 Revisions to Large Exposures”, a particular retail banking regulation by a financial regulatory authority. DMN diagrams provide a high-level overview of how a decision depends on other decisions, policies or regulation and input data.

 

DMN-DRG

As stated before a DMN diagram does not depict the decision logic of a particular decision. Decision logic specifies the details of one decision, so that it can be easily and unambiguously understood by a human. In the rest of this blog post, I will provide detailed steps through which the above decision model can be translated into a decision logic executable as a DMN decision model in Oracle PCS and subsequently exposed as a decision service to be consumed by a business process.

DMN as a first class Citizen in Oracle Process Cloud Service

If your PCS instance has been updated to 17.1.3, you can enable DMN design and runtime by navigating to Administration > UI Customization > and check Enable DMN in Composer.

image

Decision Model in DMN

Once the DMN editor is available in composer, you should be able to create a new Decision Model in any available project space in PCS. The decision model that I created and which will be covered here is called Lending Approval. A decision model in DMN can have more than one decisions that are based on boxed expressions with each decision taking in an input type and resulting in its own output. A decision model can also be service enabled by defining a decision service and associating one or more decisions to it. The interface of the decision service is determined by the input association and output is determined by the outputs associated with the decisions. The following illustration provides an anatomy of a DMN decision model in Oracle PCS.

 

image

 

Decision Tables in DMN

Let’s assume that the retail lending application use case being discussed has an overarching process model (will discuss this shortly) that allows lending approvals without any manual approvals for certain scenarios. In order to determine this, a decision model has to evaluate lending eligibility as well as calculate an approximate lending limit that can be approved for the applicant. An applicant’s personal lending request is deemed eligible if:

  • It it below a threshold determined by the financial institution’s risk taking appetite for approving lending without any securities (in our example, let us assume it is 5G)
  • For any lending request that is above this threshold, the applicant must have:
    • A valid nationality
    • A valid identification document which is verified

Finally, the decision logic behind these checks should ensure that all the above conditions are met for the lending request to be deemed eligible. If at least one condition is not met, then the lending request is denied. Once an eligibility has been determined, the decision function then also needs to calculate the maximum lending limit based on the credit information provided by the applicant.

There are a few ways in which the decision logic for the above scenario can be implemented, the most common being using a decision table. A decision table can have one or more rules where each rule contains input and output entries. The input entries are the condition and the output entries the conclusion of the rule. If each input entry (condition) is satisfied then the rule is satisfied and the decision result contains the output entries (conclusion) of this rule. A decision table also has a hit policy that specifies what the results of the evaluation of a decision table consist of. Each row in the decision table represents a rule where as the columns represent conditions. Conditions are based on input elements or expressions/functions and can be restricted to data types, list of values or ranges.  A detailed visual of a decision table in DMN along with its key components is shown below with some explanatory text. If you carefully read the table it does the following:

  • Sets the lending eligibility as true if the sum of current and any existing lending (denoted as aggregated sought exposure) is less than 5k.
  • For any lending above the 5k threshold, the applicant needs to be Australian, have a valid identification status (Valid) and identification document (Passport, Election Card or National Identity Card) to be eligible.

image

When a decision is created in a decision model, it requires an input and output definition. For our example, I created a complex LendingRequest element with a few simple elements which would be used in the decision table. You can also use an existing business object for an input variable.

image

Creating Bucketsets in a Decision in DMN

Input expressions defined in the decision table can be bucketed as list of values or a value range to restrict the condition evaluation to a value within the bucket. This is very useful in long decision tables as it restricts users from entering invalid values that would otherwise result in an exception.

image

Decision Table Hit Policy

Decision tables in DMN has another very interesting feature called hit policy. A hit policy specifies how many rules of a decision table can be satisfied and which of the satisfied rules are included in the decision table result. The hit policies supported in Oracle PCS are Unique, Any and First and Collect which are described in more details in the table below.

Hit Policy Description Usage Scenarios
Unique (Single) Only one rule is allowed to fire for any one combination of inputs. In this context, all inputs are assumed to be independently from each other, i.e. that any combination is actually possible. Immigration rules to determine if a person should be allowed a visa or be declined.
Any (Single) Multiple rules cover the same combination of input values. However, this overlap is only allowed if the overlapping rules have the same output. A diagnosis of a medical condition might need an Any policy if various ranges of similar diagnostic test identify the same condition.
First (Single) Rules might overlap. But only one rule fires: The First hit policy simply assumes an ordering of the rules – they are evaluated from top to bottom. As soon as one rule fires, the output of that rule is used as result of the decision. Once one rule hits, no other rule is checked. A hotel booking reservation where the first match room is allocated based on a customer’s preference.
Collect (Multiple) Multiple rules can fire without an explicit order. Multi hit tables either return a set or aggregate the final results of the decisions. DMN’s default is provide the set of output values as result. Multi-rule table can apply aggregation functions such as min, max, avg to derive a single value from a set of output values Create a score card to assign points to an inspected based on multiple checks and with points off for various defects.

If you now look at the DetermineLendingEligibility decision table again, you would notice that the first cell of the table is denoted with a capital F. This is setting the hit policy of the table to First which means the decision table will stop evaluation as soon as the first condition is true.

Combining Multiple Decisions in a DMN Decision Model

A single decision model can have one to many decision services and likewise one to many decisions. Decisions can be associated with decision services which provides a service interface to invoke a decision logic construct. As originally explained in our use case, we also wanted to calculate the automatically derived lending limit from a business rule. Whilst determining such a limit in real world would be based on very complex rules, a simplified version is shown below. The lending limit is based on the difference between the total valuation of a customer’s security against a sum of his/her outstanding loans. The result of the expression can also be evaluated against a number range to determine the decision output as shown in the decision table below. Note that [ denote that the number in the range is inclusive while ( denotes it is exclusive.

image

Testing a DMN Decision Service

The DMN composer in PCS has very strict design time validations for decision tables and models. Once the rule components are validated, they can be deployed as a standalone application in the same way as a PCS application. Once a DMN application is deployed, it will provide a rest endpoint to post a request and get a response. Here is a sample JSON request to the Rest endpoint and I use in Postman to invoke the service. The output is an decision interpretation object returning the result of each executed decision table in the decision service.

{
“LendingRequest”:
{
“customerName”: “Arun”,
“lendingNumber”: 123123,
“nationality”: “Australian”,
“securityInOrderValuation”: 3000,
“aggregatedSoughtExposure”: 4900,
“identificationStatus”: “Invalid”,
“identityDocumentType”: “Passport”
}
}

image

Using the New Decision Activity in a Process Model

The final piece to the puzzle is to use a DMN decision component in the process model. Needless to say there is a new Decision Activity available in the System palette in PCS composer to associate a decision service to the activity. The data association wizard in PCS can then be used to pass and retrieve information from a decision function. The following process model shows how the decision model discussed in this example can be used in an overarching process for straight through approval of customer retail lending. The result from the decision function are used to determine the process flow:

  • If the lending limit is less than 5000 and the eligibility criteria are met, the lending is automatically approved without any manual intervention.
  • If the lending limit is greater than 5000 and the eligibility criteria are met, the lending request is sent to a Credit Approver to view and either approve or reject the request.
  • If the lending eligibility criteria are not met, the lending is rejected and the process terminates.

image

Application Links and Testing the Overall Solution

The PCS process and DMN business rule application discussed in this blog can be downloaded from here. When these applications are deployed to the runtime, they can be tested from end to end. The Manage Lending Submission process model has an event start (initiate lending submission) node which means that the process can be invoked as a SOAP endpoint. The section below provides a few test scenarios and how process map behaves based on the output determined by the DMN decision model.

Scenario 1 – Straight Through Approval – Sub 5k Loan

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:man="http://xmlns.oracle.com/bpmn/bpmnCloudProcess/MLS/ManageLendingSubmission" 
xmlns:len="http://xmlns.oracle.com/bpm/bpmobject/MLS/LendingRequestMetadata"> 
<soapenv:Header/> 
<soapenv:Body> 
<man:initiateLendingSubmission> 
<len:LendingRequestMetadata> 
<len:customerName>Arun Pareek</len:customerName> 
<len:lendingNumber>123123213</len:lendingNumber> 
<len:nationality>Australian</len:nationality> 
<len:securityInOrderVal>3000</len:securityInOrderVal> 
<len:aggregatedSoughtExposure>4900</len:aggregatedSoughtExposure> 
<len:identificationStatus>Valid</len:identificationStatus> 
<len:identityDocumentType>Passport</len:identityDocumentType> 
<len:approver>BBCManager</len:approver> 
<len:lendingEligibility>false</len:lendingEligibility> 
<len:lendingLimit>0</len:lendingLimit> 
<len:customerEmail>arun.pareek@rubiconred.com</len:customerEmail> 
</len:LendingRequestMetadata> 
</man:initiateLendingSubmission> 
</soapenv:Body> 
</soapenv:Envelope>

image

Scenario 2 – Lending Requires Manual Approval – Loan > 5k with Valid Nationality, Identification Status/Document

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:man="http://xmlns.oracle.com/bpmn/bpmnCloudProcess/MLS/ManageLendingSubmission" 
xmlns:len="http://xmlns.oracle.com/bpm/bpmobject/MLS/LendingRequestMetadata"> 
<soapenv:Header/> 
<soapenv:Body> 
<man:initiateLendingSubmission> 
<len:LendingRequestMetadata> 
<len:customerName>Arun Pareek</len:customerName> 
<len:lendingNumber>123123213</len:lendingNumber> 
<len:nationality>Other</len:nationality> 
<len:securityInOrderVal>10000</len:securityInOrderVal> 
<len:aggregatedSoughtExposure>13000</len:aggregatedSoughtExposure> 
<len:identificationStatus>Valid</len:identificationStatus> 
<len:identityDocumentType>Passport</len:identityDocumentType> 
<len:approver>BBCManager</len:approver> 
<len:lendingEligibility>false</len:lendingEligibility> 
<len:lendingLimit>0</len:lendingLimit> 
<len:customerEmail>arun.pareek@rubiconred.com</len:customerEmail> 
</len:LendingRequestMetadata> 
</man:initiateLendingSubmission> 
</soapenv:Body> 
</soapenv:Envelope>

image

Scenario 2 – Lending Rejected – Invalid Identification Status

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:man="http://xmlns.oracle.com/bpmn/bpmnCloudProcess/MLS/ManageLendingSubmission" 
xmlns:len="http://xmlns.oracle.com/bpm/bpmobject/MLS/LendingRequestMetadata"> 
<soapenv:Header/> 
<soapenv:Body> 
<man:initiateLendingSubmission> 
<len:LendingRequestMetadata> 
<len:customerName>Arun Pareek</len:customerName> 
<len:lendingNumber>123123213</len:lendingNumber> 
<len:nationality>Other</len:nationality> 
<len:securityInOrderVal>15000</len:securityInOrderVal> 
<len:aggregatedSoughtExposure>12000</len:aggregatedSoughtExposure> 
<len:identificationStatus>Invalid</len:identificationStatus> 
<len:identityDocumentType>Passport</len:identityDocumentType> 
<len:approver>BBCManager</len:approver> 
<len:lendingEligibility>false</len:lendingEligibility> 
<len:lendingLimit>0</len:lendingLimit> 
<len:customerEmail>arun.pareek@rubiconred.com</len:customerEmail> 
</len:LendingRequestMetadata> 
</man:initiateLendingSubmission> 
</soapenv:Body> 
</soapenv:Envelope>

image

Summary and Closing Thoughts

The Decision Model and Notation not only adds clarity to business logic, it sharpens and simplifies business processes. A process model should represent the procedural flow of tasks. A decision model should represent the declarative conditions leading to the conclusions of business decisions. In the past, due to lack of alternatives, this was mixed up in process modeling notations leading to complex and convoluted process models and eventually maintenance headache. Decision models are relatively new to most organizations and the support for the DMN standard has just released in Process Cloud Service. This blog post should hopefully provide you with the necessary knowledge, tool and best practices for implementing decision models in business process and stay ahead of times. to start No one reading this column should feel behind the times. DMN and BPMN are very powerful together and using them wisely together could provide organizations with many advantages such as:

  • Maintain all operational and analytical business logic (of business rules) together in one place (rather than scatter it across wrong places)
  • Reduce process models to simplest form so that they do no consume the length of board room walls
  • Increases speed to value and agility of the solution as decision models can be updated agnostic of the process models and vice versa.
  • Provides reuse of business decisions across multiple processes
  • Allow creation of customized views of the same decision logic whereby a process model calls a different view of a decision model as appropriate
  • Deploy advanced and sophisticated technology in an optimum manner:
  • Give more control to business people to govern and change the logic behind business decisions.

The Curious Case of Missing Port Type in Oracle PCS

I was recently working on a simple process in PCS for a license approval flow. Given the purists that I am, I began by defining definitions for the various message based activities used in the process flow. The process was an asynchronous process with a few intermediate events. A simplified snippet is shown here for visualization.

process

In order to implement the above process, I created a service definition (WSDL) with the following schematic. As you can notice, there is a portType for accepting requests into the process (fc.myst.bp.TestDrive) and a callback portType for sending messages out of the process (fc.myst.bp.TestDrive.CallBack). Each of the portTypes have operations for catch and throw messages respectively.

WSLD schematic

Creating a service definition is considered a best practice as it will not lead to multiple definitions created by the process when generating interfaces from message based implementations. So instead of using “Define Interface” we tend to use “Use Interface“.

Use Interface

If we navigate through the configuration wizard for creating a reference based on an existing service previous uploaded into PCS, we will hit a dead end. Both the portTypes configured in the WSDL will appear under the Callback Port Type drop-down whereas the drop-down under the Port Type combo box will be empty. This will also inhibit creation of the service reference based on the service definition. This is shown in the chain of images below.

blankPortType

In order to resolve this problem, I had a closer look at the interface definition WSDL. Turned out that i had created an abstract WSDL which is perfectly fine given that the composite assembly would just use it to implement an interface and generate a service endpoint from the deployed composite. Tried to re-import the WSDL a few times to see if the issue could be addressed but it persisted.

At last, I changed the WSDL to a concrete definition by adding arbitrary service endpoints to the bindings and re-imported into PCS.

Concrete WSDL

Voila! I was able to create a new reference this time by selecting Use Interface from the start message event with the reimported WSDL.

port

The source code for the PCS project discussed in this blog can be downloaded from here.