"""Could code find an escalation request where the judge did? Counts, per verdict kind, whether the worker's final message asks for a higher rung and whether the judge's verdict carried an escalation, and prints each disagreement with the words around it.""" import collections import re from cases import cases, last_run_text ASKS = re.compile(r"higher rung|rung up|one rung above", re.IGNORECASE) table = collections.Counter() for outcomes, (stamp, kind, block), entries in cases(): texts = last_run_text(entries) final = texts[-1] if texts else "" found = ASKS.search(final) escalated = "\nEscalation:\n" in block table[(kind, bool(found), escalated)] += 1 if bool(found) != escalated: around = final[max(0, found.start() - 200):found.end() + 150] if found else final[-300:] print(f"## {outcomes.parent.parent.name} {stamp} {kind} code={bool(found)} judge={escalated}\n {around!r}\n") for (kind, code, judge), count in sorted(table.items()): print(f"{kind}: code {code}, judge {judge}: {count}")