Map display EnergyElements on full-SAP certs for the FE panel 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-25 20:55:51 +00:00
parent 4c65640e4e
commit 95701d03e4
2 changed files with 29 additions and 1 deletions

View file

@ -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),

View file

@ -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