The “Skydiver” Pattern

This approach to demoing Corticon employs two (apparently) simple rules which turn out to be both ambiguous and incomplete.

For example

Rule 1 “Applicants who skydive are high risk”

Rule2 “Applicants under 35 are low risk”

 

The rule model can be built from scratch in a matter of minutes to illustrate how EASY Corticon is.

The ambiguity checker and completeness checker can be used to illustrate how Corticon helps to ensure that the rules are CORRECT.

By running the mass update function in Rollbase on a large number of records you can show how FAST Corticon is.

You can illustrate RAPID APPLICATION DEVELOPMENT by building a Rollbase app  in about 18 mouse clicks by importing the CSV file that contains the sample data. Though actually connecting the Corticon decision service requires writing some javascript. But you can copy/paste most of this.



The Demo “Kit”

For the complete set up and running of these you will need:

  1. The Rollbase XML export file
  2. The Corticon rule model
  3. The appropriate image file for the header
  4. The CSV files (if you want to build the Rollbase app from scratch)

 

See appendix A for a step by step guide to creating a working Rollbase app in 18 mouse clicks.



Original Skydiver (Insurance Risk)

The Use Case

Determine insurance risk based on the applicant’s age and whether they skydive.

The Application

The Rules

 

Advertising Customer Status

The Use Case

Determine the status of advertisers based on their annual spend and number of ads placed.

The Application

The Rules

 

Medical Claim Processing

The Use Case

Determine whether the medical claim for surgery should be paid based on the cost and the type of surgery performed

The Application

The Rules

 

Employee Leave Approval Application

The Use Case

Determine eligibility for leave based on months employed and reason for leave.

The Application

The Rules

 

Temporary Assistance for Needy Families (TANF)

The Use Case

Determine eligibility for welfare assistance based on age, whether living with a relative and whether still in school.

The Application

The Rules

 

Appendix A How to Build a Rollbase  App in 18 mouse clicks

Make sure you have a CSV file with all the fields you need. One field should identify the record

1 - Setup

2 - Applications

3 - New Application

4 - Enter name and save

5 - Add a Tab

6 - From external metadata (select CSV file)

7 - Choose Spreadsheet

8 - Browse for CSV file and choose name for Objects

9 - Map the name field of the spreadsheet to the Object and then Create

10 - Return to New Application

11 - Go to Object Definition

12 - Select Views

13 - Select All Objects

14 - Edit

15 - Configure the columns you want to see

  

16 - Save

17 - Return to Application

18 - Application is ready

 

 

Connecting to Corticon

Right now you must create three things in Rollbase in order to invoke a web service such as Corticon:

  1. Create a SOAP template – specifies the payload to be sent to Corticon
  2. Create a Request Trigger – this sends the SOAP payload to Corticon
  3. Create a Response Trigger – this extracts the results from the response payload

This will all be automated in the coming months

Soap Request Template

This specifies what Rollbase fields are to be passed into which Corticon attributes.

You can get the format for this file by exporting the SOAP from the Corticon tester

 

Soap Request Trigger

HTML Post

Soap Response Trigger

You will also need to write some javascript to scan through the response SOAP payload to map the Corticon attribute values back into the Rollbase objects and fields.

It makes use of statements like this to set the Rollbase field  risk_classification in the object called patient to the text value of the node corresponding to the Corticon risk attribute

if (element.getNodeName()== 'ns1:risk') {rbv_api.setFieldValue('patient', {!id}, 'risk_classification', element.getTextContent);}

 

The full javascript for this is in Appendix B.

The sequence in which the triggers get executed is defined in the Trigger section:

  

So you can execute many Corticon decision services if necessary.

You can even make the execution of these triggers conditional by using this section:

  

It might even be that a Corticon trigger is executed based on the result returned by a previous trigger that invokes Corticon.




Javascript to process the Corticon response

Things to check:

Spelling and case of elements in the Corticon response

Spelling and cases of the references to Rollbase objects and fields (use the integration names)

You can use Debug in the trigger to locate any problems.

Limitations.

There are some limitations, but this should be enough to demo the concept without spending days coding javascript

  1. This does not currently handle complex objects with associations.
  2. It only returns the first rule statement message – one way around this is to create a field that contains concatenated messages that are set in the action of a rule.

Javascript

var code = rbv_api.getSharedValue("ReturnStatus");
var body = rbv_api.getSharedValue("ReturnBody");
if (body != null && body != '') {
    var root = rbv_api.parseXML(body);
    var nodes = root.getChildNodes();
    // soapenv:Body
    for (var k=0; k<nodes.length; k++) {
                var child = nodes.item(k);
                var nodes2 = child.getChildNodes();
                // ns1:CorticonResponse
                for (var m=0; m<nodes2.length; m++) {
                      var child2 = nodes2.item(m)
                      var nodes3 = child2.getChildNodes();
                      // ns1:WorkDocuments
                      for (var n=0; n<nodes3.length; n++) {
                               var child3 = nodes3.item(n);
                               var tagE = child3.getNodeName();
                                if (tagE == 'ns1:WorkDocuments') {
                                      var nodes4 = child3.getChildNodes();      
                                      for (var o=0; o<nodes4.length; o++) {
                                                var child4 = nodes4.item(o);
                                                var nodes5 = child4.getChildNodes();
                                                var tagA = child4.getNodeName();
                                                if (tagA == 'ns1:Patient') { // Corticon entity name
                                                          for (var p=0; p<nodes5.length; p++) {
                                                                var element = nodes5.item(p);
                                                                var tag = element.getNodeName();
                                                                var value = element.getTextContent();
                                                                if (tag == 'ns1:risk') { // Corticon attribute name
                                                                rbv_api.setFieldValue('patient', {!id}, 'risk_classification',value); //value must match picklist         
                                                                            } } } } }
                                                                // should use attribute's ref instead but do it quick for now
                                                                if (tagE == 'ns1:Messages') {
                                                                    var nodes4 = child3.getChildNodes();        
                                                                    for (var o=0; o<nodes4.length; o++) {
                                                                        var child4 = nodes4.item(o);
                                                                        var nodes5 = child4.getChildNodes();
                                                                        var tagM = child4.getNodeName();
                                                                        if (tagM == 'ns1:Message') {
                                                                            for (var p=0; p<nodes5.length; p++) {
                                                                            var element = nodes5.item(p);
                                                                            var tag = element.getNodeName();
                                                                            var value = element.getTextContent();
                                                                            if (tag == 'ns1:text') {rbv_api.setFieldValue('patient', {!id}, 'rulemessage',value);}
      }}}}}}}}

NOTE: only one message is retrieved

Other Rollbase Corticon Applications

Diabetic Monitoring