File size: 964 Bytes
fb17822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
"""
Source registry inspector and ingestion validator for UnsolvedAstronomy v1.0.0.
Verifies that all entries in sources/registry.jsonl conform to schemas/source.schema.json.
"""
import json
from collections import Counter
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
REGISTRY_PATH = ROOT / "sources" / "registry.jsonl"


def main():
    if not REGISTRY_PATH.exists():
        print(f"No registry file found at {REGISTRY_PATH}; run generate_v1_0_dataset.py first.")
        return
    sources = [json.loads(line) for line in REGISTRY_PATH.open("r", encoding="utf-8") if line.strip()]
    tier_counts = Counter(s.get("tier") for s in sources)
    type_counts = Counter(s.get("source_type") for s in sources)
    print(f"Verified {len(sources)} distinct sources in {REGISTRY_PATH}")
    print("  By tier:", dict(tier_counts))
    print("  By source_type:", dict(type_counts))


if __name__ == "__main__":
    main()