Happy data scientist: How to build a business intelligence app with 10 lines of python code

Anastasia V Polyakova
Oct 22 · 3 min read

In this post, I’d like to show how to quickly create a Tableau-like BI application on top of your data in a Jupyter Notebook using the atoti python module. It can give your users an easy way to:

  1. explore the data produced by your model with an interactive UI,
  2. play around and see it in various projections without the need to run any notebook or to write any code or depending on someone to ingest it into a standalone BI solution.

In the study “2020 State of Data Science — moving from hype towards maturity”, Anaconda discovered that

“Fewer than half (48%) of respondents feel they can demonstrate the impact of data science on business outcomes”.

As a remedy the Anaconda team has suggested to focus on removing “the barriers to deployment” and for data scientists on learning “to communicate the value of their work”.

My own small research is showing that pro data scientists tend to present the results of the work in a form of a Jupyter Notebook or a pdf file:

Image for post
Image for post

Jupyter notebooks are great for working on models, but they are not so great in their raw form for presenting results to users. By starting a BI app on top of the collected and enriched data sets and letting business users “experience” the data, slice and dice it, we encourage early feedback, help unlocking imagination and discovering the value of the ML algorithm at earlier stages of development.

Image for post
Image for post
launching atoti UI

In a BI app business users can explore the data — filter, drill-in and even run what-if analysis without the need to write any code — like in excel but from a web gui. Charts, pivot tables, formatting, conditional formatting and interactive recalculations, and scenarios will be available to them.

Python implementation

Now I’ll show you how to quickly start a BI app locally or on a server from a jupyter notebook using atoti python module and give the end user a link to slice and dice the data set.

These are the 10 lines code:

They perform these 4 steps:

  • import atoti. You can find the installation steps for conda and pip in the doc.
  • create a session — at this step an in-memory data cube is span on your machine or on a server and the UI is launched. You can open the URL of the app by running

session.url

  • Next step is to load the data from a pandas dataframe into the app engine (creating an in-memory datastore). You could connect the app to other sources, for instance, csv files, parquet, kafka feed and others.
  • Finally, the create_cube command is populating measures and dimensions.

Later if you want, you can load more data sources and link them together in a snowflake-type of data schema. Or you can define simple or sophisticated calculations for your end users to look at. You can find some reference examples in the atoti gallery.

Under the hood

Starting using atoti python module is not hard — just a few lines of code and one module to install, but do not let this easiness to confuse you — under the hood the bi app you are launching is powered by a fairly sophisticated technology which utilizes an in-memory database engine, datastores capable of handling real-time data updates and reactive UI.

Conclusion

Productionalizing analytical models and helping users adopt them is not easy. I hope this example can help you engage business users as early as possible.

As a power user of atoti, I build models for risk analytics in financial institutions, please check my other posts for more sophisticated examples of non-linear aggregations and complex calculations.

atoti

From data science to collaborative analytics.

Anastasia V Polyakova

Written by

Anastasia is a quantitative financial analyst and risk management practitioner experienced in modern data analysis tools and frameworks.

atoti

atoti

atoti™ is a Python library for data aggregation, data analysis and visualizations, powered by a JAVA in-memory OLAP cube engine. It provides interactive visualizations and business intelligence capabilities from the notebook and from a dedicated web application.

Anastasia V Polyakova

Written by

Anastasia is a quantitative financial analyst and risk management practitioner experienced in modern data analysis tools and frameworks.

atoti

atoti

atoti™ is a Python library for data aggregation, data analysis and visualizations, powered by a JAVA in-memory OLAP cube engine. It provides interactive visualizations and business intelligence capabilities from the notebook and from a dedicated web application.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store