mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
extract window frame details from elmhurst site notes 🟩
This commit is contained in:
parent
8f94bb5435
commit
01ebb2e0e1
2 changed files with 21 additions and 2 deletions
|
|
@ -230,7 +230,7 @@ class ElmhurstSiteNotesExtractor:
|
|||
i += 1
|
||||
continue
|
||||
i += 3
|
||||
# Collect glazing type until frame_factor (0 < v ≤ 1.0)
|
||||
# Collect glazing type tokens until frame_factor (0 < v ≤ 1.0)
|
||||
glazing_parts: List[str] = []
|
||||
while i < len(tokens):
|
||||
try:
|
||||
|
|
@ -241,10 +241,21 @@ class ElmhurstSiteNotesExtractor:
|
|||
except ValueError:
|
||||
glazing_parts.append(tokens[i])
|
||||
i += 1
|
||||
# If last glazing token is a single word (no spaces, not numeric) it's the frame_type
|
||||
frame_type: Optional[str] = None
|
||||
if glazing_parts and " " not in glazing_parts[-1] and not glazing_parts[-1].replace(".", "").isdigit():
|
||||
frame_type = glazing_parts.pop()
|
||||
glazing_type = " ".join(glazing_parts).strip()
|
||||
if i >= len(tokens):
|
||||
break
|
||||
frame_factor = float(tokens[i]); i += 1
|
||||
# Consume glazing_gap if present ("mm" token, possibly multi-token e.g. "16 mm or more")
|
||||
glazing_gap: Optional[str] = None
|
||||
if i < len(tokens) and "mm" in tokens[i]:
|
||||
gap_parts = [tokens[i]]; i += 1
|
||||
while i < len(tokens) and tokens[i].lower() in {"or", "more"}:
|
||||
gap_parts.append(tokens[i]); i += 1
|
||||
glazing_gap = " ".join(gap_parts)
|
||||
building_part = tokens[i]; i += 1
|
||||
location = tokens[i]; i += 1
|
||||
orientation = tokens[i]; i += 1
|
||||
|
|
@ -268,6 +279,8 @@ class ElmhurstSiteNotesExtractor:
|
|||
g_value=g_value,
|
||||
draught_proofed=draught_proofed,
|
||||
permanent_shutters=permanent_shutters,
|
||||
frame_type=frame_type,
|
||||
glazing_gap=glazing_gap,
|
||||
)
|
||||
)
|
||||
return windows
|
||||
|
|
@ -296,12 +309,17 @@ class ElmhurstSiteNotesExtractor:
|
|||
)
|
||||
|
||||
def _extract_lighting(self) -> Lighting:
|
||||
led_cfl_count_known = self._bool_val("Number of LED and CFL Known")
|
||||
return Lighting(
|
||||
total_bulbs=self._int_val("Total number of bulbs"),
|
||||
led_cfl_count_known=self._bool_val("Number of LED and CFL Known"),
|
||||
led_cfl_count_known=led_cfl_count_known,
|
||||
led_count=self._int_val("Number of LED lights"),
|
||||
cfl_count=self._int_val("Number of CFL lights"),
|
||||
incandescent_count=self._int_val("Total number of incandescents"),
|
||||
low_energy_count=(
|
||||
0 if led_cfl_count_known
|
||||
else self._int_val("Total number of Low Energy")
|
||||
),
|
||||
)
|
||||
|
||||
def _extract_main_heating(self) -> MainHeating:
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ class Lighting:
|
|||
led_count: int
|
||||
cfl_count: int
|
||||
incandescent_count: int
|
||||
low_energy_count: int = 0
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue