This repository contains a Spotify + Streamlit dashboard built as an example of cloud data visualization for the Data Analytics Project Lab at Dartmouth College.
Feel free to check out the live dashboard here!
Author: Spencer Bertsch
Dartmouth College
Spring 2022
Big thanks to my pal Mike Koshakow for letting me share his music preferences with the world!
- Clone this repository locally.
- Request your data from Spotify using this link. Be patient, this can take a few days.
- Once you receive your data from Spotify, place the important JSON files into the
MyData
directory. Spotify will give you lots of data including billing information, but you only need the following files:
- SearchQueries.json
- YourLibrary.json
- StreamingHistory.json
Note you might have more than one StreamingHistory.json file. That's okay, just copy all the streaming history files into theMyData
directory.
- Set the
DASHBOARD_SIMPLE
variable toTrue
at the top of thestreamlit_main.py
script (line 29). - Once that's done you will have all the data you need! Last step is to run the dashboard using the following command:
$ streamlit run streamlit_main.py
After that the dashboard should open in your default web browser.
If you want to see this spotify dashboard reflect your own music taste, you will need to follow these steps:
- Clone this repository locally.
- Request your data from Spotify using this link. Be patient, this can take a few days.
- Once you receive your data from Spotify, place the important JSON files into the
MyData
directory. Spotify will give you lots of data including billing information, but you only need the following files:
- SearchQueries.json
- YourLibrary.json
- StreamingHistory.json
Note you might have more than one StreamingHistory.json file. That's okay, just copy all the streaming history files into theMyData
directory.
- Next you will need to create a spotify developer account using this link, and create a new project. After you create the project, you will need to copy the Client-ID and the Client-Secret into a new .json file called
spotify_app_credentials.json
. - Your
spotify_app_credentials.json
file should contain a single line in the following format:{"Client-ID": "XXXX", "Client-Secret": "XXXX"}
. Place your new json file into the directory one level above the working directory of this project alongsideDAPL_Streamlit
. - Just a few more steps! Now run the
get_audio_features.py
script by running the following command:
$ python3 get_audio_features.py
This script can take a while to run depending on how many songs you've listened to in the past year. For a listener with 24k songs streamed it took about an hour. The limiting factor here is not the machine running the script, but the response time for the APIs returning all the data we need to collect.
- Once that's done you will have all the data you need! Last step is to run the dashboard using the following command:
$ streamlit run streamlit_main.py
After that the dashboard should open in your default web browser.
If you want to run this dashboard locally, simply follow these steps:
- Clone this repository locally.
- Create a new Conda environment by running the following command:
$ conda create -n streamlit-demo python=3.8
- Activate the new environment by running the following command:
$ conda activate streamlit-demo
- Install the necessary dependencies by navigating to the working directory and pip installing the required libraries by running the following commands:
$ cd ~/DAPL_Streamlit
$ pip install -r requirements.txt
- Run the streamlit_main.py file to create a local server and see the dashboard running on your computer.
$ streamlit run streamlit_main.py
- That's it! After that the dashboard should open in your default web browser.
As mentioned at the bottom of the dashboard itself, I was inspired to make this dashboard by my friend Anne Bode who did a similar project using Tableau, outlined here.
Like Anne, I also found this article by Steven Morse very helpful when learning how to use Spotify's many APIs to get the information I wanted.
Thanks for viewing this dashboard! If you enjoy it, please give the repository a star โญ and feel free to build upon the code in this project to make a fun, music-inspired dashboard of your own!