Do you that song that gets you running a little faster or your heart beat harder every time it plays?
Ever wanted to apply statistics to check whether the effect was consistent?
Here's PowerSong!<p>The backend is based on Python, with Django as the "MVC" framework, NumPy and Scipy, Spotipy.
Celery is used to retrieve information from the APIs asynchronously.<p>The main challenges when building PowerSong was how to transform the raw information from Strava into "clean" pace, heartrate and elevation information that perfectly correspond to the period of time:<p>* GPS data is very noisy: decreases in GPS precision leads to spikes in the user position. I had to filter out songs that have large accelerations and speeds;<p>* Dealing with differences and speed (meters/sec) and pace (minutes/km) is a fun surprise: to calculate a difference in speed, you just have to subtract them. But if you want to compute the same difference in terms of pace, you cannot grab the speed difference in m/s and convert it to minutes/km; you have to have to compute the difference with the speed in minutes/km;<p>* The last.fm and Spotify only give you information regarding when the song you are listening started/ended. Pausing and skipping songs can lead to ambiguous situations;<p>* The same song can have different duration in different albums and versions (e.g. single version, album version). This is a bigger problem on last.fm, as songs are associated to multiple albums, which means that it can be impossible to find which version of the song was listened (this is still a WIP);<p>* Celery's per task rate limiting sounds nice, until you realize that you have multiple tasks using the same API, and thus, not counting towards the rate limit. I had to create per API tasks (spotify_task...) that encompass all methods and have a well behaved rate limited system;<p>Go to <a href="https://powersong.run/demo/" rel="nofollow">https://powersong.run/demo/</a> for a live demo using real data.