Tuesday, September 8, 2020

Leveraging Custom Data Actions Plugins in Oracle Analytics

Data action plug-ins leverage the data actions framework to provide custom, data-driven actions that are integrated into Oracle Analytics. You develop your custom data action using Oracle Analytics Desktop and then deploy your data action to Oracle Analytics. This video will help understand the usage and the value of custom Data-action plugins and will walk you through the structure of the generic plugin that OAC PM team created to help accelerate your exposure to this functionality.  Download the latest version of this plugin from the Oracle Analytics Library

Leverage the following docs to build your own custom data action plugin as well a detailed tutorial.   

Official release doc




Wednesday, August 26, 2020

Embedding Oracle Analytics Dynamically - Part II

This blog is a part of the 2 part blog series on embedding Oracle Analytics content into an External portal. In the first part, we explored how to embed visualizations from a project into an external web portal, with the ability to pass filter values from the web portal down to the embedded Oracle Analytics visual. In this second part, let's see how to set-up an interaction directly initiated in Oracle Analytics visual, and sent to the external web portal. This will represents the other way of configuring the communication. This ability to communicate both ways makes the embedded visual, dynamic and interactive, making it very useful in data analytics context.

Oracle Analytics Data Actions can be included as a part of the embedded visualization, that is the feature we will leverage to let Oracle Analytics initiate actions into the host web portal. We are going to use a particular data action type called "Publish Event" in establishing the communication from the embedded Analytics content to the external web portal. When the Publish Event data action is invoked on, it enables external applications to directly receive context from the Analytics visualization . The word context here means the set of data elements values at the selected location in the visualization. 

In the first part of the blog, our web portal looked something like this
We will be using the same and will be enhancing this further by adding the Publish Event data action for the Analytics Project. To create a Publish Event data action, we should follow the following steps.
  • Login to your OAC instance and navigate to the Analytics project embedded inside our website 
  • Click on the hamburger icon towards the top right corner and choose the option "Data Actions"
  • Click on the "+" symbol to create a new data action 
  • Give it a name and choose the type of the data action as "Publish Event"
  • Event Name is an unique name for the event a user should enter. This is passed when the context event is published. User can choose to AnchorTo data element(s) and choose Pass Values, and specify what data element values to be passed when data action is clicked

Click on Save to create the Publish Event data action.

A page refresh is needed on our website for the changes in embedded content to kick-in. Now when a right-click is performed on the embedded visual, it displays all applicable data actions and the "Embedding DA1" data action of the Publish Event type will also be part of the options. When this data action is invoked, it passes the following information to the navigation action service

In our case 
event Name = "Event from DA1"
event Type = "oracle.bitech.dataAction"
payload = a json object containing the values of rows and columns that was selected during the right click action

Event Type
The navigation action service raises an event type called "oracle.bitech.dataaction" which is a generic event type for all data actions of type Publish Event. So for a third party/ external website to make use of this event type, it needs to do the following
1) Subscribe to the publish event called 'oracle.bitech.dataaction'
2) Define an event listener and an event callback for the event

Payload Format
The payload information that is getting passed through the publish event data action is a JSON object with 2 attributes.

  • The context property has all the information about the columns and it's values that was selected during the right click action.
  • The contextv2 property has the information about the remaining context like the filters the embedding visualization is listening to. This might be canvas/project/listbox/viz level filters.
For example, to get the list of filters the visualization is listening to, we can use the following code snippet:

This will list down an array of filters the visualization is listening to. If the array length is more than 0, we can get the column name and the values being used as filter by querying the filterModel.

    oFilterModel.getDataElement().getColumnID() -> Column Name used as filter
    oFilterModel.getSelectedValues() -> Filter Values

These methods are specific for list filters. For other types of filters the methods might vary.

Now having all this information, we will update our website to include the Publish Event data action and to capture the context of selection sent to our website.
There is a separate <div> tag included in our website to catch the data that is being sent from the embedded viz. 

By default, it shows that there is no data received from the embedded viz. But once the Publish Event data action is invoked, this text will be replaced with the information sent on the payload from the data action.

Publish Event data action getting invoked

Data captured from data action

We are now able to capture the information sent from the embedded viz. The modifications to our web portal code to listen to the publish event data action is as follows.

In this example we are printing the context inside a <div> tag but it can be extended further as required.

Thanks for reading

Thursday, August 20, 2020

Mask or anonymize sensitive data in Oracle Analytics


