The initial profile page
A medical survey to evaluate our model and rigorously confirm our initial classification
A custom user-tailored playlist of happy music suggestions
We wanted to work with something that was impactful but fun to implement. We were able to incorporate interests within our team to work on a health-related project with interests to work with large amounts of data and interests to work with music.
There are currently very few metrics used as indicators of mental health issues outside of surveys and self-reports. We want to see if music preferences over time could help remedy this problem by providing another means of quantifying emotional and mental stability.
What it does
Our project is able to collect a user’s history of music preferences on Spotify, and after comparing and normalizing to the Top 100 Billboard songs at that time, predict whether a user’s music listening patterns generally trend downwards, indicating that they have been listening to more negative songs recently. If the user seems to have this downward trend, we provide a survey to get a more holistic understanding of what emotional state they might be in. Combining all this data, we suggest whether the user might want to seek therapy or outside help. Regardless of what trends exist in a user’s data, we think everyone can benefit from happier music, which is why we create a custom playlist of generally happier music, tailored specifically to the user’s recent music preferences.
How we built it
The first step was to access and process the music habit data that we needed. We used Spotify’s Web API to get user listening data by scraping their playlists and used Billboard Top 100 lists to get a baseline for a certain time period.
We then extracted three features: “danceability”, “valence”, and “energy” of all of this music data, calculating a score that took these three features into consideration. We then used the baseline data to normalize a user’s data (if popular music was mostly negative during a certain time period then a user’s score is naturally more likely to skew negative so we wanted to mitigate that effect).
Finally, to calculate whether we would assign a net “POSITIVE” or “NEGATIVE” classification to a user’s data, we took a weighted sum of slopes over various time spans, weighing more recent data more heavily.
Challenges we ran into
Spotify’s API is intended for simple hobby use, not the levels of data collection and extraction that we required. The API often automatically rate-limited our application, preventing us from getting complete data. We were able to do some pre-calculation of data, specifically the Billboard data, but despite all the optimization we did, the web app is still susceptible to rate limiting by Spotify’s API. (At which point the user simply needs to wait 5 seconds and refresh to try again)
Another big challenge we ran into was in how we built our model and weighed our variables. Since we don’t have labeled data available to us and hand-labeling data would introduce our own bias into our model, we went with simple weights since we used various Spotify features that have been and keep being carefully calibrated to calculate sentiment.
Accomplishments that we're proud of
Many of us lacked experience in web development/ React. To have built a complete, functional web app, in the end, was in itself highly satisfying, and in the process of doing so, we found a way to look at music from a new perspective as an analytical health tool.
What we learned
Overall, we learned a lot about the process of taking multiple technical components and integrating them together into one cohesive product, from start to finish. Individually, we learned React, use of the Spotify API, data mining and analysis, and NLP.
What's next for MusiCare
Implementing more sophisticated methods for extracting mood from music, such as lyric analysis with NLP. Finding/creating training data to train machine learning models to optimize weighting procedures for averages and comparing user data from our model and the survey to evaluate the model. Eventually, we hope to sync as part of Spotify’s background data analysis rather than a separate add-on web-app with extremely limited access to their API. Given the functionalities, we hope to provide subliminal messages with counseling ads and advertisements for other supportive services through Spotify as a means of raising awareness and having a larger impact.