Load Windows from SiteNotes JSON 🟩

This commit is contained in:
Daniel Roth 2026-04-16 14:16:22 +00:00
parent 4a415ab4a2
commit cf0a9a6326

View file

@ -262,7 +262,39 @@ class PasHubRdSapSiteNotesExtractor:
)
def extract_windows(self) -> List[Window]:
raise NotImplementedError
w_section = self._section("Windows", "Heating & Hot Water")
windows = []
n = 1
while f"Window {n}" in w_section:
start = w_section.index(f"Window {n}")
end = (
w_section.index(f"Window {n + 1}")
if f"Window {n + 1}" in w_section
else len(w_section)
)
windows.append(self._parse_window(n, w_section[start:end]))
n += 1
return windows
def _parse_window(self, window_id: int, data: List[str]) -> Window:
height_raw = self._get_in(data, "Window height:")
width_raw = self._get_in(data, "Window width:")
return Window(
id=window_id,
location=self._get_in(data, "Window location:") or "",
wall_type=self._get_in(data, "Window wall type:") or "",
glazing_type=self._get_in(data, "Glazing Type:") or "",
window_type=self._get_in(data, "Window type:") or "",
frame_type=self._get_in(data, "Window frame type:") or "",
glazing_gap=self._get_in(data, "What size is the glazing gap?") or "",
draught_proofed=self._bool_in(data, "Is the window draught proofed?"),
permanent_shutters=self._bool_in(data, "Are there permanent shutters present?"),
height_m=float(height_raw.split()[0]) if height_raw else 0.0,
width_m=float(width_raw.split()[0]) if width_raw else 0.0,
orientation=self._get_in(data, "Orientation:") or "",
)
def _parse_insulation_thickness(
self, val: Optional[str]