In order to make the book recommendation algorithm discussed in the previous post usable, I needed to develop a user interface and database for storing a user’s ratings. I choose to make an app with Flask.

I started from the tutorial on the Flask site which leads you through making a blog post app. Users can log in to a home page with their posts listed, write blog posts, and delete posts. This was easy to adapt to my users where I wanted users to log in to a list of recommended books and have the ability to add rated books or mark recommended books as read.

In order to allow the app to all the recommender for a given user, I converted the original book dataset to a sqlite3 database. This conversion handled all the data cleaning and reduction steps necessary to eliminate books or users that did not connect to the greater dataset, combine identical books into a single ISBN, and make the recommender run smoothly on my local machine. These steps are discussed in more detail in the previous post.

Next, in order to make the recommender and the accompanying app functions run efficiently and look tidy, I created User and Book classes so that they could be treated as objects. These classes handled most of the queries to the database and included useful functionality such as adding a rating, deleting a book, searching for a book by its title, and finding a book’s title from its ISBN.

Once I had gotten the app up and running, I was able to test the recommendations as the user inputted more reviews. I quickly ran in to the issue, what if the user tries to add a book that’s not already in the database? To handle this I implemented another function within the Book class to look up a book by title (and author if the user supplies it) with the Google Books API. With a query to the API, I collected the book’s title, author, year of publication and ISBN and add it to the database. While this makes the user experience easier, avoiding errors of “No book found”, it does little for the accuracy of the recommendations as the newly added book will only have one user who has reviewed it. Until the database is exposed to many new users to expand the pool of users who have reviewed a new book, it is unlikely the new books will be recommended.

Finally with the app running on my local machine, the last step will be to implement this as a web-app available to the greater public!

Categories:

Tags:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *