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.

Accelerating Innovation through Device, Human and Process Centric Integration

Introduction – A step towards a Digital Journey through the Cloud

In an increasingly digitized world, technology enabled transition is increasingly becoming a strategic ally for organisations and how they deliver services and products more effectively. Organisations need to orient their business along capabilities and commercially viable ‘proof points’ that can scale quickly. A key to this approach is to avoid large multi-year road maps and refrain from multi-million dollar investment projects to be locked into an uncertain future. The concept of providing a differentiated customer experience is the only way to create a sustainable advantage. A recent Oracle Partner event (Sydney PaaS Hackathon) was a perfect stage for partners in APAC to demonstrate the power and capabilities of the Oracle Cloud Platform to accelerate a customer’s digital transformation journey. Now that the dust has settled on the amazing Sydney Hackathon where we participated and won the second prize for our prototype using Oracle PaaS products, it is time to share what we actually built and how. In this opening blog, I will provide a glimpse of the end to end solution that we put together using nine different Oracle Cloud Services in the 28 hour marathon. Along the way, I would also share the best practices and lessons learnt of integrating the different Cloud Service and an approach to building solutions around user centric design principles. The core prototype and use case was around building a real time remote patient well being monitoring system. In particular, the solution centered around patients suffering with blood pressure related disease which is a major cause of health related deaths in Australia.

Before describing the end to end solution, it is appropriate to describe the real problems that patients with blood pressure related disease suffer. This would provide some key drivers behind the solution that we have implemented. Let’s have a quick look at some of the frustrations sufferers have to deal with while pro-actively managing their blood pressure:

  • Forgetfulness – Lifestyle changes are very important in managing high blood pressure. But lifestyle changes along do not help. Patients have to regularly take their blood pressure readings and prescribed drugs to subdue prolifiration of their condition. Forgetting to take timely readings or medication is a leading cause of sudden anomalies in blood pressure readings.
  • Routine Health Checks – With the busy lives most people have today it can be really hard to fit in regular visits to the pharmacy for routine blood pressure checks.
  • Uncertainty – People with high blood pressure are at risk of suffering from untimely stroke and heart attacks. They often visit their medical practitioners in reaction to an event or during a scheduled appointment as opposed to being looked after and being proactively advised.

Use Case – Remote Patient Monitoring and Connected Care

We built a Patient Monitoring System to manage personal health (specifically blood pressure) that remotely connected patients with their community pharmacists and medical practitioners allowing proactive management of their well being. This will be quite a read but if you manage to stay till the end, the blog will provide you with a method to identify and innovate on real world problems that have been ignored for long. Upon exploring the use case further, we identified 4 key personas beginning with Bruce Wayne (our patient).

  • Bruce suffers from high blood pressure and struggles to visit his physician and pharmacist for regular blood pressure check ups. He also forgets his pills and is uncertain how this will effect his health and well being in an unforeseen event.
  • Jenny is Bruce’s local community pharmacist. She collects and review’s Bruce’s blood pressure data and makes her assessment for the next course of action.
  • Jenny like to consult with a  qualified medical practitioner such as a physician or a cardiologist from time to time when there is a critical reading or when she spots an anomaly and needs a second opinion.
  • Lisa who is a medical practitioner believes that with the right technology solution, she can make more informed and proactive decisions for her patients without meeting them in person.
  • Finally, our fourth persona is the State Health Department that has always expressed a desire to collect well being information anonymously to identify key geographical clusters associated with higher risks of heart attacks.
Role/Persona Background/Job Function Important Needs

Patient
(Bruce Wayne)

Patient

  • Works as a Project Manager
  • Often has to work under stressful circumstances
  • Has a family history of heart related disorders
  • Suffers from Hypertension (High Blood Pressure)
Bruce would benefit from being able to take remote  blood pressure reading which is automatically sent to his pharmacist to minimize routine travel. He uses technology heavily and would not mind notifications to remind him when he misses to take his reading and prescriptions. He is also happy to be proactive consulted and advised from his health practitioner and pharmacist when there is a problem.

Pharmacist
(Jenny Andrews)
Pharmacist

  • Works in a Pharmacy as an Community Pharmacist
  • Collects and records Blood Pressure Readings for routine patients
  • Prepares medications by reviewing and interpreting physician orders
  • Controls medications by monitoring blood pressure and advising interventions
