#!/usr/bin/env python3 """Inspect gwshop catalog shape: Space Marines chapters, AoS, dedupe stats.""" import json import pathlib from collections import Counter cat = json.loads(pathlib.Path("data/gwshop_catalog.json").read_text(encoding="utf-8")) entries = cat["entries"] def show(pred, label, n=6): print(f"--- {label}") shown = 0 for e in entries: if pred(e): p = " > ".join(x for x in (e["system"], e["group"], e["faction"], e["subfaction"], e["class"]) if x) print(f" {e['name'][:60]!r} -> {p}") shown += 1 if shown >= n: break show(lambda e: e["group"] == "Space Marines", "Space Marines group samples") show(lambda e: e["group"] == "Armies of the Imperium" and e["subfaction"], "Imperium with subfaction") show(lambda e: e["system"] == "Age of Sigmar", "Age of Sigmar samples", 5) show(lambda e: e["system"] == "The Old World", "Old World samples", 5) show(lambda e: e["system"] == "Other Games", "Other Games samples", 5) show(lambda e: e["group"] == "Unit Type", "Unit Type branch", 6) names = Counter(e["name"].casefold() for e in entries) dups = {n: c for n, c in names.items() if c > 1} print("duplicate names:", len(dups), "example:", list(dups.items())[:3]) # faction-level value census for 40k print("--- 40k factions census") print(Counter(e["faction"] for e in entries if e["system"] == "Warhammer 40,000").most_common(40))