And so as DSAU6 heads into Week 14 of our journey, so too do we enter the dreaded Dashboard Week. During this week we are presented with a different challenge each day that must culminate in a dashboard to be presented the very next morning. I had heard whispers in the wind that this week would require a feat of both skill and stamina, and after one day I can confirm that this certainly appears to be the case.

 

The Task

 

Today our challenge was to present a dashboard, which had to be built using data from an API. Now, if you have any knowledge of utilising APIs you would know that while APIs can be extremely useful sources of information, they can also be quite finicky to set up (an ill-desired trait when running on a very short deadline). The other significant challenge with using APIs is that they are rarely designed to extract bulk information; they are usually tools used to answer very specific queries. Unfortunately for me, I ran into both of these problems very quickly after I decided to use the Spotify API.

 

The Process (and Challenges Along the Way)

 

The first step when using APIs is to connect to them; this usually requires an authorisation process. The Spotify API had four methods you could use to access it, and being in a hurry I decided to try and work my way down the list until one worked. Unfortunately, the fourth method was the one I needed to use to grab public data (lesson learned; always read the whole document before starting). For anyone interested, if you would like to access public data through the Spotify API you need to first make an account to obtain a Client ID and Secret. You then need to use a Base64 Encoder tool on your ID and Secret concatenated, like so: [Client ID]: [Secret] and then use an ‘Authorization’ header and a Download tool on ‘Basic [encoded ID+Secret]’ to obtain your API key. At which stage you can then use this key as a Bearer with an endpoint of your choice, the workflow should look something like this:

 

 

This took longer than I’d care to admit, so I was already somewhat behind schedule. I now needed to look for what information I could extract from the API, which is when I ran into the next challenge; this API wasn’t designed for people to bulk extract information for analysis. My first plan was to grab data on the top artists of 2010 and track their progress to 2020, however, after setting this up I found that the ‘year’ parameter wasn’t actually working, so I scratched that idea. My next plan was to find all the current top artists and see how many of their songs are featured in the top Spotify curated playlists to determine, whether Spotify may be promoting certain artists. This fell through as there was no way to see how many followers each playlist has through the API. Finally (it was quite late in the day by this point), I committed to finding the top 500 artists on Spotify and then running a Batch macro to find all of their related artists and see how many of the top 500 artists are related to each other. This was an attempt to see whether people who listen to Spotify all have similar tastes in music.

 

The Final Product

 

I managed to time box the actual dashboard and finish by the end of the day. If you would like to interact with the final product, you can find it here. Otherwise here it is.

 

 

One down, four to go.

 

 

Patrick Breis
Author: Patrick Breis