~2 min read

From Collecting Film Data to Recommendations

I collected and cleaned movie data, then built recommendation, trend, era, and person analyses on top. The core was not a fancy model but the tedious work of merging the same person into one entity, and a data model reusable across domains.

ProjectDataRecommendation

Why I Built It

Whenever we pick a film on Netflix, play a song, or buy a book, there is always data behind it. Title, genre, synopsis, director, cast, rating, popularity. Collect and organize it well, and you can answer four questions.

  • If you liked this, what's next? (Recommendation)
  • Which genres are rising lately? (Trend)
  • How does the 2000s differ from the 2020s? (Era)
  • Who does this director work with most? (Person)

I took film as the first target and built the whole thing myself, from fetching the data to the screen that shows the results.

The Whole Picture

Data becomes analyzable through several stages.

collect → raw store → preprocess(normalize/merge) → clean tables → analyze → dashboard
 TMDB    raw_payload        normalize/entity          work/person…   SQL+calc   Flask

I keep the raw response untouched (raw_payload) and clean it in a later step. That way, when I change the preprocessing logic, I can reprocess from the raw data without collecting again.

The Data Structure Mattered More Than the Model

Splitting works, people, and relationships into separate tables is the spine of this project.

work        -- shared info for a work (film, music, book…)
person      -- a person (a merged, canonical entity)
credit      -- work ↔ person relation (director/actor…)
metric      -- popularity/rating over time (source of trends)

Stuff it all into one table and counting "films by Bong Joon-ho" means repeating the name everywhere, and one spelling difference breaks the count. Store a person once in person and link via credit, and the same structure holds whether it's film or music. Bolt on Spotify later and you just change domain.

The Tedious but Decisive Step — Entity Resolution

The problem that took longest in preprocessing was that the same person appears differently across records.

"봉준호" / "Bong Joon-ho" / "Joon-ho Bong" are all the same person.

Fail to merge them and a filmography splits into three pieces. So I merged in three passes.

# 1) same source + same ID → definitely one person (highest confidence)
# 2) exact match on a normalized name key → reuse
# 3) otherwise, compare candidates by string similarity (rapidfuzz)
score = fuzz.token_sort_ratio(key, existing_key)
if score >= 92:   # above threshold → same person
    return existing_id

Verifying the result: Song Kang-ho appears in 5 films but is stored as exactly one person. This merge holds up the entire "person analysis" that follows.

Recommendation — Turning Plots into Numbers

Computers don't read text, so each film becomes a number vector (embedding). I started with genres and tags only; adding the synopsis made results noticeably more natural.

Because it's Korean, I used character-level n-gram TF-IDF (no morphological analyzer). I normalized the genre/tag (word-level) and synopsis (char-level) signals, then combined them with a weight.

tag_mat = normalize(TfidfVectorizer().fit_transform(tag_docs))
syn_mat = normalize(TfidfVectorizer(analyzer="char_wb",
                                    ngram_range=(2, 3)).fit_transform(syn_docs))
combined = hstack([tag_mat * (1 - w), syn_mat * w])   # w = synopsis weight

Then I picked similar works by cosine similarity. For "Parasite," weighting the plot pushed the family drama "Minari" toward the top.

Parasite →  0.143 Minari · 0.123 Snowpiercer · 0.119 Train to Busan · 0.098 The Host

The Other Three Systems, and the Screen

  • Trend stacks metric over time to see rising popularity and genre shifts by year.
  • Era analysis buckets release years by decade to compare counts, average rating, and runtime.
  • Person analysis counts people who appear together to build a collaboration network (Bong–Song, 3 times).

Finally I wrapped these four into matplotlib charts and a Flask dashboard/API, so picking a film in the browser instantly shows recommendations as a bar chart.

Reflections

  • The recommendation algorithm itself was a few lines. The real work was merging people into one entity and designing tables reusable across domains.
  • Storing the untouched response let me rerun preprocessing as many times as I wanted.
  • With only 12 sample films, statistical meaning is limited, and the recommender is content-based only. Attaching real data and adding collaborative filtering is the next task.