https://jiya-sav.github.io/ourshiny/
Click here to learn more about us!
Our project, displayed on the demo page reccommends similar songs based on the ones you like. This eliminates the common problem of having trouble compling similar songs in a playlist. There is also a random song generator, if you can't think of a song, as well as a search feature, where you can check if our database contains a song of interest before generating a playlist.
Our search feature was done using jquery methods we learned in class during the javascript tutorial lesson.
Throughout our projects, we stored our data using several methods. We began with a CSV file with many songs and their characteristics. We then organized the data into a Pandas Dataframe. From here we created a database, which allowed our data to fill an SQLite table. We used a database so we can add songs to keep our program up to date, rather than simply working with static data. Lastly, we took the information in the database, and put it into json. This json can be accesed through a URL on our flask, and can be fetched by frontend JavaScript.
-
CSV A CSV file is a file that stores text data in a way that it could be later organized into a table or other organized format. CSV stands for comma seperated values.
-
Pandas Dataframe A 2 dimentional data structure or array, that allows for the storage and manipulation of data in a tabular format. Some operatins include cleaning, filtering, merging, and grouping.
-
SQLite Table SQLite, is a database engine written in the language C. When we learn to create a database in class, our data then fills a tbale in an db file. This concept can help APCSP students with no background in database management. Students can be introduced to CRUD operations(create, read, update, delete) that can be operated on a table. Working in SQL, structured query language, can help students understand data constraints and how to work with/ organize information.
-
JSON JSON, as it stands for JavaScript Object Notation, is a format in which data can be organized. This is human readable, and allows for the storage and tranmission of data through different formats. A lesson for APCSP students on JSON may include topics related to modifying and creating strings in python/ JS. Then, students may explore accessing objects and using APIs to practice conversions between different data formats.
Once we deployed our flask, we were able to fetch the link that had the structured JSON. After receiving the data, we assign the response JSON to the songData variable.The song reccomendation function searches for the inputted song title within the dataset using the Array.prototype.find() method. If the inputted song is found, the function identifies its index in the song data array and assigns it to the inputIndex variable. If not, it displays a message in the recommendations section indicating that the song is not available in the database.
The reccomendation function then computes the similarity between the inputted song and all other songs in the dataset. It creates an array of similarities by mapping over the song data array and using the calculateSimilarity() function to calculate the similarity score for each song. The function calls the getTopIndices() function to retrieve the indices of the top five songs with the closest similarity. It takes two song objects (song1 and song2) as parameters. The function compares the absolute differences between corresponding attribute values (e.g., bpm, energy, danceability, loudness, valence) of the two songs. It computes the sum of these differences to obtain a similarity score. The smaller the similarity score, the more similar the songs are considered to be.
After receiving the data, the function selects a random index within the range of the song data array using the Math.floor(Math.random() * songData.length) expression. It retrieves the song object corresponding to the random index and assigns it to the randomSong variable, and then outputs it.
powered by fastpages
Great! You have setup your repo. Now its time to start writing content. Some helpful links:
Note: you may want to remove example blog posts from the _posts
, _notebooks
or _word
folders (but leave them empty, don't delete these folders) if you don't want these blog posts to appear on your site.
Please use the nbdev & blogging channel in the fastai forums for any questions or feature requests.