chore: final state before the move to gart/gart-databases

Commits the work done since 2026-10-01 that was still local: the four-step
label and flag passes, the triage and recheck files, the v1 exports of
2026-10-06 and 2026-10-07, the split dossiers, and the Lopp PR 234 batch
(scripts, agent prompts, reader and checker files, the flag re-read of
2026-10-17, the review workbook and the import set of the 57 cases added
to stats2 as 506 to 562). Raw HTML and node_modules stay out (.gitignore).

The stats2 material in use was copied to gart/gart-databases (stats2/) on
2026-10-17; README-START-HERE.md now says so. This repo is closed.
This commit is contained in:
StellarCrow
2026-10-17 10:47:37 +02:00
parent 0f7a691151
commit 41766c68a2
3196 changed files with 374809 additions and 485 deletions
+51
View File
@@ -0,0 +1,51 @@
// Writes the inputs of the flag re-read of 2026-10-17 (owner's flag definitions of 2026-10-16):
// work/flags-in/<key>.txt the entry's current flags and obtained labels, Lopp's line, and the kept text of every page
// batches/flags-NN.json the keys of each batch of 10
// Every entry with values is included. bun prepflags.ts
import { mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
import { join } from "path";
import { loadCase, pageParas, parseKeep } from "./lib.ts";
const HERE = import.meta.dir;
const entries = new Map((JSON.parse(readFileSync(join(HERE, "work/entries.json"), "utf8")) as any[]).map((e) => [e.key, e]));
mkdirSync(join(HERE, "work/flags-in"), { recursive: true });
const FIELDS = ["detention", "violence_torture", "drugs_alcohol", "weapons", "theft", "life_taken"];
const keys: string[] = [];
for (const f of readdirSync(join(HERE, "work/out")).filter((f) => f.endsWith(".json")).sort()) {
const key = f.replace(/\.json$/, "");
const o = loadCase(key);
const v = o.values && Object.keys(o.values).length ? o.values : null;
if (!v) continue;
const e = entries.get(key);
const out = [
`KEY ${key}`,
`STATUS ${o.status}`,
"",
"CURRENT VALUES (written under the old rule, to be re-read)",
...FIELDS.map((k) => ` ${k.padEnd(17)} ${v[k] ?? ""}`),
` ${"obtained".padEnd(17)} ${(v.obtained ?? []).join("; ")}`,
"",
"LOPP'S LINE (a lead, not a source; the only text for a no-source entry)",
` ${e?.lopp_label ?? ""}`,
"",
];
for (const pg of o.pages ?? []) {
const nums = parseKeep(String(pg.keep ?? ""));
if (nums === null) throw new Error(`${key}: ${pg.file}: keep "${pg.keep}" is not a paragraph list`);
if (!nums.length) continue;
const head = readFileSync(join(HERE, pg.file), "utf8");
const title = /^Title {6}(.*)$/m.exec(head)?.[1] ?? "";
const url = /^URL {8}(.*)$/m.exec(head)?.[1] ?? "";
const paras = pageParas(pg.file);
out.push(`=== ${pg.file}`, `URL ${url}`, `TITLE ${title}`, "");
for (const n of nums) {
if (!paras.has(n)) throw new Error(`${key}: ${pg.file}: paragraph ${n} does not exist`);
out.push(`[${n}] ${paras.get(n)}`, "");
}
}
if (!out.some((l) => l.startsWith("=== "))) out.push("NO KEPT ARTICLE TEXT: only Lopp's line above is on file.");
writeFileSync(join(HERE, "work/flags-in", `${key}.txt`), out.join("\n") + "\n");
keys.push(key);
}
for (let i = 0; i * 10 < keys.length; i++) writeFileSync(join(HERE, "batches", `flags-${String(i + 1).padStart(2, "0")}.json`), JSON.stringify(keys.slice(i * 10, i * 10 + 10)));
console.log(`${keys.length} entries, ${Math.ceil(keys.length / 10)} batches`);