Apama Advent Calendar - 16 Dec 2021 - The Analytics Builder Block SDK and Custom Blocks


Yesterday, on Day #15, we covered the use of EPL within Cumulocity IoT. One of the cases we mentioned was for adding custom blocks for use within the Analytics Builder (which we talked about on Day #3). Today we’ll talk about how you can do that through the use of our public SDK.

Blocks in the Analytics Builder

First, let’s briefly remind ourselves of the part of the Analytics Builder UI relevant to blocks. You enter the Analytics Builder via the Streaming Analytics application and are initially presented with a grid of cards showing all the current models. Clicking on a card or creating a new model will take you into the canvas for editing models. If you have clicked on an active model, the canvas will be read-only. On the left side of the canvas is the palette. This is where the UI lists all the blocks available for use within the Analytics Builder, and documentation for each of them is available in the expandable sidebar to the right of the canvas. The blocks are split into several default categories covering general functional areas.

Sometimes these blocks will not be sufficient to implement the analysis you need. In many cases you can construct a network of blocks that will achieve this which can then be grouped together, reducing the clutter on the canvas. However, groups can only be shared by copy-pasting and do not have properties at the group level analogous to the properties you can set for individual blocks. Thus it can be useful to create custom blocks, if a group will be used repeatedly in different models, or if the specific or specialized analysis you need cannot be achieved by combining the existing blocks.

The Analytics Builder Block SDK

The creation of a new block requires knowledge of EPL and of a framework interface that must be adhered to for your block to interact correctly. To make this as easy as possible Software AG has produced The Analytics Builder Block SDK, publicly available from GitHub.

The SDK documents how to create, test and deploy a new block, as well as providing the tools to achieve these tasks. There is also a set of several sample blocks with their associated tests to provide concrete examples of block implementation and testing (using the same PySys techniques that we covered on Day #9).

For an alternative guide to creating your own blocks a couple of our engineers, Kusuma Kumari and Mounika Konathala, created this blog post with screenshots to describe the process using Software AG Designer.

These resources will enable your EPL writers to produce your own documented and tested blocks for the use of your less technical domain experts, enabling them to quickly roll out new complex data analytics.

Community Blocks

But wait, there’s a little bit more. You may not need to create your new block from scratch, or at all. Software AG has also created a GitHub project containing blocks created by others during the course of working on specific projects. Some of the more generic of these can be found fully supported in more recent versions of the Analytics Builder and we would recommend using these when available. Some are convenience blocks, such as the NAND block which could be created by wiring together an AND and NOT block. There is also a useful selection of simulation blocks which can aid in testing a model.

Custom blocks are not part of the supported product, so please do ensure you are happy with their correctness and performance before relying upon them. Nevertheless, they do allow analysts to create models capable of almost any analysis without themselves having to write any code.

Today’s article was kindly provided by Nicholas Adams from the Apama engineering team.

This is Day #16 of a short series of brief tips, tricks, hints, and reminders of information relating to the Apama Streaming Analytics platform, both from Software AG as well as from the community.
This series of articles will be published Monday-Friday only, with the occasional weekend bonus.