Create a Data Capturing Tool With Tableau

Abhik Chakraborty
The Startup
Published in
6 min readSep 12, 2020

--

Remember those conversations between BI engineers when we randomly recommended reporting tools to each other? No? Just me? Okay!

Nevertheless, whenever I have had those conversations, Tableau has been my number one choice of recommendation. This is simply based on the fact that Tableau has time and again proved itself to be the best friend of analysts and BI developers to visualize data in a simple (sorry Power BI users!), and flawless manner. Additionally, its impressive and experienced community is a huge helping hand, making the tool a very dependable one.

Photo by Clay Banks on Unsplash

But, while Tableau is great to visualize data, can it collect data too? Hell, yeah!

Now, before we start, I would want to put a disclaimer that this implementation is not as comprehensive as having a web application. This will be limited to the features offered by Tableau and of course our imagination and skills for using those features. However, it would be much better compared to static data collection interfaces like MS Forms, considering it will be more dynamic and assistive. So, without any further delay let’s get going.

Implementation in Brief

To get started, let’s just walk through the steps that we need to do for this implementation in brief. Further down the article, I will explain each of these steps in detail.

For this implementation, we will need to create 3 things:

  1. A frontend interface: Our friend Tableau comes to the rescue. We can create a very nice data-driven interface on Tableau for our users to interact and then enter the data. To enter the data, the users would be provided a form on tableau itself
  2. A microservice/web application accepting HTTP requests: The whole point of having this is to process and store the incoming data. We can create one for free using many programming languages or can get a managed service through AWS Lambda, O365 Power Apps services, or any other vendor. Here, we will be using Python with Flask because it’s easy and free. For my enterprise implementations, I use AWS Lambda and DynamoDB because the company is paying!
  3. A data storing platform: This is the place where we will be storing the data. For enterprise solutions that have to be highly available, I would recommend using an enterprise database service like MS SQL Server, Oracle, or for my No-SQL aficionados — DynamoDB by AWS. Here, we will use the free and awesome SQLite

Brief Introduction of the Use-Case

We will be building a simple Candidate Interview Score Gathering System where the interviewers and recruiters enter scores for a particular candidate through our tableau interface and the numbers are stored in a database

Let’s talk details

Before I begin…

The explanation below is going to make much more sense to the audience if they have a working knowledge of Python and Tableau. I would try to provide relevant links to topics wherever possible

We will start with the design of the backend first

Web Application

  • For this implementation, I will be using Flask as I mentioned before. Flask is a very nice micro framework to create high performance and nifty web applications. Now, back to our implementation, please refer to the code below for our flask application

The above code creates a very simple service using FLASK which accepts GET requests and inserts the data into an SQLite database by creating a pandas dataframe.

Here GET method is used instead of the standard POST method because Tableau is capable of sending only GET requests.

Waitress is a production-ready server for Flask that would run our web application. But, since we will be running the implementation locally, we will be using the best server of all time — localhost

Here is what it looks like when we run the above code:

The URL to be used for sending the data is:

HTTP://127.0.0.1:5000/submitscore/<name>/<category>/<score>/<submitter>

Here the data to be inserted is represented as URL parameters like <this>

Data Storing Platform

As we could see from the above code snippet, we will be inserting our data into an SQLite database. The data table to be used is hiringscoredata. Before we dive into Tableau implementation, let’s see what happens when we try to insert some data using a GET request

  • We will be using Chrome to send the request as we know our browsers are capable of sending GET requests
  • So, let’s give a candidate named Prashasti Mehta, a score of 8 out of 10 for her communication skills. The score is submitted by yours truly
  • For the above, our URL now would be: http://127.0.0.1:5000/submitscore/Prashasti%20Mehta/Communication/8/Abhik%20Chakraborty
  • This is what happened after we triggered the above URL on chrome. The below screen grabs are from Chrome and SQLite respectively
Data Inserted!
Preview of the inserted record on SQLite Table

Tableau Interface

I know this is what we have been waiting for. Now, we will create an interface on Tableau to insert the data. This implementation can be expanded with multiple features and complexities. For this article, I designed a very simple interface as shown below

Form on Tableau

Here, all the fields are tableau parameters. However, we can use dropdowns generated from any data source too.

Next, we need to submit the data entered here to our server. To do this, we create a tableau calculated field to concatenate the data generated from the above parameters into the standard URL format accepted by our web application.

Calculated field ‘Hyperlink’ for creating the standard URL format

Finally, we add a URL Action that would hit the URL we created under the “Hyperlink” calculated field above. The action is applied to the SUBMIT button on the form which is essentially a worksheet named with a very intuitive name — ‘submit button’

And we are done!

Let’s test!

So, the moment is here. Let’s insert some data from our tableau form.

  • We enter the details as below
Details on the form
  • Next, after pressing submit, this is what we get on the browser
Data inserted!
  • Finally, after the data is inserted, the data table looks like below
Boom!
  • Yeah, it’s okay to dance! You did it!

Disclaimer

While the above is a handy implementation to create a data capturing application right inside the BI dashboard, I want to highlight that this implementation should not be used for sensitive information like username, passwords, financial information, etc. For that, we have awesome software developers creating secure applications and gateways

While the above implementation is limited to a local system, it can be easily expanded by hosting the web application on a virtual machine or by using Docker. Additionally, we can also publish the dashboard on to a Tableau Server for the audience. We can also implement the webserver backend using serverless services like AWS Lambda. If you are not so sure about coding, another great way of doing it is using Microsoft PowerAutomate. It provides a lot of great functionalities and features in a drag and drop format. Additionally, a lot of its features are available for free or through your O365 subscription.

I hope this small tutorial will get you started towards using Tableau as a data capturing tool. If you need me to do a more production-ready implementation of this, drop me your views in the comment section.

Cheers!

--

--