In the world of data driven decision making, analysts and managers should ensure appropriate privacy controls by restricting access to certain sensitive information in their data. Many times analysts work with sensitive information data like SSN (Social Security Numbers), CCN (Credit Card Numbers), Patient Names and so on. This data details should be masked before becoming available for further analysis and ability to easily mask data is of prime importance in an Analytics solution.

Oracle Analytics offers powerful data preparation capabilities and includes features that allows anonymizing or masking sensitive information. In this blog, let us explore different ways in which we can achieve this:

1. Using recommendation Feature
2. Using ObfuscateUpdate() Function
3. Using Regular expressions

1. Obfuscate using Recommendation feature

When a dataset is uploaded in Oracle Analytics, the system profiles the data as a first step. As part of this profiling process, the recommendation engine identifies columns that contain sensitive information and offers a recommendation to obfuscate it. Let's say you upload a dataset containing SSN data. The recommendation engine identifies this as sensitive information and offers a few recommendations that allow you to obfuscate or delete this data. 

When clicking on the recommendation ** Obfuscate ssn, a step is added to the Preparation Script and the data is obfuscated. 

This recommendation capability is currently leveraging a 'knowledge reference set' that is Oracle-Analytics-Vanilla list of recommendations. For example, it may not recognize social security numbers of every countries in the world. However very soon, the product will support uploading custom knowledge reference, which will enable administrators to tune the automatic recommendations that the product delivers.

2. Obfuscate using ObfuscateUpdate Function

There are instances where you may want to obfuscate data that has not been automatically identified by the recommendation engine for obfuscation. For instance, you may want to obfuscate a birthdate in your dataset. The recommendation engine will not identify this column for obfuscation. In order to manually apply obfuscation, you can use the ObfuscateUpdate function in data prep. 

This function has the signature ObfuscateUpdate(<column>,parameter). The Parameter can be 'ALL', 'FIRST_5_DIGITS' or 'FIRST_12_DIGITS'.

a.Obfuscate Parameter | ‘ALL’

In this dataset, column ‘birthdate’ is not automatically identified for obfuscation. We can still mask it by explicitly invoking the  ObfuscateUpdate function. 
Edit the colum and add a function ObfuscateUpdate(birthdate,’ALL’)

b. Obfuscate Parameter | ‘FIRST_5_DIGITS’ and ‘FIRST_12_DIGITS’

In addition to the ALL parameter, it also accepts ‘FIRST_5_DIGITS’ and ‘FIRST_12_DIGITS’ as options. These parameters are applied only on digits within the column and not to text. . Let's say we want to obfuscate the first 5 digits of the ccexpires column. The column data for example is 12/2015 and if you mask the first 5 digits, it changes from 12/2015  to ##/###5.


Similarly, if you want to obfuscate 12 digits you can set the parameter to TFIRS_12_DIGITS

Note that when you use any other parameters other than ALL, FIRST_5_DIGITS, FIRST_12_DIGITS, the function does not throw any error but returns a blank value. 

3. Using REGEX: More options to Obfuscate data

If we need to obfuscate specific number of digits(other than 5 and 12) , using a Regular Expression is an option. A regular expression (or regex) feature is available as part of "find and replace" feature of a column. Regex is a sophisticated feature with many use cases and is not limited to masking. You can read the following blog post (link) to understand regex feature more. 

Using REGEX | Mask all characters

Edit the column that you want to change and choose replace. 

Select 'Use regular expression' and use the following expression
  • In String to replace use “.”
  • In New String use “*”
All characters are replaced by *

Using REGEX | Mask all characters and show same number of characters in each row

In the above example, the number of characters in each row can guessed by counting number of *. If you do not want to show the length of the string, use the following expression

    • In String to replace use “^.*$”
    • In New String use “*****”

All the rows look the same “*****”

Using REGEX | Mask first n Characters

If you want to mask only first 4 characters, use the following expression

    • In String to replace use “^.{1,4}”. Replace 4 with any number you want.
    • In New String use “****”. Note: If you are replacing 4 characters use ****.

Using REGEX | Masking last n characters

    • In String to replace use “.{1,3}$”. Replace 3 with any number you want.
    • In New String use “***”. Note: If you are replacing 3 characters use ***.


Obfuscation feature is highly useful to all analysts who want to mask data quickly without resorting to complicated techniques. Oracle Analytics offers different mechanism to achieve this need.