- apps/atlas: the web page (valley map, route flow, Dragon Register) - packages/core: coding rules and statistics (engine.js) and the shared route graph (graph.js): scene graph, decision-variable graph, bot-to-form crosswalk, Beta credible intervals - packages/ingest: DragonKind bot importer to anonymised trajectories (no prose, no account identifiers); data/bot holds Ken's sample - research/python: independent reference implementation + update_sources.py - tests: JS/Python parity checks and graph/importer unit tests - CI, GitHub Pages deploy, daily check of the community sheets and route PDF - Email addresses in free-text form answers are redacted; the raw spreadsheet is not committed - MIT code licence, CC BY 4.0 data licence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
22 lines
944 B
Python
22 lines
944 B
Python
"""Check that the JS engine (packages/core/src/engine.js) and the Python reference (python/clean.py) code every run identically."""
|
|
import json, sys
|
|
import pandas as pd
|
|
js = pd.DataFrame(json.load(open(sys.argv[1] if len(sys.argv) > 1 else "tests/out/runs_js.json")))
|
|
py = pd.read_csv(sys.argv[2] if len(sys.argv) > 2 else "data/derived/runs_clean.csv", keep_default_na=False, na_values=[""])
|
|
def norm(v):
|
|
if v is None or (not isinstance(v, str) and pd.isna(v)) or v == "":
|
|
return None
|
|
if isinstance(v, float) and v.is_integer():
|
|
return str(int(v))
|
|
if isinstance(v, bool):
|
|
return str(v)
|
|
return str(v)
|
|
bad = {}
|
|
for c in py.columns:
|
|
a, b = [norm(v) for v in py[c]], [norm(v) for v in js[c]]
|
|
d = [(i, x, y) for i, (x, y) in enumerate(zip(a, b)) if x != y]
|
|
if d:
|
|
bad[c] = (len(d), d[:3])
|
|
print("runs:", len(py), len(js), "| mismatching columns:", bad or "NONE")
|
|
sys.exit(1 if bad else 0)
|