As a pharmacist, Jenny would like to automatically detect and manage information regarding when any of her community patient has a critical blood pressure reading so that she can take the next proactive action.

Medical Practitioner
(Lisa Brown)

Medical Practitioner

  • Diagnosis, monitoring and treatment of high blood pressure
  • Physical Examination of Routine Patients
  • Inform patients about their blood pressure and how they can make lifestyle changes to prevent or improve hypertension
As a medical practitioner, Lisa wants to be able to analyse her patients well being records over a period of time so that she can detect patterns, anomalies and exceptions.

State Health Department
logo-gov-dep-health

  • Targeted prevention activities for disadvantaged populations
The state department of health is interested in the analytics side of things. It would be great if they can correlate high blood pressure to a geographical region, weather condition or time of the year.

The Remote Health Monitoring prototype discussed in the rest of this blog aims to address the core challenges discussed earlier.  We put our thoughts in action by integrating close to 10 Cloud Services in 28 hours for our use case. Oracle IoTCs, ICS, MCS, Application Container Cloud Service (BICS), APICS, Business Intelligence Cloud Service (BICS),  and PCS were the core Cloud services that were the heart of our solution.

Solution at a Glance : myHealth

For the Hackathon, we created a fully functional and cloud integrated application called myHealth. The key objective of myHealth was to shift patient healthcare from cure to prevention. The overarching solution emphasized on building an infrastructure to continuously oversee the vital parameters of a patient and provide necessary alerts and interventions at near real time by leveraging IoT, services and a digital platform in a cost effective way.

Oracle Cloud Services in Action

As we wanted to remotely measure and stream health data, process it, and analyse it in real time to detect and react to an anomaly, Oracle Internet of Things Cloud Service was the ideal choice to be at the heart of the solution. Of the numerous blood pressure monitors available today, we used iHealth Sense Wrist wireless devices. Once a patient would take a reading from a this device, it would instantly push that data onto the device cloud. We accessed the iHealth APIs to create a web-hook to publish this stream of data into the IoT Cloud using Application Container Cloud Service and Integration Cloud Service. This is where interesting things would happen:

  • Using IoT Cloud Service, we built explorations which were visual representation of real time data coming from remotely registered devices/gateways for insightful data interrogation. The explorations were built to refine and sanitize incoming real time data stream using a few out of the box patterns such as eliminating duplicates and detecting fluctuations and define criteria to filter critical events from the normal.
  • Once explorations were published, it becomes available as one of the message formats to choose from when configuring an IoT Application’s integration with external services, such as Oracle Business Integration (BI) Cloud Service, Oracle Mobile Cloud Service or an enterprise application based on HTTP endpoints.
  • After isolating critical events from the data stream that required manual intervention, a process flow is triggered in Oracle PCS where a pharmacist or a medical practitioner can assess the anomaly and take further action such as provide phone consultation, schedule and appointment, renew/change a prescription, issue referrals, order meds, etc.
  • We also created a myHealth mobile app in Oracle MCS that would allow for push notifications to a.) Patients when they have forgot to take their readings or leave a perimeter (area of residence and b.) Pharmacists and doctors when a process is triggered due to a critical reading.
  • Finally we created a range of predictive and analytical reporting dashboards leveraging Oracle Database Cloud Service (APEX), Business Intelligence Cloud Service and Data Visualization Cloud service.

Here is an overall connected architecture for the use case. The entry point and heart of the solution is the Internet of Things Cloud Service (IoTCS). Patients can self measure their blood pressure readings remotely through tele-monitoring devices that collect and send data to either an IoT server directly or through a gateway.

Oracle Cloud Connected Architecture

This blog aims to explains how we specifically used Oracle IoTCS that fascinated us and is where we built quite a lot of our components and was at the heart of our use case. Hopefully the use case will present by itself.

Oracle Internet of Things Cloud Service (IOTCS)

The IoT Information Value Loop

The Information Value Loop mode shown below can serve as the cornerstone for an approach to IoT solution development for potential use cases. This model provides discrete but connected stages. An action in the real world allows creation of information about that action, which is then communicated and aggregated across time and space, allowing analysis of the data in the service of modifying future acts.

IOT_IVL

A Quick Primer to Oracle IoT Cloud Service

