feat(verify): Wikipedia Commons smartphone image backfill - #85
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New tool
app/verify/wikipedia_image_backfill.py: for smartphone records with an explicitimage_url: nulland an already-cited Wikipedia source_url, fetch the article's lead image via the Wikipedia API, resolve it on Commons, and only accept it if (a) the license is a permissive/free one (CC0/CC-BY/CC-BY-SA — non-free/fair-use rejected), (b) the file is JPEG/WebP (PNG/SVG rejected as logo/diagram-shaped), and (c) the filename/description carries the exact model identity (reusesvariant_conflictfromwikipedia_smartphone_backfill.pyto reject Pro/Plus/etc mismatches, rejects brand-only or "series" group-photo matches).Iterated through several dry-run rounds against real failure modes before running for real: generic renders (iPod touch PNG), unrelated photos (a damaged battery, a company HQ building), and identity mismatches (P40 photo used for P40 Pro, OnePlus Ace 3 used for OnePlus 12R) were all caught and gated out before any data was written.
Applied to TechAPI: 47/354 eligible records got a real, licensed image (CC-BY-SA-4.0 ×29, CC-BY-2.0 ×6, CC-BY-4.0 ×5, CC0-1.0 ×4, CC-BY-SA-2.0/3.0 ×2). 113 had no usable Wikipedia image, 1 was non-free-licensed, 193 were rejected as logo-like or identity mismatches — left null rather than guessed.
Test plan
pytest tests/verify/test_wikipedia_image_backfill.py— passed