Tag: Oracle Policy Modeller

Custom JavaScript Extension Places and Custom Options List

Custom JavaScript Extension Places and Custom Options List

This is the last in the series of posts about Google Maps and Oracle Policy Modelling for now. I’m conscious of the fact that there are lots of people out there who have more knowledge in JavaScript than I have, so I don’t pretend to provide anything more than “sketches” or “ideas” or “rough hacks”. But I hope you enjoy them anyway. This last post is all about a Custom JavaScript Extension Places and Custom Options List. We will use the basic principles of the previous examples and extend :

  • Display a Map
  • Geocode and Mark
  • Show an Infowindow
  • Find places in a certain radius
  • Display them in a Custom Options list

And this time we will use the Places API to get a list of information from Google, before displaying it in the Screen and using the information. Here is the scenario:

  1. You have a problem (fire, accident, police or flood or what have you)
  2. You are at a specific location (geolocalised)
  3. You need a list of people who can help (for example, a list of car repair workshops, or fire stations, or whatever).

This might fit into the scenario of an assistance company which wants to help you, by pointing you to the nearest garage or hospital or whatever. This uses the Google Places API. When you search it, you get a list of places – garages, hospitals or whatever. You set the starting location, define the radius in metres, and the type of search. The results come back as a list of places, which you can parse and add to your Oracle Policy Modelling screen as a Custom Options list.

So here is the lowdown.  The key to the Places search is in the request, as shown below:

