[object Object]

← back to AsSeenInMovies

wikidata-enrich: add --byCast (filter to role=actor) to target high-yield enrichment pool

8205ad7d6b3753cfc544732a54b13b2f776201af · 2026-05-12 15:37:42 -0700 · SteveStudio2

Files touched

Diff

commit 8205ad7d6b3753cfc544732a54b13b2f776201af
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Tue May 12 15:37:42 2026 -0700

    wikidata-enrich: add --byCast (filter to role=actor) to target high-yield enrichment pool
---
 scrapers/wikidata-enrich.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/scrapers/wikidata-enrich.js b/scrapers/wikidata-enrich.js
index 30fdbf4..5b8ab70 100644
--- a/scrapers/wikidata-enrich.js
+++ b/scrapers/wikidata-enrich.js
@@ -166,7 +166,17 @@ async function enrichPeople() {
   // BY_CREDITS = join credit-count and rank desc — most-credited untouched people first.
   // Hit rate on bg1/bg2 random ordering was ~7-11%; credit-ranked should jump
   // because famous actors have wikipedia articles.
-  const sel = BY_CREDITS ? await pool.query(`
+  // BY_CAST = people whose top credit is 'cast' (actors). bg1=11%, bg2=6.9%,
+  // bg3 (credit-rank) only 3.1% because most-credited rows are crew (production
+  // designers, costumes), not famous actors. Cast-ranked should swing back up.
+  const BY_CAST = args.byCast;
+  const sel = BY_CAST ? await pool.query(`
+    SELECT DISTINCT p.id, p.imdb_id
+      FROM asim_people p
+      JOIN asim_credits c ON c.person_id = p.id AND c.role = 'actor'
+     WHERE p.imdb_id LIKE 'nm%' AND p.wikidata_id IS NULL
+     ORDER BY p.id
+     LIMIT $1`, [LIMIT]) : BY_CREDITS ? await pool.query(`
     SELECT p.id, p.imdb_id
       FROM asim_people p
       JOIN (SELECT person_id, count(*) AS c FROM asim_credits GROUP BY person_id) cc

← 67784fe asseeninmovies: /movies + /people sort dropdowns + density s  ·  back to AsSeenInMovies  ·  asseeninmovies: live home page — stats + 2 random-sampled ra 57e1b20 →