This repository contains the content of Part 2 of the "Interactive visualization with Python, Plotly and Dash" demo presented at the OpenMR Virtual 2021 event:
The tools are out there for researchers to publish their data and results in rich online formats that offer accessibility, interaction and exploration. Yet, we still see a majority of standard plots and images in PDF format. In this demo, we will explore the possibilities offered by Python, Plotly and Dash to make your research outputs interactive and future-aware!
The whole demo follows this presentation. The first part runs through content that can be accessed at this repository: https://github.com/OpenMRBenelux/openmr2021-dataviz-dash-demo.
In this second part of the demonstration, you are given a walkthrough of how to create and deploy an interactive Dash app.
You can access the resulting sample application here: https://openmr2021-dash-demo.herokuapp.com/.
If you would like to run through the setup and deployment of a Dash app from your own machine, you can follow the instructions below.
First, you need to have Python installed, after which you should set up a virtual environment in which to install all the required dependencies. For example, you can use install and use miniconda for virtual environment management. Once installed, create the environment:
conda create -n <YOUR-ENV-NAME> python
Then activate the environment:
conda activate <YOUR-ENV-NAME>
Then install all dependencies:
pip install -r requirements.txt
Either by creating one on Github and subsequently cloning it to your device, or via the command line.
requirements.txt
app.py
procfile
.gitignore
- (optional)
assets
and/ordata
directories to store any content used by the application
This is the service with which we will deploy our Dash application. Visit Heroku to create a free account.
The Heroku CLI needs to be installed locally in order to interact with Heroku via the command line.
heroku login
This will prompt you to press any key, after which it will open a browser window where you will log in with your Heroku credentials. After doing this, return to the comman line.
heroku create -n <YOUR-APP-NAME>
where <YOUR-APP-NAME>
refers to the preferred title for your new Dash app. This will return a URL in the form https://git.heroku.com/<YOUR-APP-NAME>.git
heroku git:remote -a <YOUR-APP-NAME>
This connects your local code base with the remote Heroku app that you just created.
git push heroku main
This deploys your app to Heroku!
heroku ps:scale web=1