var latlngnew = {
 lat: interview.getValue("cl_lat"),
 lng: interview.getValue("cl_long")

var request = {
 location: latlngnew,
 radius: '50000',
 type: [interview.getValue("cli_search")]
 var service = new google.maps.places.PlacesService(map);
 service.nearbySearch(request, callback);

In the example above you will note that there is an Oracle Policy Automation attribute value to define the type. For example, the “accident” option in the first screen:

OPA 12 - Custom JavaScript Extension Places and Custom Options List 1

Google Maps API Places Search uses type to distinguish what to look for. The mapping I made is just for fun, but bear in mind you might not find a single type that meets your needs, or you might not find any kind of match at all. The 50,000 is the number of metres for the search radius. You might get that from another attribute in Oracle Policy Automation, of course. Plus of course, there are the two attributes in which we have captured the latitude and longitude sent by the Browser.

In the callback function, we receive (hopefully) some results for our Custom JavaScript Extension Places and Custom Options List. The results are tidied up a bit, since the Oracle Policy Automation Custom Options Extension wants text and value properties (in case you want to have display values that are different from the actual values that will be stored in the receiving attribute). Finally the result is passed to the interview.

Custom JavaScript Extension Places and Custom Options List 2

Over in the Custom Option JavaScript file, we just need to grab the data from the Places API and display it as a searchable combo.

OPA 12 Custom JavaScript Extension Places and Custom Options List 4

So the end result of our Custom JavaScript Extension Places and Custom Options List exploration is that the list of providers displayed is based on the type of problem, and the location of the device. So hopefully the list of suppliers / fire stations / hospitals / police stations or whatever is pertinent.

As usual the very unpretty code, for entertainment purposes only, can be downloaded from the OPA Hub Shop. The next few blog articles are going to be on very different subjects than the JavaScript extensions, but I’m sure we will come back to these concepts often. Have a great day!

NB : Remember to test this using your favourite real Browser, not the embedded Browser : run the Debug with Ctrl+F5.

Guest Post : The Lazy Expert

The Lazy Expert

Firstly thanks to Richard who encouraged me to move forward and start blogging alongside him; just like a very good, loyal and trusted old friend that he is.[Richard’s Note : less of the “old” please :)]. When he asked if I had any immediate ideas for a blog, the first thing that came to my mind is the analogy that I have always used during so many of my OPA class teaches over the years, “Lazy Expert” and, bingo, that is the title for this post.

This now begs answering the question, why in the world a “Lazy Expert”? Particularly when OPA does so many things so very well. I do hope that you will agree with me in a few moments from now.

What does Lazy (as an adjective) mean?

The Oxford Dictionary says;

Unwilling to work or use energy

The Cambridge Dictionary is a little more elaborate;

Not willing or not wanting to work or use effort to do something

Who is an Expert?

Oxford Dictionary is all praise for someone who is an expert;

A person who is very knowledgeable about or skillful in a particular area

Cambridge Dictionary is not far behind with its own version of praise;

A person having a high level of knowledge or skill in a particular subject

The OPA Analogy

It is not difficult to imagine a person who is an expert and lazy, right? Who wouldn’t want to be? Now, let us see how Oracle Policy Automation is cajoled into doing anything at all…

Building a Rule Model and authoring business rules

The Oracle Policy Modeling tool is used to author business rules, validations, interview screen designs etc. and make sure the subject matter expertise is converted into a reusable repository of rules. It is indeed impressive that these rules can be written in practically unlimited number of languages of which 21 are supported natively (in other words, OPA is syntactically aware of these 21 languages).

This effectively made you, the rule author and the subject matter experts you worked with, the creators who created this expert.
OK, we now have a compiled rule model, the epitome of an expert. But nothing useful can still come out of this rule base archive (.zip file) sitting in a file system, unless we are able to make use of this expertise. The origins of laziness are now clearly visible.

Deploy to a run time

The rule base zip file can be deployed to the policy hub (version 12.x, public and private cloud options) or in the earlier 10.x versions, to a Determinations Server or Web Determinations. It can also be copied into a specific file system folder, targeted at the batch processor runtime or for use by the determinations engine implementation used natively by a Java or a .NET application. Whatever may be the customer’s choice of deployment environment, we have a way of making OPA available. All exciting and so far, all good…

Still nothing happens by itself, right? Policy Hub, Determinations Server, Web Determinations, Determinations Engine API, all of them do nothing with the expertise now embedded into them except, proverbially (or rather notoriously), “wait”. That’s our “Lazy Expert”

Make the expert do our bidding

The Nudge

We need some external trigger or a request before our “Expert” starts applying the expertise and responds with the decision and/or recommendation. The key is in finding the fright trigger that nudges our Expert in the most optimal way. The choice of the run time is critical in extracting the best from our Lazy Expert.

The antidote to laziness

The following table lists the different run-time options available with OPA and the different way sin which to nudge / trigger OPA to provide the expert decisions that it is indeed very much capable of.

OPA Runtime Nudge (Trigger) Possible Scale of Invocations / Volume Typical Application / Solution Architecture Used by (Oracle Application / Integration Adapter)
Policy Hub (Cloud / On Premise) Programmatic Invocation of “Assess” Web Service Millions of hits a day OPA acts as the Server providing the assessment as a service and typically, the client application or the middleware collects all the information necessary for our expert to provide a decision or determine the outcome. OPA Siebel Integration, as used by the Siebel Public Sector vertical solution.



  HTTP(s) URL based invocation of the Interview Service 100s of Thousands of invocations a day OPA, as another Web Application, provides the Interview Session screens using the UI as configured by the rule author. It is also possible to pass additional parameters through the URL, pre-load the Interview session with data from the source application and later persist the data back into the source application itself on completion of the interview and an appropriate assessment is made by our expert. OPA RightNow Connector, which provides an assessment wizard for both the Agent (providing assisted service) as well as to the consumer (who is interested in achieving self-service)
Batch Processor Command line tools invoking the Batch Processor, on demand or easily scheduled for periodic processing Millions of data records per run OPA is run in batch mode against the date that is collected into a set of tables marked for processing by our expert. Simple mapping files tell OPA as to which tables to take in as input and which ones to write into after the expert assessment has been made. A very similar architecture is adopted by the “Oracle In-Memory Policy Analytics product.
Mobile SDK A generic Mobile Application allowing the end user to select and specifically invoke the rule base that they are interested in. 100s of Thousands of Invocations a day A generic / native mobile application, from the respective application store for iOS and Android, connected to a Policy Hub can provide the standalone expert assessments that an end-user needs.


But typically requires custom mobile application development to provide a complete solution that is integrated to another line of business application, ether Hosted or On Premise, for a more complete business solution.

The native mobile application, provided by Oracle in the respective iOS App Store and Android Play Store.
Web Determinations Similar to the Interview Service of Policy Hub Millions of Hits a day Applicable to version 10.x of Oracle Policy Automation runtime
Determinations Server Similar to the Assess Service of the Policy Hub 100s of Thousands of invocations a day Applicable to version 10.x of Oracle Policy Automation runtime

These are so many ways to make our expert work for us and more are being discovered each passing day. With the right Nudge, our Lazy Expert is not so lazy after all!

Coming Soon

Watch this space as we come up with more details on the various adapters and other exciting ways of making our expert work well for us…

The home page for OPA documentation can be found here.

Logo by Southpaw Projects LLC