Today was the start of the dashboard week. If you’re unfamiliar with dashboard week, it is a week where the data schoolers in training have to build 5 dashboards along with 5 related blogs in 5 days. So that’s 1 dashboard + 1 blog a day. Every day the topic and requirements are provided in the morning and we have till the end of the day to finish our work. Needless to say, it is the start of a long week ahead.

Today’s Topic

Today’s brief had the following requirements.

  • Connect to the Spotify API
  • Create a dashboard from the data pulled from the API

Quite interesting and straight-forward. I was very excited to be working with Spotify data as I use Spotify every day. I was particularly keen to analyse what my listening patterns are and how they’ve changed. I was aware that Spotify shows you the analysis of the audio features of a song; for example, the popularity, valence, loudness, danceability etc of a song.

My Approach

My approach was to first try and connect to the Spotify API. After some help from Jonno (Jonathan Cavalieri) and the Python script he gave us, we were all able to connect to the API to varying degrees of success. Luckily, I didn’t encounter any issues with the API, so I started pulling all the data I needed. I noticed I was able to pull in my most played songs in different time ranges – short-term (last 4 weeks), medium-term (last 6 months) and long-term (last few years). I was really interested in seeing how my top songs have changed over time.

Prior to pulling the data, I wasn’t really sure which songs were on the top list. I could assume some would be on the list but seeing the full list was quite interesting as there were some songs that I didn’t expect to be there.

I won’t go through the entire Alteryx workflows I created to bring all the data together and shape them into the right format. However, I did not find it particularly challenging because I have done API calls before and the parsing and shaping methods I use are pretty straight-forward. Data pulled from the Spotify API comes through in a nice JSON format, which isn’t too complicated to clean up.

After the data cleaning process, I moved on to create the dashboard. This part was a bit more challenging than I expected it to be. As I had a rich dataset, I didn’t think it would be too hard coming up with ideas to visualise it. After a fair bit of head-scratching, I decided to see the changes in my top songs across different time ranges (short-term, medium-term & long-term). The issue was that the top 50 songs I pulled for each time range were not consistently the same songs, as some songs dropped off and others entered the list. So I decided to only focus on showing the songs that were on the list consistently through different time ranges and see how their rankings change over time. I was also interested in seeing the audio features for the songs.

The image above shows a snippet of the dashboard I’ve created. You can click on the image to be taken to the actual dashboard. The variance in the intensity of the colour depends on the value of the measures I select; such as valence, loudness, popularity, danceability etc. I thought this way of visualising would be a clean and easy way of showing how the ranking of the songs have changed over time.

Final Words

I had a great time creating this dashboard. It’s not as fancy as I expected it to be. There is a lot of room to add more data and do a further comparative analysis. Hopefully, I’ll pick up this project in the future and see how much more insights I can find on my listening habits.

Fairuz Khan
Author: Fairuz Khan