From 95701d03e4f045cb610034464921c239fe12c7b5 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 25 Jun 2026 20:55:51 +0000 Subject: [PATCH] =?UTF-8?q?Map=20display=20EnergyElements=20on=20full-SAP?= =?UTF-8?q?=20certs=20for=20the=20FE=20panel=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- datatypes/epc/domain/mapper.py | 22 +++++++++++++++++++++- datatypes/epc/schema/sap_schema_17_1.py | 8 ++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/datatypes/epc/domain/mapper.py b/datatypes/epc/domain/mapper.py index 97ae3739..500a72cd 100644 --- a/datatypes/epc/domain/mapper.py +++ b/datatypes/epc/domain/mapper.py @@ -811,7 +811,27 @@ class EpcPropertyDataMapper: roofs=EpcPropertyDataMapper._map_energy_elements(schema.roofs), walls=EpcPropertyDataMapper._map_energy_elements(schema.walls), floors=EpcPropertyDataMapper._map_energy_elements(schema.floors), - main_heating=[], + # Display elements for the FE property-details panel (the calculator + # reads the measured sap_* fields below, not these). Parity with + # from_rdsap_schema_17_1; full-SAP lodges windows under plural key. + main_heating=EpcPropertyDataMapper._map_energy_elements( + schema.main_heating + ), + window=( + EpcPropertyDataMapper._map_energy_element(schema.windows) + if schema.windows is not None + else None + ), + lighting=( + EpcPropertyDataMapper._map_energy_element(schema.lighting) + if schema.lighting is not None + else None + ), + hot_water=( + EpcPropertyDataMapper._map_energy_element(schema.hot_water) + if schema.hot_water is not None + else None + ), # D2: vertical-window openings (opening-type 4) → sap_windows; # roof-window openings (opening-type 5) → sap_roof_windows. sap_windows=EpcPropertyDataMapper._sap_17_1_windows(schema), diff --git a/datatypes/epc/schema/sap_schema_17_1.py b/datatypes/epc/schema/sap_schema_17_1.py index 5105ec8c..8f6fc2da 100644 --- a/datatypes/epc/schema/sap_schema_17_1.py +++ b/datatypes/epc/schema/sap_schema_17_1.py @@ -215,6 +215,14 @@ class SapSchema17_1: secondary_heating: Optional[EnergyElement] = None # "SAP" for this family (vs "RdSAP"); carried for provenance / the panel. assessment_type: Optional[str] = None + # Human-facing display elements (description + ratings) for the property- + # details panel — distinct from the measured/structural fields the calculator + # reads. Dropped by the WIP mapper → all "Unknown" on the FE (ADR-0037). + # Full-SAP lodges windows under the plural key (a single element, not a list). + main_heating: List[EnergyElement] = field(default_factory=list) + windows: Optional[EnergyElement] = None + lighting: Optional[EnergyElement] = None + hot_water: Optional[EnergyElement] = None # measured living-room area (m²); the engine consumes it via a back-solved # habitable_rooms_count (Table 27). Optional — 100% present in the corpus. living_area: Optional[Union[int, float]] = None