"""Print the app-check distribution of the real piers (stage B, 2026-10-16) without touching data/: the piers are copied (without runs, backup and the DWG / DXF files) into 검증/autocheck_report_data and checked there. usage: python tools/report_autocheck.py [pier ...] -> per pier: counts of required bundles per status and the non-g bundles.""" import json import os import shutil import sys import time from pathlib import Path APP = Path(__file__).resolve().parents[1] TD = APP / "검증" / "autocheck_report_data" if TD.exists(): shutil.rmtree(TD) names = sys.argv[1:] or [d.name for d in sorted((APP / "data").iterdir()) if (d / "params.json").exists() and not d.name.startswith("_")] for n in names: shutil.copytree(APP / "data" / n, TD / n, ignore=shutil.ignore_patterns("runs", "backup", "dwg", "dxf")) shutil.copytree(APP / "data" / "_템플릿", TD / "_템플릿", ignore=shutil.ignore_patterns("_이전")) os.environ["PIERAPP_DATA"] = str(TD) sys.path.insert(0, str(APP / "web")) sys.path.insert(0, str(APP)) import app as webapp # noqa: E402 import store # noqa: E402 from engine import verify # noqa: E402 for n in names: p = store.Pier(n) t0 = time.time() a = p.run_autocheck(force=True) req = {f"{f}:{k}" for f, k in webapp.required(p)} c = verify.counts(a["sections"], req) print(f"== {n}: required {len(req)} -> " + " ".join(f"{verify.ST_NAME[k]} {v}" for k, v in c.items()) + f" ({time.time() - t0:.1f}s)") for b, r in sorted(a["sections"].items()): if b in req and r["st"] != "g": print(f" {verify.ST_NAME[r['st']]:5s} {b:28s} {r['summary'][:110]}")