diff --git a/merge-output/export_xlsx.py b/merge-output/export_xlsx.py index 1ebbe23..fa66bd4 100644 --- a/merge-output/export_xlsx.py +++ b/merge-output/export_xlsx.py @@ -115,7 +115,9 @@ def main(): "description", "notes", "money_wanted", "coin_type", "reports", "url", "url_2", "url_3", "url_4", "url_5"] cov_cols = ["sources_with_text", "article_chars", "untrimmed_blocks", "summary_status", "summary_chars"] new_cols = ["venue_of_control", "held_duration", "outcome", "arrests", "amount_demanded_usd", "amount_taken_usd"] - cols = base_cols + FLAGS + cov_cols + new_cols + ["summary"] + SCEN = VOCAB["scenario (11 labels)"] + scen_cols = ["S: " + n for n in SCEN] + ["scenarios_in_order"] + cols = base_cols + scen_cols + FLAGS + cov_cols + new_cols + ["summary"] LABEL = {"kidnappings": "detention"} # the DB column keeps its old name; the export shows the glossary name ws.append([LABEL.get(c, c) for c in cols]) for c in ws[1]: @@ -133,7 +135,13 @@ def main(): sstat = "bulk, short" else: sstat = "bulk, unverified" - row = [r.get(k) for k in base_cols] + [r.get(k) for k in FLAGS] + \ + tags = build_signature(r, r.get("scenario")) if build_signature else [ + {"scenario": r.get("scenario"), "status": "confirmed"}] + tagmap = {t["scenario"]: t["status"] for t in tags} + scen_vals = [(1 if tagmap.get(n) == "confirmed" else ("p" if tagmap.get(n) == "proposed" else None)) for n in SCEN] + seq_text = " > ".join([t["scenario"] for t in tags if t["status"] == "confirmed"] + + [t["scenario"] + " (p)" for t in tags if t["status"] == "proposed"]) + row = [r.get(k) for k in base_cols] + scen_vals + [seq_text] + [r.get(k) for k in FLAGS] + \ [n_src, chars, untr, sstat, len(r.get("summary") or "")] # rule-derived proposals for the new columns venue = held = outcome = None @@ -155,6 +163,15 @@ def main(): for j, k in enumerate(cols, 1): cell = ws.cell(row=rown, column=j) v = cell.value + if k.startswith("S: "): + if v == "p": + cell.fill = BLUE + elif v is None and r.get("scenario") not in SCEN: + cell.fill = RED + continue + if k == "scenarios_in_order": + cell.fill = ORANGE if "(p)" in (v or "") or len(tags) == 1 else None + continue if k in FLAGS and v is None: cell.fill = RED elif k == "kidnappings" and cid in det and str(det[cid].get("status", "")).startswith(("ACCEPTED", "proposed")) \ @@ -177,8 +194,8 @@ def main(): cell.fill = BLUE if v not in (None, "") else ORANGE ws.freeze_panes = "B2" for j, k in enumerate(cols, 1): - ws.column_dimensions[get_column_letter(j)].width = 60 if k in ("summary", "description") else ( - 28 if k in ("victim", "location", "money_wanted", "url") else 14) + ws.column_dimensions[get_column_letter(j)].width = 60 if k in ("summary", "description", "scenarios_in_order") else ( + 28 if k in ("victim", "location", "money_wanted", "url") else (8 if k.startswith("S: ") else 14)) ws.auto_filter.ref = ws.dimensions # ---------------- case_scenarios ---------------- diff --git a/merge-output/exports/.~lock.gart-kr-database-2026-09-15.xlsx# b/merge-output/exports/.~lock.gart-kr-database-2026-09-15.xlsx# index 24ac702..40332dc 100644 --- a/merge-output/exports/.~lock.gart-kr-database-2026-09-15.xlsx# +++ b/merge-output/exports/.~lock.gart-kr-database-2026-09-15.xlsx# @@ -1 +1 @@ -,disi,pop-os,15.09.2026 15:33,file:///home/disi/.config/libreoffice/4; \ No newline at end of file +,disi,pop-os,17.09.2026 17:23,file:///home/disi/.config/libreoffice/4; \ No newline at end of file diff --git a/merge-output/exports/gart-kr-database-2026-09-15.xlsx b/merge-output/exports/gart-kr-database-2026-09-15.xlsx deleted file mode 100644 index e882859..0000000 Binary files a/merge-output/exports/gart-kr-database-2026-09-15.xlsx and /dev/null differ diff --git a/merge-output/exports/gart-kr-database-2026-09-17.xlsx b/merge-output/exports/gart-kr-database-2026-09-17.xlsx new file mode 100644 index 0000000..648a8ff Binary files /dev/null and b/merge-output/exports/gart-kr-database-2026-09-17.xlsx differ