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:
co-authored by
Claude Opus 5.5
parent
61bc50583c
commit
3b24a11f5a
@@ -0,0 +1,26 @@
|
||||
"""Files written from the declarative specs, so each rule has one source of truth:
|
||||
.github/ISSUE_TEMPLATE/report-a-run.yml from collection/specs/report_form.yaml (report_form.render)
|
||||
the CROSSWALK block of core/graph.js from collection/specs/bot.yaml (Ken's bot uses it at run time)
|
||||
"""
|
||||
import json
|
||||
|
||||
from .common import path, read_yaml
|
||||
|
||||
GRAPH_JS = "core/graph.js"
|
||||
BEGIN = " // BEGIN CROSSWALK"
|
||||
END = " // END CROSSWALK\n"
|
||||
|
||||
|
||||
def graph_js():
|
||||
"""core/graph.js with its CROSSWALK block rewritten from the bot spec."""
|
||||
text = path(GRAPH_JS).read_text(encoding="utf-8")
|
||||
a = text.index(BEGIN)
|
||||
a = text.index("\n", a) + 1
|
||||
b = text.index(END, a)
|
||||
rules = read_yaml("collection/specs/bot.yaml")["crosswalk"]
|
||||
lines = [" const CROSSWALK = ["]
|
||||
for i, (rx, col, val) in enumerate(rules):
|
||||
sep = "," if i < len(rules) - 1 else ""
|
||||
lines.append(f" [/{rx.replace('/', chr(92) + '/')}/, {json.dumps(col)}, {json.dumps(val, ensure_ascii=False)}]{sep}")
|
||||
lines.append(" ];")
|
||||
return text[:a] + "\n".join(lines) + "\n" + text[b:]
|
||||
Reference in New Issue
Block a user