From 5c0460cee23fe5a9ea8770fe2c9fd206c32a6745 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 25 Jun 2026 20:37:34 +0000 Subject: [PATCH] =?UTF-8?q?Map=20property=5Ftype=20on=20full-SAP=20certs?= =?UTF-8?q?=20for=20correct=20heat-transmission=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 | 7 +++++++ datatypes/epc/schema/sap_schema_17_1.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/datatypes/epc/domain/mapper.py b/datatypes/epc/domain/mapper.py index 24ee6d65e..3539fd0eb 100644 --- a/datatypes/epc/domain/mapper.py +++ b/datatypes/epc/domain/mapper.py @@ -738,6 +738,13 @@ class EpcPropertyDataMapper: # 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, + # gov property_type code → str, mirroring from_rdsap_schema_17_1. + # Feeds the calculator's house/flat heat-transmission split. + property_type=( + str(schema.property_type) + if schema.property_type is not None + else None + ), 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 cbd58d72a..ab4a33fa3 100644 --- a/datatypes/epc/schema/sap_schema_17_1.py +++ b/datatypes/epc/schema/sap_schema_17_1.py @@ -202,6 +202,10 @@ class SapSchema17_1: # 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 + # gov property_type code (0 house, 1 bungalow, 2 flat, 3 maisonette, 4 park + # home). Feeds the calculator's house/flat heat-transmission split; left + # absent the dwelling is classified as neither → mis-scored (ADR-0037). + property_type: Optional[int] = 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