Files
Pier_v1/Code/교각모델링앱/tools/open19_snapshot.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

55 lines
2.5 KiB
Python

"""OPEN #19 regression snapshot: table records and expected-side proposals of the reference piers.
usage: python tools/open19_snapshot.py <tag> -> 검증/open19_snapshot_<tag>.json
Run before and after the OPEN #19 changes and compare (tools/test_open19.py reads both).
Sources are read only: Ungok P1 / P2 data folders, Ulsan texts from the recycle-bin copy + protected template.
"""
import json
import re
import sys
from pathlib import Path
APP = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(APP))
sys.path.insert(0, str(APP / "tools"))
from engine import reader # noqa: E402
from testlib import pier_dir # noqa: E402
PIERS = {
"운곡교P1": (APP / "data/운곡교P1/drawings/texts.json", APP / "data/운곡교P1"),
"운곡교p2": (pier_dir("운곡교p2") / "drawings/texts.json", pier_dir("운곡교p2")),
"산외교울산P1": (APP / "data/_휴지통/산외교울산P1_20261013_131140/drawings/texts.json",
APP / "data/_템플릿/산외교울산P1형"),
}
def snapshot():
out = {}
for name, (tx, d) in PIERS.items():
texts = json.loads(tx.read_text(encoding="utf-8"))
P = json.loads((d / "params.json").read_text(encoding="utf-8"))
X = json.loads((d / "expected.json").read_text(encoding="utf-8"))
tables = reader.table_candidates(texts)
recs = {}
for t in tables:
if not t["rows"]:
continue
pred = (lambda s: s.isdigit()) if not t["key"].startswith("schedule") else (lambda s: bool(reader.MARK_RE.match(s)))
recs[f"{t['anchor']['dwg']}|{t['key']}|{t['anchor']['y']}"] = [r for _, r in reader.table_records(t["rows"], pred)]
rows = reader.proposals(reader.field_candidates(tables), P, X)
out[name] = {"records": recs,
"proposals": [{k: r[k] for k in ("file", "path", "current", "candidate", "same")} for r in rows]}
return out
if __name__ == "__main__":
tag = sys.argv[1]
p = APP / "검증" / f"open19_snapshot_{tag}.json"
p.write_text(json.dumps(snapshot(), ensure_ascii=False, indent=1), encoding="utf-8")
s = json.loads(p.read_text(encoding="utf-8"))
for k, v in s.items():
props = v["proposals"]
print(k, "tables", len(v["records"]), "records", sum(len(x) for x in v["records"].values()),
"proposals", len(props), "differ", sum(not r["same"] for r in props),
"params rows", sum(r["file"] == "params" for r in props))