Lecture 12: Getting Visualizions onto the Web
DSAN 5200-03: Advanced Data Visualization
Class Sessions
Web apps without rolling your own server
GitHub Pages
- Most basic: GitHub Pages (web app must be rendered to html, hence quarto)
Streamlit
- Streamlit map – benefits: write directly in Python without worrying about compilation to html via quarto; using GSheets as DB, but also many many drawbacks of streamlit
- Live coding: make the basics of the map app [sidebar, main window, sl.Map(), Geocoding API
Vercel
- Vercel + Next.js: Marxdb, DailyAtrocity
- Pre-caching all of the possible views – for example, if they’re visualizing 50 states, they can pre-render those 50, at urls like /al, /az, etc
Cloud functions
Halfway Between Web Apps and Full-On Servers
- GCS: A quick-and-dirty “hack” for replacing actual storage space on server
Web apps with your own server
Flask!
- Bridges the gap between Cloud functions and… Apache
- Obvious disadvantage: cost (even worse than cloud functions)
- Advantages: Run anything at all, beyond just Python
- Multiple domains, subdomains, etc.
Flask Lab
- Hello world but also with parameters; reasons to use GET vs POST
- How does it help with viz?
- Immediate answer: take an app with big big data file on HDD \(\rightarrow\) load dynamically via GET request in Flask app!