feat(export): drop case_scenarios and case_violence sheets; scenarios live in the S: columns

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZZENdTLzNGsbNy4DyF1yt
This commit is contained in:
StellarCrow
2026-09-18 23:36:29 +02:00
co-authored by Claude Fable 5.1
parent 8ddc5de806
commit a2e7290400
2 changed files with 1 additions and 57 deletions
+1 -57
View File
@@ -6,10 +6,6 @@ Sheets
attacks one row per case: current columns, source coverage, summary status, the attacks one row per case: current columns, source coverage, summary status, the
six flags, and the new fact columns (venue_of_control, held_duration, six flags, and the new fact columns (venue_of_control, held_duration,
outcome, arrests, amount_demanded_usd, amount_taken_usd) outcome, arrests, amount_demanded_usd, amount_taken_usd)
case_scenarios one row per scenario tag: the confirmed v1 label (seq 1) and the tags the
site's signature engine proposes (status proposed)
case_violence one row per (case, category) seeded from the six flags; subtype, target
and evidence are empty until a person fills them from the dossier
vocabulary the controlled value lists for every typed column vocabulary the controlled value lists for every typed column
legend what the colours mean legend what the colours mean
@@ -209,58 +205,6 @@ def main():
28 if k in ("victim", "location", "money_wanted", "url") else (8 if k.startswith("S: ") else 14)) 28 if k in ("victim", "location", "money_wanted", "url") else (8 if k.startswith("S: ") else 14))
ws.auto_filter.ref = ws.dimensions ws.auto_filter.ref = ws.dimensions
# ---------------- case_scenarios ----------------
ws2 = wb.create_sheet("case_scenarios")
ws2.append(["case_id", "seq", "scenario", "phase_role", "status", "source", "rationale"])
for c in ws2[1]:
c.font = Font(bold=True)
c.fill = HEAD
role = {"Costly Fame": "initiation", "Malicious Invitation - SocialEng": "initiation", "P2P Trade Gone Wrong": "initiation",
"Authority Misuse": "initiation", "Swatting": "initiation", "Home Invasion": "execution",
"Armed Robbery in Public Space": "execution", "Assault - Mugging": "execution", "Kidnapping": "captivity",
"Express Kidnapping": "captivity", "Dodged Attack": "outcome"}
for r in recs:
tags = build_signature(r, r.get("scenario")) if build_signature else [
{"scenario": r.get("scenario"), "status": "confirmed", "source": "original", "rationale": "Original v1 scenario classification."}]
seq = 1
for t in tags:
ws2.append([r["id"], seq if t["status"] == "confirmed" else None, t["scenario"], role.get(t["scenario"]),
t["status"], t["source"], t["rationale"]])
if t["status"] == "proposed":
for c in ws2[ws2.max_row]:
c.fill = BLUE
else:
ws2.cell(row=ws2.max_row, column=2).fill = ORANGE # order of phases still to set
seq += 1
ws2.freeze_panes = "A2"
ws2.auto_filter.ref = ws2.dimensions
for j, w in enumerate([10, 6, 34, 12, 11, 10, 60], 1):
ws2.column_dimensions[get_column_letter(j)].width = w
# ---------------- case_violence ----------------
ws3 = wb.create_sheet("case_violence")
ws3.append(["case_id", "category", "subtype", "target", "evidence", "source"]) # category 'detention' = DB flag kidnappings
for c in ws3[1]:
c.font = Font(bold=True)
c.fill = HEAD
for r in recs:
for f in FLAGS:
v = r.get(f)
if v is None:
ws3.append([r["id"], CATEGORY_OF[f], None, None, None, "flag is null"])
for c in ws3[ws3.max_row]:
c.fill = RED
elif int(v) > 0:
n = int(v) if f == "life_taken" else 1
for _ in range(n):
ws3.append([r["id"], CATEGORY_OF[f], None, None, None, f"seeded from flag {LABEL.get(f, f)}={v}"])
for c in ws3[ws3.max_row][2:5]:
c.fill = ORANGE
ws3.freeze_panes = "A2"
ws3.auto_filter.ref = ws3.dimensions
for j, w in enumerate([10, 18, 32, 16, 60, 24], 1):
ws3.column_dimensions[get_column_letter(j)].width = w
# ---------------- sources ---------------- # ---------------- sources ----------------
ws6 = wb.create_sheet("sources") ws6 = wb.create_sheet("sources")
ws6.append(["case_id", "field", "on_db_record", "source", "verdict", "chars", "trimmed_by", "method", "fetched_at", ws6.append(["case_id", "field", "on_db_record", "source", "verdict", "chars", "trimmed_by", "method", "fetched_at",
@@ -343,7 +287,7 @@ def main():
out.mkdir(exist_ok=True) out.mkdir(exist_ok=True)
path = out / f"gart-kr-database-{date.today().isoformat()}.xlsx" path = out / f"gart-kr-database-{date.today().isoformat()}.xlsx"
wb.save(path) wb.save(path)
print(f"wrote {path} : attacks {ws.max_row - 1} rows, case_scenarios {ws2.max_row - 1}, case_violence {ws3.max_row - 1}") print(f"wrote {path} : attacks {ws.max_row - 1} rows, sources {ws6.max_row - 1}, detention_review {ws7.max_row - 1}")
if __name__ == "__main__": if __name__ == "__main__":