Introduction
Data Apps provide a user interface to perform scalable and shareable data operations, such as visualization, data import, export, and preview. In KNIME Analytics Platform, workflow developers can build such a Data App without coding, rather by using workflows. They can deploy them to the KNIME Hub where business users can interact with the data without touching the workflow that is working under the hood.
With a KNIME Data App, a workflow developer can control what the end-user can do without losing the complexity of the workflow. Alongside accessing KNIME’s visual programming environment, KNIME Data Apps also provide the possibility to reach out to any number of technologies that are integrated into KNIME’s open ecosystem (scripting languages like Python, machine learning libraries like H2O, etc). Furthermore, through KNIME Hub you can also share your Data App with 5, 10, or 1000 end-users with a scope to monitor and tweak based on feedback.
The aim of this guide is to build your understanding of KNIME Data Apps. You will learn how to build your first KNIME Data App from scratch and deploy it to the KNIME Hub.
Build Your First KNIME Data App
KNIME Data Apps are built using special nodes in KNIME Analytics Platform that allow the user to update the look and feel of each page, build in interaction, and combine multiple pages in the app.
This section provides a step-by-step guide for building and deploying a simple KNIME Workflow as a data app by building a composite view with re-execution capabilities. Any workflow that is built in KNIME Analytics Platform can be deployed as a data app, provided the appropriate components are included. This gives the workflow developer significant control over the data science operations and user interface.
As a starting point, we use the workflow shown in Figure 1 and adapt it to build our first data app. The example workflow demonstrates how to access, preprocess, and visualize sales data.
You can download the initial and the resulting deployment-ready workflow from KNIME Hub. Follow steps one to five to adapt the workflow and build your first data app.
Step 1/5 – Create a Component
The first step in order to create a data app is to encapsulate the View nodes in a component. A component in this context is the basic building block of your data app. In fact, the composite views of all root level components of your workflow will correspond to pages in the data app. This means that if you have more than one component on the root level, the data app will be a multi-page application, and the end-user will be able to navigate back and forth through the pages. To create a component select the nodes you want to encapsulate. Then, click the Create component button at the top of the Workflow Editor as shown in Figure 2. Alternatively, you can right-click one of the selected nodes and click Create component.
If you upload this workflow to KNIME Hub, you can enable other users to start the data app on the browser. The data app will comprise a single page that will show the same view of the component you just created. You will learn more about this in Step 7
If you add a second component the data app will be a multi-page data app and you will enable the end-users to navigate through pages in the KNIME Hub via a next button. |
To adapt the given workflow for our analysis we will reconfigure the Column Filter Node in the given example to include some of the columns that were previously excluded as shown in Figure 3.
Now, you might want to give the end-user of the data app the opportunity to explore the data further, like to configure the view on data or filter the data. For example, you can add specific filter options in the component. To do so, first open the component created in Step 1 to add additional nodes. To open the component, right-click it, select Component > Open component as shown in Figure 4.
For example, suppose you would like the end-user to view only sales by time for a specific country “Brazil”. You can add a Row Filter node in the component, as shown in Figure 5, and configure it to show results for Brazil.
Step 2/5 – Add Widget Node
Up until now, we have manually configured the Row Filter node to display and analyze specific data. For the given example, to allow the end-user to select which country to analyze without having to explicitly change the configuration of the Row Filter node, you can use a Widget node.
The Value Selection Widget node gets the data you want to filter as input flow variable that reflects the user choice on the Widget node. The Row Filter node will then be configured to use the incoming flow variable to filter rows that have the value of ‘Country’ equivalent to the flow variable. Let’s assume you want to analyze further and view sales over time for a specific Product in each country’s record as a line plot. To do so, add another Value Selection Widget as a downstream node to the first Widget node as shown in Figure 6.
Step 4/5 – Add Domain Calculator Node (Optional)
The Value Selection Widget still shows the label option ‘unknown’ for the column ‘Country’. To skip the ‘unknown’ option in the selection widget you can use a Domain Calculator node before the component. It will recalculate the domain and apply the filter to the data. The complete workflow is shown in Figure 8
When the workflow is executed you can right-click the component and select Open view. This will show the available Views and Widgets that have been encapsulated in the component. From here you can interact with your data app, e.g. for testing purposes.
Step 5/5 – Change the Layout of the Composite View
Finally, you might want to change the layout of the composite view. You can do this through the Visual Layout Editor, that provides a simple drag and drop approach to get a layout of your choice. To do so, right-click the component and click Component > Open component. The layout editor button in the toolbar is now accessible to you as shown in Figure 9.
You can adjust the layout by defining which Widget and View nodes should be displayed next to or below each other. Refer to Figure 10.
The final Interactive Composite View that would be visible to the user upon workflow sharing is depicted in Figure 11.
Data apps on the KNIME Hub
KNIME Hub provides a web interface that lists all accessible workflows deployed to it, enabling their execution and investigation of results. The input and output of workflows can be parameterized, and their visualizations customized, using Configuration and Widget nodes, Interactive Widget and View nodes.
Workflows are published on the KNIME Hub by simply uploading the workflow from the local workspace to the corresponding Hub mount point. One major significance of data apps relies on making these interactive views available to any user in your organization via a web browser. Follow the given steps in order to deploy a data app to KNIME Hub.
You can share data apps both on the KNIME Community Hub and the KNIME Business Hub. Click here to learn more about the Business Hub!
To create a data app from the workflow you just created, follow the steps below:
Step 1/7 – Connect to KNIME Hub
In KNIME Analytics Platform open the Preferences window by clicking the cog button in the top right corner.
To add the new Hub mount point click KNIME Explorer > New… in the Preferences window. The Select New Content window opens. Select KNIME Hub and insert the Mount ID, shown in Figure 12.
For more information refer to the section on how to connect to the KNIME Hub in the KNIME Business Hub User Guide.
Step 2/7 – Upload the workflow to KNIME Hub
To upload the workflow to the KNIME Hub, right-click it in the space explorer and select Upload to Hub from the context menu. Then select the destination Hub in the Destination window as shown in Figure 13. Check the option Reset Workflow(s) before upload and click Ok.
Step 3/7 – Run the workflow on the KNIME Hub
To run the workflow with ad hoc execution on the KNIME Hub, navigate to the space explorer in KNIME Analytics Platform. Select the Hub space to which you uploaded the workflow as detailed in Step 2. Next, right-click the workflow and select Open in Hub.
Your KNIME Hub instance opens in a new web browser tab. Start by entering your access credentials – username and password. Once signed in, the workflow page appears. In the top-right corner, click Run. Within the ad hoc execution configuration panel on the left, select your execution context. Click the yellow Run button at the bottom of the panel to execute the workflow. This process is shown in Figure 14. The data app opens in a new tab.
Finally, for a comprehensive overview of all the ad hoc execution jobs of a specific workflow, navigate to the menu on the right of the workflow page and select Ad hoc executions.
Please bear in mind that an ad hoc execution is always performed on the current version of the workflow from which the run is initiated. To run an ad hoc execution of a workflow from a different space version, consult the KNIME Business Hub User Guide.
Step 4/7 - Create a version of your workflow on the KNIME Hub
Upon uploading a workflow to KNIME Hub, different types of deployments can be created. One of them is the data app you are currently setting up. Data apps provide a user interface to perform scalable and shareable data operations, such as visualization, data import, export, and preview.
To create a new deployment of a workflow already uploaded to one of your team’s spaces, you first need to have created at least one version of the workflow, as shown in the following:
-
Access the page corresponding to the workflow you want to create a version of by navigating through the KNIME Hub instance. On the workflow page click History.
-
The Workflow history panel will appear on the right, showing all existing versions and unversioned changes of the workflow since the last version was created.
-
Click Create version to create a new version, as shown in Figure 15. Proceed by assigning a name and adding a description to the version.
-
Conclude the process by clicking the yellow Create button at the panel’s base.
The newly created version will be visible within the Workflow history panel on the right.
Learn more about versioning in the KNIME Business Hub User Guide.
Step 5/7 - Deploy your workflow as data app
With a version of your workflow now available, you can proceed to deploy it as a data app. Data apps provide a user interface to perform scalable and shareable data operations, such as visualization, data import, export, and preview.
On the workflow page in your web browser, click the Deploy button. Adjacent to the Data app option, select the Create data app button. The Create data app panel on the right opens as shown in Figure 16.
Within the Create data app panel you can:
-
Assign a name to the deployment
-
Select the version you want to deploy. In this instance, you only have the previously created version.
-
Select the desired execution context
-
Add a category
-
Provide a description similar to the process of creating a version. If you added a workflow description in KNIME Analytics Platform it is added automatically to the Description field.
Additionally, you can enable Workflow actions and adjust the Advanced settings. No modifications are necessary for this deployment. Learn more about these features in the KNIME Business Hub User Guide.
After finalizing the deployment settings, conclude by clicking the yellow Create button at the base of the Create data app panel. This process is shown in Figure 16 as well.
Step 6/7 - Managing access to data app deployments
Upon successfully creating a data app for a workflow version, there are two options to control who can access them. Both are detailed in the following and shown in Figure 17.
-
Option 1: Manage access via pop-up notification
Directly after creating your data app, you are prompted to manage access to it by the Data app created pop-up notification. It emerges at the lower-left corner of the workflow page, as shown in Figure 17. By clicking Manage access you can determine who has permission to access your deployment. Inside the Manage access panel that appears on the right of the workflow page, you can locate users and groups using the search function and choose the access type.
Setting the access type to "Any signed in user" will allow every user who has access to the KNIME Hub instance to execute the deployment.
Clicking the yellow Apply button at the panel’s base activates a confirming popup notification at the lower-left corner, verifying that "Deployment access has been updated".
-
Option 2: Manage access from list of all deployments
Manage the individual deployments linked to a specific workflow by navigating to the workflow page on the KNIME Hub. Access the list of all deployments by selecting Deployments from the menu on the right directing you to a list of all deployments to the bottom of the workflow page.
Click the three points menu at the end of the corresponding deployment row and select "Manage access". Here you can also perform other actions related to deployments, detailed in the KNIME Business Hub User Guide. Take note that depending on the type of deplyoment some actions might not be available.
Step 7/7 - Data Apps Portal
The Data Apps Portal is a collection of all the data apps that have been shared with you.
You can access the Data Apps Portal by navigating to the address:
https://apps.<base-url>
e.g., apps.hub.example.com
This page is available to every registered user. Consumers, for example, can access this page to see all the data apps that have been shared with them, execute them at any time, interact with the workflow via a user interface, without the need to build a workflow or even know what happens under the hood.
To execute a data app click the corresponding tile. A new page will open in the browser showing the user interface of the data app, as indicated by the green pop-up notification at the bottom of the Data Apps Portal. This process is shown in Figure 18.
The result is displayed as a single page data app since there is only one component.
The following points about the data app are worth noting:
-
Each page of your data app will depict the execution of one component which encapsulates widgets, views, and intermediate nodes
-
You can define the layout of each component
-
Parts of a page that should be updated after a user input are implemented via a Refresh Button Widget node or the Re-execution tab of a Widget node (optional).
Glossary
Component
A component in Data Apps will provide a composite view as a single page in the browser. In general, a component is an isolated block of logical operations in a KNIME Workflow that can be encapsulated inside a component. A component can have its own configuration dialog and can also be assigned a view. Components enable you to bundle functionality for a particular part of the workflow and allow sharing and reusing. For more information refer to KNIME Components Guide. Widget nodes, View nodes, and Refresh Button Widgets are encapsulated together to form a component in KNIME Data Apps.
Composite View
Composite views contain the interactive views of Widget nodes, Interactive Widget nodes, and View nodes, that are encapsulated within a component. All composite views on the root level also define a web application, accessible through the KNIME Hub. In order to inspect the composite view in KNIME Analytics Platform, once the execution is done, right-click the component and select Open view. The layout of the composite view is also customizable. You can edit the appearance of the component’s composite view with the Visual Layout Editor. For more details refer to the Layout of composite views section.
Widget nodes
You can use Widget nodes inside a component to build a composite view that will be visualized as a web page on the KNIME KNIME Hub. The use of Widget nodes is aimed to set specific configurations, e.g to filter a data table by selecting a value from a specific column. On the web page, you will then be able to enter values for specific parameters before proceeding with the workflow execution. These values are injected into the workflow and used to parameterize its execution.
Interactive Widget nodes and View nodes
You can use Interactive Widget nodes and View nodes inside a component to build a composite view that will be visualized as a web page on the KNIME Hub. View nodes are used to build specific visualizations, like tables, charts, and plots, which are displayed as web pages. Interactive Widget nodes can be also used alongside the View nodes in order to interact with the visualizations directly on the web page.
Re-execution of Widgets
In addition to the functionality of the Refresh Button Widget node, it is also possible to configure some of the Widget nodes (Selection Widget node and Boolean Widget node) so that the change in their value in the composite view upon user interaction will directly trigger re-execution of the component downstream nodes. You can read more about it in the Re-execution of Widgets section.