CWI catalog dataset: tracks + Agent Deck SKUs + curator/placement/press/training files + discovery-flags.jsonl (52-track ROAD-1M discovery flags, Diabolique = Oct 2026 Discovery Mode; metadata-only, verified signals)
e34024a verified Download validate.py from BlackLansky/cwi-catalog: direct link, hf CLI and curl.
- Browser
- Download file 5.87 kB
-
https://huggingface.co/datasets/BlackLansky/cwi-catalog/resolve/main/validate.py
- Command line
-
hf download hf://datasets/BlackLansky/cwi-catalog/validate.py
-
curl -L -o validate.py https://huggingface.co/datasets/BlackLansky/cwi-catalog/resolve/main/validate.py
5.87 kB
| #!/usr/bin/env python3 | |
| """Validate the HF dataset staging files for BlackLansky/cwi-catalog. | |
| Checks only what can be honestly checked: valid JSON/JSONL syntax, | |
| non-empty required fields, uniqueness of identifiers, provenance | |
| traceability, and format invariants (e.g. the Needle Drop ledger must | |
| ship with verified_placements empty — entries only on verification). | |
| Nothing is assumed or inferred beyond the source files. | |
| """ | |
| import json | |
| import os | |
| import sys | |
| BASE = os.path.dirname(os.path.abspath(__file__)) | |
| errors = [] | |
| def load_jsonl(path): | |
| rows = [] | |
| with open(path, encoding="utf-8") as f: | |
| for i, line in enumerate(f, 1): | |
| line = line.strip() | |
| if not line: | |
| continue | |
| try: | |
| rows.append(json.loads(line)) | |
| except json.JSONDecodeError as e: | |
| errors.append(f"{os.path.basename(path)} line {i}: invalid JSON ({e})") | |
| return rows | |
| def load_json(path): | |
| try: | |
| with open(path, encoding="utf-8") as f: | |
| return json.load(f) | |
| except json.JSONDecodeError as e: | |
| errors.append(f"{os.path.basename(path)}: invalid JSON ({e})") | |
| return None | |
| def require(rows, fname, fields): | |
| for i, r in enumerate(rows, 1): | |
| for field in fields: | |
| v = r.get(field) | |
| if v is None or (isinstance(v, str) and not v.strip()) or (isinstance(v, (list, dict)) and len(v) == 0): | |
| errors.append(f"{fname} line {i}: empty required field '{field}'") | |
| def check_provenance(rows, fname, marker): | |
| for i, r in enumerate(rows, 1): | |
| src = r.get("dataset_provenance", {}).get("source", "") | |
| if marker not in src: | |
| errors.append(f"{fname} line {i}: provenance missing (expected '{marker}')") | |
| # ---- catalog.jsonl (verified track metadata, 36 tracks as of 2026-10-06) ---- | |
| catalog = load_jsonl(os.path.join(BASE, "catalog.jsonl")) | |
| # spotify_url is optional: pre-release / non-Spotify tracks carry null (validated below). | |
| require(catalog, "catalog.jsonl", ["title", "artist", "label", "dataset_provenance"]) | |
| check_provenance(catalog, "catalog.jsonl", "cwi-learn/catalog.json") | |
| titles = [r["title"] for r in catalog] | |
| if len(titles) != len(set(titles)): | |
| errors.append("catalog.jsonl: duplicate track titles") | |
| if {r["artist"] for r in catalog} != {"That Boy Hi Hat", "Dre50", "183 Wildboi", "King Akeem"}: | |
| errors.append("catalog.jsonl: unexpected artist values") | |
| for i, r in enumerate(catalog, 1): | |
| # Pre-release / non-Spotify tracks legitimately carry null spotify_url | |
| # (e.g. Cyberpunk 2027, Apple Music only until release). When present it | |
| # must be a canonical Spotify track URL. | |
| su = r.get("spotify_url") | |
| if su is not None and not su.startswith("https://open.spotify.com/track/"): | |
| errors.append(f"catalog.jsonl line {i}: bad spotify_url") | |
| # ---- products.jsonl (Agent Deck registry, 26 SKUs) ---- | |
| products = load_jsonl(os.path.join(BASE, "products.jsonl")) | |
| require(products, "products.jsonl", ["sku_id", "name", "department", "description", "schema_url", "dataset_provenance"]) | |
| for i, r in enumerate(products, 1): | |
| src = r.get("dataset_provenance", {}).get("source", "") | |
| if "cwi-learn/datasets/agent-deck-skus.jsonl" not in src and "playback-chip" not in src: | |
| errors.append(f"products.jsonl line {i}: provenance missing (expected registry or playback-chip source)") | |
| sku_ids = [r["sku_id"] for r in products] | |
| if len(sku_ids) != len(set(sku_ids)): | |
| errors.append("products.jsonl: duplicate sku_id values") | |
| if len(products) != 26: | |
| errors.append(f"products.jsonl: expected 26 SKUs, found {len(products)}") | |
| # ---- tracks.jsonl (canonical training dataset, 36 rows as of 2026-10-06) ---- | |
| tracks = load_jsonl(os.path.join(BASE, "tracks.jsonl")) | |
| require(tracks, "tracks.jsonl", ["title", "artist"]) | |
| if len(tracks) != 36: | |
| errors.append(f"tracks.jsonl: expected 36 rows, found {len(tracks)}") | |
| if {r.get("artist") for r in tracks} != {"That Boy Hi Hat", "Dre50", "183 Wildboi", "King Akeem"}: | |
| errors.append("tracks.jsonl: unexpected artist values") | |
| # ---- placements.jsonl (Needle Drop ledger — ships honestly empty) ---- | |
| placements = load_jsonl(os.path.join(BASE, "placements.jsonl")) | |
| for i, r in enumerate(placements, 1): | |
| if r.get("verified_placements") != []: | |
| errors.append(f"placements.jsonl line {i}: verified_placements must stay empty until verified") | |
| # ---- curators.jsonl (curator verification records) ---- | |
| curators = load_jsonl(os.path.join(BASE, "curators.jsonl")) | |
| require(curators, "curators.jsonl", ["curator", "status", "as_of"]) | |
| valid_statuses = {"verified", "unverified", "unconfirmed"} | |
| for i, r in enumerate(curators, 1): | |
| if r.get("status") not in valid_statuses: | |
| errors.append(f"curators.jsonl line {i}: unknown status '{r.get('status')}'") | |
| # ---- press.jsonl (real press records) ---- | |
| press = load_jsonl(os.path.join(BASE, "press.jsonl")) | |
| require(press, "press.jsonl", ["title", "outlet", "url"]) | |
| # ---- training.json (corpus manifest) ---- | |
| training = load_json(os.path.join(BASE, "training.json")) | |
| if training is not None and "datasets" not in training: | |
| errors.append("training.json: missing 'datasets' key") | |
| print(f"catalog.jsonl: {len(catalog)} rows") | |
| print(f"products.jsonl: {len(products)} rows") | |
| print(f"tracks.jsonl: {len(tracks)} rows") | |
| print(f"placements.jsonl: {len(placements)} rows (verified_placements empty: " | |
| f"{all(r.get('verified_placements') == [] for r in placements)})") | |
| print(f"curators.jsonl: {len(curators)} rows") | |
| print(f"press.jsonl: {len(press)} rows") | |
| print(f"training.json: {'valid' if training is not None else 'INVALID'}") | |
| if errors: | |
| print("\nFAILURES:") | |
| for e in errors: | |
| print(" -", e) | |
| sys.exit(1) | |
| print("\nVALIDATE OK — all files valid; required fields present; provenance traceable; ledger honestly empty.") | |