When I was a young kid, I enjoyed looking at the pictures in a book and trying to guess what the story might be about. It’s not always possible to ask someone to read the book for you, but those pictures can usually tell the story. The text below is part of the Persian epic Shahnameh by the Persian poet Ferdowsi (10th century):
One needs to know the language to read the poem, but you may have guessed the story just by looking at the picture. This is the tragedy of Rostam and Sohrab - a father and his son who had never met before and were forced into a battle against each other. Unfortunately, they found out about their relationship when it was too late.
In the world of data, we use visualizations for the same reason: to tell the story. It’s much easier to understand what’s going on by looking at a nicely visualized dashboard or report rather than the raw data, isn’t it?
KNIME Analytics Platform already includes powerful visualization features. The KNIME Views extension, for example, provides several types of interactive charts which can be assembled into composite views as dashboards or Data Apps.
For static reports, BIRT (Business Intelligence Reporting Tool) is already integrated into KNIME. Although BIRT is a great reporting tool, it can be difficult to master due to its complexity. With the release of the KNIME Modern UI, which has simplicity, functionality and beauty at the same time, what if we could also have a new easy-to-use reporting feature? Such a feature could have a proper harmony with other existing KNIME capabilities - and would make the generation of hard-to-create static reports a piece of cake.
Well, the feature we just described is here! The recent release of KNIME 5.1 includes a new KNIME Reporting (Labs) extension that allows you to take the composite visualizations you build and render them into static PDF reports quickly and easily. The best part of this new feature is you don’t need to learn anything new; all you need is what you are already familiar with, plus enabling report output in the layout settings of a component with a view. Then, you will have a new report output port which can be connected to the Report PDF Writer node to generate a PDF file.
Let’s take a look at how it works!
To provide an example of the new KNIME Reporting (Labs) extension, we will build a CO2 emissions report, focusing on the highest producers of CO2 emissions in the year 2020. To do so, we will create a workflow that generates one page of the report for each country, limiting our report to the top 3 countries.
We will use the open source data from the World in Data project. This data encompasses information on countries, years, CO2 emissions, and emission sources.
Inside the data pre-processing metanode, we will read and clean up the CO2 data. We limit our data to the period from 2000 to 2020, and select only the countries with the highest emissions in 2020 (China, the United States, and India).
Since we would like to create a report where each page represents the statistics for one country, we use the Group Loop Start node to iterate over countries.
After the data preprocessing is done, we are ready to continue with the next step: building the report. We will display a few visualizations, a table view, and text views in our report. Let’s take a look inside our component to see how it’s done.
With the release of 5.1, the new HTML column type was introduced, enabling us to apply styling to our text and render it as HTML. Inside the “Add growth” metanode, we use the Column Expressions node to change the text color of CO2 values.If the growth rate of CO2 emissions is positive (“+”), then the value will be displayed as red. If the growth rate is negative (“-”), then the CO2 emissions in the country are decreasing, thus these values are displayed as green. Another interesting feature released with the version 5.1 is the Text View (Labs) node. By using this node, we add the name of the country as the title and the footnote at the bottom of each page.
After we finish all of our table and views, we wrap our visualizations and table inside of the component and "Enable Report Output" in the Layout Editor. If we preview the output of the component, we will see the first page of our generated report.
To close the loop, we will use the Model Loop End node. This node converts the model into data cells and collects the results into a data table. To concatenate all pages that we have generated, we use the Report Concatenate (Table) (Labs) node.
The last step of the workflow is to export the pdf report. To do so, we use the Report PDF Writer (Labs) node where we specify the output location (path and file name) of the file.
And that’s it! with the new KNIME Reporting (Labs) extension, it’s very easy to generate static PDF reports in KNIME. You can download the extension and give it a try to see how it works.
Want to see more example workflows of the new KNIME Reporting (Labs) extension? Check KNIME Community Hub.
The team is committed to continue working on this extension to bring it out of KNIME (Labs) in a future version. More work will go into adding more functionality around advanced styling, supporting more output formats or the ability to embed additional charts, e.g. created by Python or R. At this point we are interested in your feedback and ideas here. Also, if you have questions along the way, be sure to ask on the KNIME forum.
We’re excited to see the new reports that will be created with the KNIME Reporting (Labs) extension! What will you create? Please add the “KNIME Reporting” tag to your workflows and share them on KNIME Community Hub.