# Rating & Genre Data Sources — A Map **Date**: 2026-09-06 **Status**: Current (reflects `analysis/knowledge.py` as of the `get_rating` normalization fix this date) This project has three independent sources of truth about a game, and it's easy to query the wrong one and get a plausible-looking but incorrect answer. This doc maps what each source actually contains, which one the pipeline uses for what, and the gaps between them — found the hard way, by comparing raw queries against what `KnowledgeBase.get_rating()` actually returns for the same title. ## The three sources | Source | Table | Populated by | Carries | |---|---|---|---| | DAT files | (files under `dats/`, parsed at RESOLVE/CATALOG time) | Retool / No-Intro / Redump | Which releases exist, 1G1R selection, region/language tags. **No rating, no genre.** | | ScreenScraper | `scraped_games` | `romfarmer metadata`/scraper import | `rating` (FLOAT), `genre` (VARCHAR, ScreenScraper's own taxonomy), keyed by `(system, name)` — `name` is the **bare title**, no region/revision tags. | | MobyGames | `external_scores` | `romfarmer scores` | `critic_score` (unused — always NULL in this DB), `user_score`, `genres` (comma-separated free text), keyed by `(platform, normalized_title)`. `source` column exists for RAWG too but RAWG has never actually been populated — every one of the 37,781 rows in this DB is `source='mobygames'`. | DAT files answer "what should exist and which release is canonical." Neither ScreenScraper nor MobyGames is consulted for *selection* — only for *ranking* (rating) once the DAT has already decided the candidate set. ## Which one wins for rating `KnowledgeBase.get_rating(platform, canonical_name)`: 1. Normalize `canonical_name` with `metadata/external_scores.py::normalize_title` (strips region/revision noise: `"Castlevania (USA) (v1.1)"` → `"castlevania"`). 2. Look up `external_scores` (MobyGames) by `(platform, normalized_title)`. If found, **this wins** — return `best_score_normalized` (`critic_score/100` if present, else `user_score/10`). 3. Otherwise fall back to `scraped_games` (ScreenScraper), matched by the **same normalized title** against `scraped_games.name`. 4. `None` if neither source has it — "unrated," not "bad." MobyGames is deliberately primary. It should be — see resolution below — but its coverage is partial, so the fallback matters and has to actually work. ## Resolution: MobyGames is real signal, ScreenScraper is a star rating Measured directly against `mastersystem` (2026-09-06): - **MobyGames**: 299 titles, **38 distinct score values**, smooth spread from 0.44–0.85 with a real bell-curve shape peaking around 0.65–0.75. - **ScreenScraper**: effectively **5 distinct values** (0.2 / 0.4 / 0.6 / 0.8, plus unrated) — a 0–5 star rating rescaled to 0–1, not a continuous score. If a build needs to distinguish "good" from "great," MobyGames is the only source that can do it. ScreenScraper can only tell you "bad / mediocre / fine / good." ## Coverage: MobyGames is real signal on a minority of titles MobyGames coverage vs. ScreenScraper's raw scrape count (which includes every regional variant before 1G1R filtering, so treat as an upper bound on unique games, not a 1:1 count): | Platform | MobyGames rows | ScreenScraper rows | |---|---|---| | mastersystem | 299 | 1,139 | | nes | 782 | 8,000 | | psx | 1,510 | 10,850 | MobyGames is a commercial-release-focused database. It has essentially no coverage of unlicensed/aftermarket/homebrew releases (Korean Master System bootlegs, hobbyist homebrew, etc.) — exactly the titles where the ScreenScraper fallback is the *only* rating data that exists at all, coarse as it is. ## The bug this doc exists because of (fixed 2026-09-06) The ScreenScraper fallback used to match `ScrapedGame.name == canonical_name` **exactly**, with no normalization — comparing a bare title (`"Dinosaur Dooley, The"`) against a DAT-tagged canonical name (`"Dinosaur Dooley, The (Korea) (En) (Unl)"`). Those can never be equal. Every title MobyGames didn't cover was silently returning `None` ("unrated") instead of falling back to a real, if coarse, ScreenScraper score. Fixed by applying the same `normalize_title()` used for the MobyGames lookup to both sides of the ScreenScraper match (see `KnowledgeBase._scraped_ratings_by_normalized_name`). Verified: "Dinosaur Dooley, The (Korea) (En) (Unl)" now correctly returns 0.4 instead of `None`. ## Genre Genre-based selection (e.g. "all the shoot'em ups") is **not a native Spec pass** — there's no `passes.genre` field. It has to be authored as a `curated_lists` artifact by querying `scraped_games.genre` directly (see `artifacts/curated/mastersystem-shootemups/` for a worked example) and cross-matching the game names against the real DAT canonical names. Worth knowing for next time: **`external_scores.genres` (MobyGames) is also fully populated** (100% of rows, in this DB) and is more granular than ScreenScraper's genre field — e.g. `"Action, Side view, 2D scrolling, Beat 'em up / brawler, Direct control, Fantasy, Regional differences"` vs ScreenScraper's `"Shoot'em Up / Vertical, Shoot'em Up"`. It was not used for the shoot'em-up selection (ScreenScraper's simpler, more consistent taxonomy was easier to pattern-match on for that specific ask), but for finer-grained or sub-genre curation it may be the better source — same coverage caveat as ratings applies (commercial titles only). ## Practical guidance - **Need a rating for selection or CostModel work?** Call `KnowledgeBase.get_rating()` — never query `scraped_games` or `external_scores` directly. The two-source precedence and normalization live there; a raw query against either table in isolation will silently disagree with what the pipeline actually uses. - **Need genre?** There's no equivalent single accessor yet — both `scraped_games.genre` and `external_scores.genres` are real columns, queried directly. Match by normalized title, not exact string, same lesson as above. - **Need to know if a title exists at all?** That's the DAT, not either scrape source — `dat_filter`/`dat_dedup` passes, not rating/genre. ## Known stale doc `docs/reference/ROM_TRANSFORMATION_TRACKING.md` (Oct 2025) describes the `rom_transformations` tracking system, which was deleted 2026-09-06 (see project memory: legacy pre-CAS cache cleanup) along with `hash_cache` and `zip_content_cache`. That doc was not updated as part of this pass — it documents a system that no longer exists.