Building a shareable dashboard with Bokeh and Binder

3 minute read

Published:

In the spring, I was experimenting with visualizing spatial information in Python and was having good success with the Bokeh package. Bokeh is great because it allows you to create interactive visualizations relatively quickly without needing to know JavaScript. Recent versions also handle GeoJSON data quite well which makes it easy to use with spatial vector data.

Something I had wanted to create for a while was a data dashboard for the survey element of our project. This would give us the ability to quickly see where artifacts of a given type were found or allow us to jump to a particular parcel to see what we had recovered there. Bokeh comes with a nice set of widgets that can be used for exactly this kind of dashboard, so it wasn’t all that difficult to get it up and running.

As I built the app, it was always in the back of my mind that I would like to be able to share it with my collaborators. That, however, would mean getting it out of a Jupyter Notebook and on the web somehow. You see, the LEIA Project is a collaboration between a core group of archaeologists and an extended team of maybe a dozen or so specialists, both American and Spanish. Most of those people do not code and have no interest in getting anywhere near a Python script.

To use Bokeh widgets, however, one has to start up a bokeh server. While there are a number of ways to do that, most of them would require my collaborators to use Python or for me to set up some complicated hosting system on a server. What I wanted was a method to put my widget app on the web for free without using anything but Python.

This spring when I hunted for a solution, I came up empty. I resigned myself to just running it locally from my laptop and showing it to my collaborators in person while I was in the field in Spain this summer.

After I returned to Seattle at the end of July, I decided to give it another go. I knew I couldn’t be the only person who wanted to share my widget-based dashboard easily. So I turned to Twitter…

… and Twitter delivered!

As it turns out, while I was in the field in Spain, someone had solved this exact issue.

By following @minrk’s example very closely, I was able to get my Bokeh app up on Binder in no time. With that, I could just send a link to anyone that allowed them to use my app in their browser.

If that is something you are interested in, the Binder team now has a nicely documented example in their binder-examples GitHub repo. Try it out!

Note: I have not included an example of my app here because the data aren’t ready to be shared with the world yet.