Model/scripts/hyde/build_100010086084_multiwindow.py
Jun-te Kim 44275aa6a1 Confirm multi-orientation window gap is not closeable for UPRN 100010086084
Re-attempted entering this SAP-15.0 cert's 4 real N/E/S/W windows (gov-API
sap_windows, 2.516 m^2 each) as separate Elmhurst Openings rows instead of
the accepted single combined South row, to test whether it closes the
residual ~2pt gap (engine 53 vs Elmhurst worksheet 51).

Reproduced live the documented elmhurst_lib.py window-grid limitation:
adding a 2nd row wipes the previously-added row's width/height to 0.00,
in both same-session and fresh-session-per-window attempts. Not fixable
via current Playwright automation. Restored the assessment to its original
single South 10.06 m^2 row (no PDFs re-downloaded, no worksheet change).

Separately confirmed our own engine already models this cert's windows
per-orientation correctly from gov-API sap_windows via
solar_gains.py's ORIENTATION_BY_SAP10_CODE cascade -- this is an Elmhurst
build-tooling ceiling, not an engine or mapper bug. sap_score=53 remains
unchanged; no calculator/mapper code was touched. Full accuracy suite
re-run clean (66 passed/67 skipped/1 xfailed + corpus test passed).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 09:38:10 +00:00

51 lines
1.8 KiB
Python

"""One-off: rebuild UPRN 100010086084's Openings page with 4 separate
per-orientation window rows (N/E/S/W, 2.516 m^2 each) instead of the single
combined South-facing row, to test whether it closes the ~2pt gap between
Elmhurst's own worksheet (51) and this engine on gov-API inputs (53).
Each window is added in its OWN fresh `E.session()` (fresh login, fresh page
load of Openings) to dodge the documented "each Add wipes the previous
row's editable cells" bug AND the flaky in-process re-navigation after
Save & Close observed in earlier runs.
Run once per window, e.g.:
DISPLAY=:99 python scripts/hyde/build_100010086084_multiwindow.py East
DISPLAY=:99 python scripts/hyde/build_100010086084_multiwindow.py South
DISPLAY=:99 python scripts/hyde/build_100010086084_multiwindow.py West
"""
from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
import elmhurst_lib as E # noqa: E402
AREA = 2.516
def main() -> None:
if len(sys.argv) != 2:
raise SystemExit(f"usage: {sys.argv[0]} <Orientation>")
orientation = sys.argv[1]
with E.session() as (ctx, page):
E.goto(page, "Openings", "WebFormOpenings.aspx")
before = E.window_row_count(page)
print("before:", before)
E.add_combined_window(page, AREA, orientation)
page.wait_for_timeout(800)
after = E.window_row_count(page)
print("after add:", after)
rows = page.evaluate(
"""() => {
const cells = document.querySelectorAll("[id*='GridViewExtendedWidows'] tr");
return [...cells].map(r => r.innerText.replace(/\\s+/g, ' ').trim());
}"""
)
for r in rows:
print("ROW:", r)
E.save_close(page)
if __name__ == "__main__":
main()