To realize the use cases for myHealth to the information value loop model depicted above, we were able to utilize Oracle IoT Cloud Service to:

  • Collect proximity information about a patient’s movement i.e. to check if the remote patient is leaving his house.
  • Collect blood pressure and pulse measurement about a patient.
  • Register directly connected devices (Beacons and Blood Pressure Monitors) or Gateways so that information can be collected from these devices remotely in real time.
  • Perform real time pattern matching on data streams to sanitize information by eliminating duplicates, detecting missing events, etc.
  • Perform data aggregation, filtering and correlation on multiple streams to generate business events.
  • Raise message alerts based on business events.
  • Define external integration touch points to invoke systems, services and process to act on critical events.
  • Remotely monitoring devices and assets.

Among the various components of Oracle IoTCS, here is a quick diagram explaining the core components and the relationship between them.

IoT-DataModel

In addition to the above server side artifacts, Oracle IoTCS provides a ranges of client APIs for platforms such as C, Java, JavaScript, and Android for devices to activate, register and send messages to an IoT server. Devices can either connect directly to the IoTCS server or they can connect to a Gateway which in turn communicates to the IoT server. Once connected, a device can begin to send messages to the IoT server based on a pre-defined Device Model definition (analogous to a message contract).

Oracle IoT CS Device Models – Registration and Activation

For our myHealth IoT application we created two device models to collect patient health readings and proximity readings respectively.

  • iHealthSense – This device model (urn:demo:health) was created to define a message format for the blood pressure reading received in the IoT server through any devices that capture this information. In addition to the predefined System Attributes, a device model allows creating Custom Attributes through the console. This allows specifying a message format that can be published from any device that uses this device model.

 iHealtSense

  • estimoteProximity – This device model (urn:demo:proximity) defines a message format that any registered proximity devices such as Beacons use to send messages to the IoT server. Beacons can relay geographical coordinates as well as proximity of a device/person/instrument from them. In addition, certain Beacons can also send temperature, humidity as well as images.

estimoteProximityDM

The next step for us was to create, register and activate Devices that can use these device models and communicate with the IoT server. Creating a Device in the IoT server is a two part process.

  • Registering a Device – Registration of a device is done in the IoT CS console. The following image shows how a single device is being registered by entering appropriate meta data level information about the device.

IoT-Device-Metadata

Once the device registration details are saved and successful, Oracle IoT CS server will create a unique Device ID based which can then be used by the actual physical device APIs to send and receive messages from IoTCS server. A provisioning file is also created on the web console that stores an encrypted connection credentials required to connect to this device and activate it on the IoT server through the IoT APIs. Any client side API’s would then require this provisioning file to interact with the activated device. The provisioning file is a configuration file that contains a hashed password, the URL of the IoT CS server and the device activation id registered on the IoT server. When this provisioning file is downloaded, a file protection password needs to be specified which will be used to fetch the connection details in the hashed file.

IoT-Device-Metadata-Activation

Application Container Cloud Service

When we began looking into the best ways to push data in IoT, we realized that the NodeJS IoTCS APIs are 100 times faster than the Rest APIs. We implemented the client APIs used to communicate with the Oracle IOT CS server using Node.js. Both Oracle MCS and Oracle Application Container Cloud Service provides containers to run and execute Node code.

Setting up Node.js and Node Package Manager

Node.js can be downloaded from here and the IoT CS client libraries can be downloaded from here. Depending upon your preferences, you can either use a standard text editor to write the Node.js code or use an IDE that supports it. Next install the client libraries as global libraries through Node Package Manager (node-pm) using the following command.

npm install forever -g

  • Activating a Device – When a remote device sends a message to the registered device in the IoT CS, it is automatically activated. The following is a code snippet in Node.js using the Oracle IoTCS Node.js libraries that connects to a remote server as a standalone client using the provisioning file and activates a device. Once a device is activated, it can send and receive messages.
dcl = require("device-library.node");
dcl = dcl({debug: true});
//This is the code to load the provisioning file for the device downloaded from the IoT Server
dcl.oracle.iot.tam.store = ("iHealthSense-WA-UU112313-provisioning-file.conf");
//Password specified when downloading the provisioning file
dcl.oracle.iot.tam.storePassword = ("#Musicrules12");
var myModel;
var virtualDev;
// Create a directly connected device and activate it if not already activated
var dcd = new dcl.device.DirectlyConnectedDevice();
if (dcd.isActivated()) {
 dcd.close();
} else {
 dcd.activate(['urn:demo:health'], function (device) {
 dcd = device;
 console.log(dcd.isActivated());
 if (dcd.isActivated()) {
 dcd.close();
 }
 });
}

