Skip to Content
Author's profile photo Murali Shanmugham

Capture event streams from IoT devices and perform predictive analytics using HCP – Part 6

This blog is part of a series which is related to setting up Smart Data Streaming, IoT Services & Predictive Services.

HANA Cloud Platform – Using IoT services, SDS & Predictive services

In the previous blog post, I showed the steps involved to setup Predictive services on HANA Cloud Platform. In this blog, I am going to use the Predictive services on top of the IoT sensor table which is accumulating sensor data pushed via HCP IoT services & Smart Data Streaming.

Before proceeding with using the Predictive services on HCP, ensure that the java application “aac4paservices” has the status Started. Launch the application using the URL shown in the Overview menu

The API documentation section will be of great help to all developers. It comes with complete documentation of all the APIs and also provides the option to test the APIs.

The next thing you must be wondering is where we do the actual work with APIs.  This is where a REST client comes into play to test the service. I have used Postman client as it is embed within Chrome and I find it easier to see network traces. Once you have tested the APIs, you can then incorporate it within your HTML5 or java programs.

Apply predictive analysis to sensor table

In the previous blog post, I have used a table called SENSOR01 where all the sensor data from an IoT device is being collected via HCP IoT services & Smart Data Streaming. I don’t have a large data set, but I have got about 408 records to just showcase how the REST APIs work.

To use the Outliers API, change the info as below in the REST client

Operation: POST

URL: https://aac4paservices<accountname>.<HCP Landscape>/


"datasetID": 26,
"targetColumn" : "c_temp",
"numberOfOutliers" : 2


In the datasetID, I provide the value of the dataset obtained earlier and I have specifically indicated to apply the analysis on column “c_temp” which holds temperate data from the IoT device. I have also indicated to show only top 2 outliers.

Below is the response. You can see the output of the Outliers analysis provides with me with the top two temperatures which appear to have deviated from the rest of the data points. This information can be used to further analyse the root cause.

Consuming the REST APIs in WebIDE

I can take this API and now use it within my SAPUI5 application within WebIDE to be able to visualize the analysis in a table format.

I had to create a destination in the HCP cockpit which refers to the below URL

https://aac4paservices<accountname>.<HCP Landscape>/

In the neo-app.json file, I added the destinations which can be used in the controller.

Below is how a sample output would look like when I try to view all the outliers provided by the REST APIs.

In this blog I showed how easy it is to enable Predictive services on HCP and use it in your applications. When dealing with streaming data in real time, sometimes, we need to be able to apply such a predictive model on the fly to capture such trends and action on them. This is where the scoring equation service comes handy. You can use scoring equation APIs to build a model which can be applied on streaming data and predict in real time.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Frank Schuler
      Frank Schuler

      Hello Murali,

      thank you for this excellent blog.

      I am trying to consume the HCPps API from a Fiori Overview Page Application, but the Data Connection configuration fails because it requires an $metadata endpoint to inspect the service.

      Is this possible with HCPps? If not, could you share the code of your SAPUI5 application where you display the outliners?

      Very best regards and many thanks in advance


      Author's profile photo Murali Shanmugham
      Murali Shanmugham
      Blog Post Author

      Thanks Frank,

      I havent tried using these HCPps APIs with Overview pages. There is a Technical Academy video which shows how to consume these APIs in WebIDE Apps –