You May Also Like

Watch-Next Movie Algorithm

RESTful API-powered MySQL DB and Web Front


Functional web front end to demonstrate 19+ API endpoints including a clever watch-next movie algorithm!

Story

Ingest a Kaggle movie dataset into MySQL DB. Access via API. Demonstrate using web front end.


The site below is entitled You May Also Like is available at a temporary test location {with so-so uptime!}

Implementation

TL:DR... B- for design, but A+ for implementation!


As a piece of coursework, the implementation is top-rate. The main tenet is movie discovery. This is achieved with quite a clever {if I say so} movie-suggestion or watch-next algorithm designed by me, ground up!

The site demonstrates a big range of API functions including various search, as well as registration and login, and secure CRUD functions.

The design I was going for was a kind of retro-B-movie type feel replete with retro fonts and background static/noise. More fool me though as a non-designer for attempting to get away from Bootstrap and do something different! Yeah, I think I managed it, but using Pure CSS just left me with fewer ready-made bells and whistles! Even getting a responsive navbar wasn't built-in! #headache

Code Highlights

1. Database Creation


3180 movie records in CSV format from the dataset were parsed through a PHP script. The script performed various data cleaning and splitting functions so the following tables in 3rd Normal Form could be populated.

Tables on the left prefixed x_ represent user and admin functionality. Tables on the right prefixed y_ represent the movie details

Interestingly, the movie Avatar (2009) forced me to alter the income field from an int to a bigint because the box-office takings broke the int's MAX value!

Table Relations Diagram

2. The API


Everything you'd expect. User-input data is validated and sanitised both for cross-site scripting {escaped using htmlentities} and for SQL injection {using prepared statements}. The returns are JSON.

A diverse range of functionality exists from various movie searches {by rating high/low/between, by genre/double genre, and the usual actor, director searches}. Public access exists for the search. User login {SESSION-driven on key} is required for the watchlist. Admin login {SESSION-driven on key and admin role} is required for the movie create, update, delete.

The function I'm most proud of is the Watch-Next Movie Algorithm. The above site is based largely around this. The premise is simple - take 3x movies and return "similar" movies. The implemented algorithm is an 850+ line lump of code that disassembles the list of actors, directors and genres in the 3x movies, and searches on the most important combinations. try it out for yourself! Fingers crossed this free host is actually up!!

3. The Front End


The Pure CSS framework isn't super helpful to a non-designer like me. But it worked. Most of the scripting {hidden divs etc} is jQuery. The API calls and returns are handled by AJAX.