Save the above code snippet as DeviceActivatation.js, go to a command prompt (assuming you are using windows) and type

node DeviceActivation.js

If we check the state of the device in IoT CS server, it would be Activated. The device activation also associates the selected device model with the device. This means that the device can begin accepting messages in the format described in the device model.

iHealthWristRegistration

  • Sending Messages to a Device – After a device has been activated, the following Node.js code fragment, acting as a remove directly connected device, can be used to publish a message to the IoT CS server.

dcl = require("device-library.node");
dcl = dcl({debug: true});
dcl.oracle.iot.tam.store = ("iHealthSense-WA-UU112313-provisioning-file.conf");
dcl.oracle.iot.tam.storePassword = ("#Musicrules12");
var myModel;
var virtualDev;
// Create a directly connected device and activate it if not already activated
var dcd = new dcl.device.DirectlyConnectedDevice();
if (dcd.isActivated()) {
 getHWModel(dcd);
} else {
 dcd.activate(['urn:demo:health'], function (device) {
 dcd = device;
 console.log(dcd.isActivated());
 if (dcd.isActivated()) {
 getHWModel(dcd);
 }
 });
}
// Display the device model
function getHWModel(device){
 device.getDeviceModel('urn:demo:health', function (response) {
 console.log('-----------------MY DEVICE MODEL----------------------------');
 console.log(JSON.stringify(response,null,4));
 console.log('------------------------------------------------------------');
 myModel = response;
 startVirtualHWDevice(device, device.getEndpointId());
 });
}
//Send Message to the Device based on the Device Model Attributes
function startVirtualHWDevice(device, id) {
 var virtualDev = device.createVirtualDevice(id, myModel);
 var bpHigh = Math.floor(Math.random() * (180 - 100)) + 100;
 var bpLow = Math.floor(Math.random() * (120 - 60)) + 60;
 console.log('High BP'+ bpHigh);
 var newValues = {
 bloodPressureHigh: bpHigh,
 bloodPressureLow: bpLow,
 patientName: "Arun Pareek",
 patientAge: 32,
 patientEmail: "<a>arun.pareek@rubiconred.com</a>",
 patientContactNumber: "0424978874",
 patientGender: "Male",
 pulse: 60,
 ora_latitude: -37.817000,
 ora_longitude: 144.946000
 //timeStamp: new Date().toDateString()
 };
 virtualDev.update(newValues);
 virtualDev.close();
};

Once a message is received for a device, it can be audited in the IoT CS service console. Pretty simple and powerful.  The Node.js code can also be tweaked to send a bulk message to the device.
IncomingDeviceMessage
Aggregation, Analytics and Actions using Oracle IoT CS

Data collected from multiple sensing devices come in different formats and at different sampling rates—that is, the frequency at which data are collected. Oracle IoT CS allows creation of data exploration sources that can collect structured raw data and present it as a continuous stream.

Exploration Sources

An exploration source can be created in an IoTCS application based on a device model. This exploration source will read and store the raw data that is received in the IoT server from the remotely connected device. The exploration source message format is based on a pre-defined device model defined in the IoT application.

Data and Explorations

Explorations

A message exploration can be used to analyze and pattern match data from different exploration message to provide a real time stream of messages. Explorations in Oracle IoT Cloud Service are very powerful as they support message aggregation and analytics through a number of pre-defined patterns (A pattern is a template that already has the business logic built into it) such as duplicate elimination, missing event detection, fluctuation detection, etc. An exploration is created based on an exploration source.

Data and Explorations-2

One an exploration is created, it is in an unpublished state. Explorations are visual representation of real time disparate event data flows for insightful data interrogation from IoT devices. Explorations provide a number of feature such as correlating, filtering and grouping for managing data streams in real time. These data functions can be aggregated on a time or event based window and used in creating a summary view of data. Business rules can also be defined in explorations to review incoming events and apply business logic to generate resulting data fields that can be displayed in tabular or graph forms. Once an exploration is edited and finalized, it has to be published for the changes to take effect. For our use case, we created a standard exploration that would stream the blood pressure and pulse reading of patients in real time.

