Files
DB-cleanup/merge-output/dump_cell.py
SofiaandClaude Opus 4.8 ba7529ea50 K&R database cleanup: handoff bundle
Self-contained bundle to continue the case-summary enrichment pass (70/256 done). sources/ holds the 364 .txt dossiers; scripts use relative paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018FJRciSWZc9HftS2edbzBf
2026-09-02 19:49:46 -03:00

28 lines
918 B
Python

import sys, io, json, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import build_cases as b
sheet = b.load_sheet()
records = json.loads(b.JSONF.read_text(encoding="utf-8"))
mapping = b.build_mapping(sheet, records)
row_by_id = {jid: row for row, jid in mapping.items()}
sheet_by_row = {r["_row"]: r for r in sheet}
targets = json.loads(sys.argv[1]) # list of [id, col]
for jid, col in targets:
row = row_by_id.get(jid)
print(f"\n===== case {jid} col={col} sheet_row={row} =====")
if row is None:
print(" NO SHEET ROW MAPPED")
continue
rec = sheet_by_row.get(row)
cell = rec.get(col)
if not isinstance(cell, str):
print(" CELL EMPTY / NON-STRING")
continue
lines = cell.split("\n")
for i, ln in enumerate(lines):
print(f"[{i}] {ln}")