Archived
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:
@@ -0,0 +1,22 @@
|
||||
// Names withheld at a victim's request (names-withheld.json). Used by every export.
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
const WITHHELD: Record<string, { victim_title: string; replace: [string, string][] }> = JSON.parse(
|
||||
readFileSync(new URL("names-withheld.json", import.meta.url), "utf8"),
|
||||
);
|
||||
// columns that point at sources; sources may name the victim
|
||||
const LEFT_ALONE = /^(source_\d+|url_\d+|other_source_urls|dossier_file|id|case_id)$/;
|
||||
|
||||
export const withhold = (id: number | string, column: string, value: string): string => {
|
||||
const rule = WITHHELD[String(id)];
|
||||
if (!rule || LEFT_ALONE.test(column)) return value;
|
||||
if (column === "victim" || column === "title") return rule.victim_title;
|
||||
let text = value;
|
||||
for (const [from, to] of rule.replace) text = text.split(from).join(to);
|
||||
// a replacement that now opens a sentence or a summary section
|
||||
return text.replace(/(^|[.!?]\s+|\*\*\s+)the victim/g, (_, before) => `${before}The victim`);
|
||||
};
|
||||
|
||||
// every field quoted: a spreadsheet import that also splits on semicolons or tabs cannot break a cell
|
||||
export const csvCell = (value: unknown): string =>
|
||||
'"' + (value == null ? "" : String(value)).replace(/\s*[\r\n]+\s*/g, " ").replace(/"/g, '""') + '"';
|
||||
Reference in New Issue
Block a user