baseball-engine / tools /evaluation /inspect_reference_csv.py
github-actions[bot]
Automated Deploy: a19ede424a80b7b8d7f6978585141d1bb45de69c
326d3cc
Raw History Blame Contribute Delete
886 Bytes
"""Inventory accessible reference tables without inventing paired video labels."""
import argparse,csv,json
from pathlib import Path
import sys
sys.path.insert(0,str(Path(__file__).resolve().parents[2]))
from baseball_batting.storage import sha256_file,atomic_json
p=argparse.ArgumentParser();p.add_argument("csv");p.add_argument("--source-url",required=True);p.add_argument("--output",required=True);p.add_argument("--population",required=True)
a=p.parse_args()
with Path(a.csv).open(newline="") as f:
reader=csv.DictReader(f);rows=list(reader);columns=reader.fieldnames
record={"source_url":a.source_url,"sha256":sha256_file(a.csv),"rows":len(rows),"columns":columns,"population":a.population,
"role":"reference_distribution_candidate","paired_video_validation":False,"commercial_license_review":"deferred"}
atomic_json(a.output,record);print(json.dumps(record,indent=2))