Collection as an ETL pipeline; runs_clean.csv from every source; Report a run

- collection/pipeline.yaml declares every source (extract kind, transform,
  privacy rules, load target, run source); `python -m collection update|build`
- extract keeps data/raw/<source>/current + previous only (git-ignored);
  data/manifest.json records the current raw checksum and change date
- transforms are pure; validate checks runs against data/dictionary.yaml
  before load; load writes byte-stable files only when they change
- data/public/runs_clean.csv: every run from every source with a new
  `source` column (reddit spreadsheet, reddit thread, reported, bot,
  reddit pdf); the sheet's own row label moves to `entry`; run_id is text
- bot importer ported to Python (same output as bot.js on the fixture);
  labels and crosswalk in collection/specs/bot.yaml, written into graph.js
- Reddit through the official API (result links to add by hand); the 12
  result pages move to collection/manual/reddit_results.yaml
- "Report a run": a GitHub issue form generated from
  collection/specs/report_form.yaml, collected as source "reported", plus a
  site tab pointing to it, the community spreadsheet and the megathread
- analysis and the route model read runs_clean.csv (sources in
  measures.yaml); stats.json and policy.json unchanged apart from the
  factor's new name
- daily workflow runs the pipeline; the raw store is kept between runs in
  the Actions cache, encrypted with RAW_ARCHIVE_KEY

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-04 02:46:48 +00:00
co-authored by Claude Opus 5.5
parent 61bc50583c
commit 3b24a11f5a
64 changed files with 8626 additions and 6909 deletions
+12 -11
View File
@@ -15,7 +15,14 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "core"))
from atlas import coding, model, solver # noqa: E402
from atlas import model, solver # noqa: E402
from atlas import runs as runs_io # noqa: E402
import yaml # noqa: E402
# the same runs the site's statistics use (analysis/stats/measures.yaml `sources`)
with open(ROOT / "analysis/stats/measures.yaml", encoding="utf-8") as _f:
SOURCES = yaml.safe_load(_f)["sources"]
def clean(o):
@@ -31,24 +38,18 @@ def clean(o):
return o
def coded_runs(path):
df, _ = coding.load(path)
runs = df.drop(columns=["run_id"]).astype(object).where(df.drop(columns=["run_id"]).notna(), None).to_dict("records")
return runs
def main(argv=None):
ap = argparse.ArgumentParser(description=__doc__)
ap.add_argument("--draws", type=int, default=200)
ap.add_argument("--data", default=str(ROOT / "data/public/form_responses.json"))
ap.add_argument("--data", default=str(runs_io.PATH))
ap.add_argument("--out", default=str(ROOT / "data/public/policy.json"))
a = ap.parse_args(argv)
rows = len(json.load(open(a.data, encoding="utf-8"))["rows"])
runs = coded_runs(a.data)
runs = runs_io.read(a.data, sources=SOURCES)
rows = len(runs)
samples = {
"all": runs,
"lowBias": [r for r in runs if r["source"] != "Form" or r["goal"] not in model.RARE_GOALS],
"lowBias": [r for r in runs if r["entry"] != "Form" or r["goal"] not in model.RARE_GOALS],
}
t0 = time.time()
out = {"schema": 1, "source": {"form_rows": rows}, "samples": {}}