Editing an Exploration

Duplication Elimination and Anomaly Detection

Explorations in an Oracle IoT Cloud Service application can be nested, which means, we can create another exploration based on an existing one. As a best practice, it is always recommended to not add any business logic in the base exploration but to create a derived exploration from it. The pipeline shown below provides the necessary abstraction for the core explorations used for analytics from the source explorations.

DuplicateEliminationDesign

The below exploration is merely built on the previous exploration but is based on the duplicate elimination pattern. This exploration will only stream data events that has a unique msgId. The window specifies the time period or interval until which the pattern will be active for each incoming message.

EliminateDuplicateBP

Adding Business Logic to Explorations

Finally, the last nested exploration if the CriticalBP stream that is built up on the EliminateDuplicateBP as the exploration source. Filters can be applied on exploration so that the stream only generates data events of particular importance. For instance, blood pressure readings where the systolic pressure is greater than 140mm or less than 90mm is considered critical and could lead to hyper or hypotension. These blood pressure readings should raise an alert that can be viewed by and acted upon by a healthcare professional.

ExplorationBusinessLogic

The output exploration, in its published state, shows a real time critical blood pressure events for different patients along with their geographical coordinates (source of the reading) and contact information. Data from remote devices is pushed to this live output stream such that it would constantly refresh when a new event arrives rather than manually refreshing the view.

IOT-Exp-CriticalBP-Message

Getting a Proximity Alert

As I indicated before, there are a number of additional use cases that can be implemented with the core use case of remote patient monitoring. When we were at the Hackathon, we interviewed a few people who had problems with blood pressure to know their key pain points. The biggest one across many people was forgetfulness, i.e. forgetfulness to take readings on time and take prescribed drugs/renew prescription. We needed a solution to remind a patient to take their readings on time. But sometimes reminder alone for a blood pressure reading is not sufficient as the patients need to have their reading device on them. One way to solve this is by using beacons to track the proximity of a patient from his home.

IoT-Exploration-Proximity

Visualize the high level message flow diagram below. if a beacon is attached to a patient’s house door or exit, it keep sending proximity information to the Oracle IoT CS server. When the proximity is breached (i.e. when a patient has left is house), an IoT exploration stream can then check if a reading has been taken for the day. In case of a missed reading, it can generate an alert leading to a notification on the patient’s phone. Off course, this integration would not be possible without using Oracle Mobile Cloud Service but developing this feature is a breeze.

EventAlertDesign

Raising Alerts from Explorations

Streaming data into IoT explorations is very useful for real time data analysis for predictive intelligence and reactive actions. To react to an anomaly or an event(s) of interest, create a message format (CriticalBloodPressure) from an exploration to generate an alert of suitable severity. The event message type is based on the attributes defined or created as part of the exploration. IoT exploration attributes need not be the same as the attributes defined in the device model as they can be renamed and logical ones added.

ExplorationMessageFormat

Integrating IoT Application with External Systems

After an alert has been raised in an Oracle IoT CS application, it can forward the message to an external application in the form of a push request. As such a number of publish subscribe or one way messaging pattern can be built using IoT Cloud Service as central point for generating business events.  Ensure to decouple any external integration from IoT CS through a proper service abstraction layer. Oracle API Manager Cloud Service can be very useful here to provide a gateway for outbound integration that can consume business events from IoT CS and publish them to other cloud services or SaaS applications as described in the integration pattern below.

IoTExternalIntegration

Apart from providing an out of the box integration with Business Intelligence CS and Mobile CS, it can pretty much publish a message to any external application that is capable of receiving messages over the HTTP channel. Once a HTTP pipe is established with an enterprise application, Oracle IoT CS provides an ability to confirm a connectivity test with the application. Once a connection is established, the Streams tab allows selecting a message format available in the IoT application (typically an alert) to be sent to the HTTP endpoint.

Iot-Integration

 

ExternalIntegrationTest

Oracle Process Cloud Service (PCS)

In the information value loop for Internet of Things explained earlier, critical business events often require human intervention. Oracle Process Cloud Service can close this loop as it can ACT on information of interest by bringing people, process and information together. Once a process consumes an event of interest, it can notify a healthcare pharmacist to analyse his or her critical reading.

ProcessNotification

Manage Health Alert Process

