This month marked the 10th annual EclipseCon. I was able to attend and talk about BIRT with the community and show off some of the cool things we’ve been working on at Actuate.
One of the main themes that I was able to contribute to was the Internet of Things. If you’re not familiar with the Internet of Things trend then take a look at Eclipse’s February newsletter.
To showcase how BIRT can be used within this emerging trend we partnered with Eurotech. Eurotech is a European company that, among other things, manufactures sensors that can be used to measure environmental data in a given area. For this project, Eurotech provided sensors that measured population, carbon dioxide , temperature, and other environmental data points that I used to build a dashboard to compare historical trends during EclipseCon. You can view the finished dashboard on our demo server.
The finished dashboard showcases how you can take data from several sources, combine them into one design, and extract meaningful correlations that otherwise wouldn’t exist if the data wasn’t able to be aggregated in the same place.
In this blog I’ll walk you through the steps I took to go from a new design to this dashboard.
At a high level, this project contained four main steps.
1. Create a POJO to be used as my Data Source
2. Create a Data Object that makes use of the POJO
3. Creating the design
1. Creating the POJO
Before anything can be designed we need access to the data. In several scenarios, any one of the ODA’s included in the designer can be used. For this project we had some non-traditional data that needed to be retrieved from Eurotech. This leaves us with two options. We can either create a scripted data source or create a POJO. I decided that a POJO would best meet the needs of this project. I won’t be covering the POJO creation in detail, if you’re new to building a POJO as a data source then take a look at this devshare.
Eurotech provides a library in maven that I was able to use for the data retrieval, the documentation can be found here. By making use of the Eurotech API’s which implement Kura, I was able to make simple calls to the Eurotech hardware and retrieve the historical data by passing it which sensors I wanted, the max records, and how many seconds in the past to retrieve from. Once I had access to this data I only needed to place it in an ArrayList as described in the above devshare.
Now that the data has been retieved from the eurotech hardware I can choose to use it as-is or I can perform any calculations I might need so everything is ready for me before it gets to BIRT. In this case I had to decide how I would show data points in the same chart that could have values with a difference as much as 1,000 on greater. To keep the scale of these data points I normalized the data using
normalizedValue = (currentValue – minimumValue) / (maximumValue – minimumValue)
This returns a value between 0 and 1 which allowed me to show in the bottom chart how each data point acts on the other.
2. Creating the Data Object
After the POJO has been created we now need to make a decision that will affect the deployment of the design. While the POJO can be used in Open Source BIRT, I decided to use iHub3 which brings in Data Objects. Creating a data object instead of the alternative gave me several features that can directly the impact the performance of the finished dashboard. The main feature I want to call out is scheduling. By creating a Data Object I can schedule the Data Object to generate every x minutes and point my design at the resulting data file. This means instead of several clients trying to pull data from the same server at once I can make sure only one client is pulling, aggregating, and returning data. In this case that client is iHub3.
Creating the data object is just as easy as creating a data source and data set in the designer. You create a POJO data source pointing at the JAR’s, create a data source, and publish the data object to iHub.
If you’re viewing the source to this project then you’ll notice I’ve also created a second data object called currentvalues.datadesign. This data object isn’t scheduled because it needs to grab the current values that you see centered around the logos. Since this isn’t performing any calculations and is only pulling data with a maximum of 1 record I determined it’d be best to allow several client connections for these data points.
3. Creating the design
Now we have data! This is where the real fun starts, creating the design. Since we’ve already gathered the data in the POJO and performed our calculations on it, this report is very straight forward. The basic concept is I have one large grid that contains everything you see.
I created 7 line charts that show how that data point compares to the previous days, next to those charts are the current values. Then at the bottom is where I used the normalized values to compare how the data interacts on itself. I also added marker ranges so we can see when people are in sessions and at lunch. Using this format we can quickly see trends such as particulate matter, CO2, and population all tend to rise and fall together.
Alternatively, I could have created an actual dashboard in BIRT Designer Pro. To do this I would have created several reports and pulled them in as reportlets to help increase the flexibility and performance of the design.
This might be the easiest part, which is good because after you do all this work you want to get it up and running, maybe even brag about what you’ve just created to your coworkers a little bit. I created three viewers in the background that render the report every 55 seconds. Once one viewer is done rendering then I switch over and allow the last one to start rendering a new report. This creates a seamless experience that has no visible load time.
To recap, to create this dashboard, I had to create a POJO to retrieve the data from the Eurotech hardware, create a data object and schedule it, create the design with the items I want to display, and deploy the dashboard using the JSAPI.
Have you created any cool IoT projects using BIRT? I’d like to hear about them in the comments section! If anyone has any question on this project then feel free to ask in the comments, in the forums, or a PM.