From cff5b061a42f7b88ba6a42353aa3d7186d35a3db Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 25 Jun 2026 20:36:04 +0000 Subject: [PATCH] =?UTF-8?q?Map=20sap=5Fversion=20on=20full-SAP=20certs=20s?= =?UTF-8?q?o=20pre-SAP10=20rebaseline=20fires=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 | 4 ++++ datatypes/epc/schema/sap_schema_17_1.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/datatypes/epc/domain/mapper.py b/datatypes/epc/domain/mapper.py index bb21b8974..24ee6d65e 100644 --- a/datatypes/epc/domain/mapper.py +++ b/datatypes/epc/domain/mapper.py @@ -734,6 +734,10 @@ class EpcPropertyDataMapper: door_count, insulated_door_u = _sap_door_aggregates(schema) return EpcPropertyData( uprn=schema.uprn, + # SAP 2012 (~9.92) for this family — carried so CalculatorRebaseliner + # fires trigger (a) (sap_version < 10.2 → Effective = the SAP-10.2 + # calc) instead of keeping the lodged SAP-2012 score (ADR-0037). + sap_version=schema.sap_version, dwelling_type=( schema.dwelling_type if isinstance(schema.dwelling_type, str) diff --git a/datatypes/epc/schema/sap_schema_17_1.py b/datatypes/epc/schema/sap_schema_17_1.py index 03d79f2fa..cbd58d72a 100644 --- a/datatypes/epc/schema/sap_schema_17_1.py +++ b/datatypes/epc/schema/sap_schema_17_1.py @@ -198,6 +198,10 @@ class SapSchema17_1: sap_heating: SapHeating sap_energy_source: SapEnergySource = field(default_factory=SapEnergySource) sap_ventilation: SapVentilation = field(default_factory=SapVentilation) + # SAP spec the cert was lodged under (~9.92 = SAP 2012 for this family). + # Drives Rebaselining trigger (a): sap_version < 10.2 → Effective = the + # SAP-10.2 calc, not the lodged figure (ADR-0037). Optional defensively. + sap_version: Optional[float] = 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