One of the main challenges in device to human interfaces is that, although users have the smart devices, they minimally follow the suggested course of action and, eventually, the devices end up serving as shelfware. The Manage Health Alert Oracle Process Cloud Service process, shown below, provides an ability to integrate processes that involve devices, applications and require human intervention. The PCS process outlines a map that facilitates patient-pharmacist-medical practitioner interaction. The process allows:

  • Review of critical and historical readings for detecting any existing patterns to rule out health related red-herrings.
  • Pharmacists to reach out to the patient or their emergency contacts to inquire about their well being or possibly do a tele-health check.
  • Automatically schedule consultation and appointments with a physician detailed check.
  • Reviewing or renewing prescriptions for the patient and delivering it to them.

These are just a few among many potential human to human interaction use cases made easy through IoT and PCS integration.

PCSProcess

Just like its on premise sibling (Oracle BPM Suite 12c), Process Cloud Service provides an instance tracking console to view and manage live instances. The console provides a detailed graphical and activity audit trail along with an ability to act on touch points that requires human intervention.

PCSTaskFlow

Oracle PCS provides basic HTML5 based web forms which can define the user interface allowing end users to interact with business processes. The form composer provides an editor for creating basic forms that can present information based on the data elements defined in the process. We created the following form for pharmacists to review a critical reading for a patient in order to determine the next course of action. The data captured from an end user in the form acts as a decision point that can trigger alternative process paths.

PCSForm

 

Reporting and Dashboards – Utilizing Oracle Database CS, Business Intelligence CS and Data Visualization CS

Exploratory Data Analysis is the process of sifting through the data to get a sense of whats going on. Extracting insight from data requires analysis, the fourth stage in the Information Value Loop. A derived insight is a consumable piece of information that can be used to make decisions based on current events or make future predictions. A simplified reference architecture pattern to derive analytical reporting from IoT Cloud Service is presented below:

  • Structured data can be stored in transactional or historical data marts.
  • Unstructured data can be stored in distributed file based databases storage platforms.
  • From a reporting layer perspective, there are multiple solution components that can be used such as Apex reports, Oracle BI and Data Visualization dashboards, business activity monitoring dashboards, etc.

IoTReportingPattern

Of the many different reports that can be built to compliment the above solution, we built a few to aid the medical practitioners to dig into a patient’s health reading over a period of time to assess the abnormality over a time range. The following report created in Oracle Database Cloud Service (APEX) tabulates the reading of a patient over a month. This can be accessed as a link and by providing arguments from a PCS form link.

ApexReport

There can be various renditions of the above information the most common of which is a bar chart of systolic and diastolic pressure and pulse rate average each day over month. The histograms can visually highlight up or down trends in blood pressure over a period of time which can be useful to detect spikes/troughs over a baseline.

IoT-Apex-Chart

Anonymizing Patient Data

The last solution that we built to support our use case was to sanitize the patient health readings by removing personal and confidential data and presenting the information in a statistical way that could benefit national/state government health record keepers. How do we do this? Comes Oracle Data Visualization Cloud Service (DVCS) to our rescue. With the blood pressure reading streamed and sent to Oracle BICS from IoTCS, we built a Custom Points Map to the coordinates from where the readings were taken onto a geographical map. This resulted in a heat map showing regions/places with susceptibility to critical blood pressure patients. This sort of anonymized data is immensely useful for government health agencies to plan for aid work and improve the ability to respond faster to critical conditions.

DVCSChart

To Sum it All Up

Transferring healthcare monitoring from hospitals to the home is disrupting traditional models of healthcare delivery. The positive implications of an IoT ecosystem in healthcare are numerous—from remote patient monitoring to predictive analytics—and can result in improved population health management. While this may seem like a futuristic daydream to those on the sidelines, leaders in the healthcare industry are already integrating IoT devices to improve healthcare. The speed to value at which use cases like the one covered in this detailed blog can be realized with little to no infrastructure setup cost using a combination of Oracle PaaS services is unprecedented.

There are a number of other potential use cases such as traffic incident monitoring, pest management, smart homes, smart parking management and other industrial applications that can be realized using a similar architectural pattern. The speed to value at which these solutions can be prototyped and productized using the Oracle PaaS Cloud service is remarkable and the Hackathon was great example of how complicated end to end solutions can be developer with ease.

If you would like to know more about the use case or technical details of the cloud services that we used, please feel free to leave your feedback or comments.