From e5d94adc36a1e78d0596878f94ba1b52d627b70c Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 26 Jun 2026 16:42:20 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20persist=20floor=20heat-loss=20flags=20t?= =?UTF-8?q?hrough=20the=20EPC=20round-trip=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add is_exposed_floor / is_above_partially_heated_space to EpcFloorDimensionModel and wire from_domain + _to_floor_dimension. Column names match the FE schema (feature/epc-pv-and-floor-heatloss-schema). Live DB migration is run post-merge (drizzle-kit generate picks them up). Co-Authored-By: Claude Opus 4.8 (1M context) --- infrastructure/postgres/epc_property_table.py | 7 +++++++ repositories/epc/epc_postgres_repository.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/infrastructure/postgres/epc_property_table.py b/infrastructure/postgres/epc_property_table.py index 0c207e0d..50a1b393 100644 --- a/infrastructure/postgres/epc_property_table.py +++ b/infrastructure/postgres/epc_property_table.py @@ -702,6 +702,11 @@ class EpcFloorDimensionModel(SQLModel, table=True): heat_loss_perimeter_m: float floor_insulation: Optional[int] = Field(default=None) floor_construction: Optional[int] = Field(default=None) + # Heat-loss flags (SAP 10.2 ยง3.3): a floor over outside air / over a + # partially-heated space takes a different U-value path. Default False + # matches the domain default for an ordinary ground floor. + is_exposed_floor: bool = Field(default=False) + is_above_partially_heated_space: bool = Field(default=False) @classmethod def from_domain( @@ -716,6 +721,8 @@ class EpcFloorDimensionModel(SQLModel, table=True): heat_loss_perimeter_m=dim.heat_loss_perimeter_m, floor_insulation=dim.floor_insulation, floor_construction=dim.floor_construction, + is_exposed_floor=dim.is_exposed_floor, + is_above_partially_heated_space=dim.is_above_partially_heated_space, ) diff --git a/repositories/epc/epc_postgres_repository.py b/repositories/epc/epc_postgres_repository.py index d44938e6..1390e790 100644 --- a/repositories/epc/epc_postgres_repository.py +++ b/repositories/epc/epc_postgres_repository.py @@ -812,6 +812,8 @@ class EpcPostgresRepository(EpcRepository): floor=f.floor, floor_insulation=f.floor_insulation, floor_construction=f.floor_construction, + is_exposed_floor=f.is_exposed_floor, + is_above_partially_heated_space=f.is_above_partially_heated_space, ) @private