Connecting your app to the Luigi pipeline

Once the dashboard is working and looks good, we can discuss its deployment details. For now, all of the data is internalized in the dashboard itself, which makes the specification large and a little hard to update. Let's link the chart to the external CSV file we generated with Luigi and stored on the S3 bucket. We could use the URL (path to the file) from the beginning; it's just easier to be able to open and investigate the dataset. Copy the URL to the dataset and override the attribute:

url = 'https:/path/to/your/dataset.csv'
dash.data = url

Make sure it is still working! Now, we can write the dashboard to the HTML, as follows:

dash.save('chart.html')

As we discussed in Chapter 12, Data Exploration and Visualization, this will store a standalone HTML page with a working dashboard. The last step is to publish the chart itself (for example, on the same S3 bucket). Published, the chart will reflect the changes whenever we update the CSV. We can further automate that update by scheduling a Luigi pipeline to run every day: with this, we'll get a "live" dashboard for monitoring 311 situations in the city. 

This dashboard costs virtually no money (only whatever we spend on S3 buckets) and requires no time to maintain. It could be easily customized and developed as an Altair object, a Vega-Lite/Vega application, or a standard HTML/JS-based app. Lastly, this dashboard can be easily styled and restyled according to your design guidelines. Being cheap and simple, this approach has its limitations: as with most client-based visualization solutions, Vega is limited in the amounts of data it can reflect, and the whole dataset needs to be publicly exposed, which is not always an option.

All of that makes Altair a great solution for public-facing charts and dashboards. Often, though, we need an internal dashboard, with access to large amounts of data and the ability to drill-down to specific records. For that, a different type of dashboard should be used: dynamic, server-dependent dashboards. Let's discuss them in the next section. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.194.172