Resolve a party-ceiling roof marker to the party-ceiling member 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-01 09:35:24 +00:00
parent cba536eba8
commit 6fc10683d2
2 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,23 @@
from __future__ import annotations
from typing import Optional
from domain.epc.property_overrides.roof_type import RoofType
def roof_party_ceiling_guard(description: str) -> Optional[RoofType]:
"""Deterministically resolve a party-ceiling roof description to its RoofType.
A building part whose top boundary is another (or the same) dwelling / premises
above has ~0 heat loss (RdSAP 10 Table 18: "There is no heat loss through the
roof of a building part that has the same dwelling or another dwelling above"),
so it must resolve to a party-ceiling `RoofType` member which the roof
Simulation Overlay leaves as no overlay, keeping the lodged EPC and never to
an external `Pitched` / `Flat` roof.
Recognises the party-ceiling markers regardless of a trailing insulation token
(``: 100mm`` / ``: unknown``) or spacing/case, and returns ``None`` for anything
that is not a party-ceiling marker so the LLM classifier still handles it
(#1376).
"""
raise NotImplementedError

View file

@ -0,0 +1,18 @@
from __future__ import annotations
from domain.epc.property_overrides.roof_type import RoofType
from domain.epc.property_overrides.roof_party_ceiling_guard import (
roof_party_ceiling_guard,
)
def test_party_ceiling_marker_with_a_trailing_depth_resolves_to_the_party_ceiling_member() -> None:
# Arrange — the bug: a party ceiling ("another dwelling above") carrying a
# trailing loft depth the LLM misreads as an external pitched roof.
description = "another dwelling above: 100mm"
# Act
result = roof_party_ceiling_guard(description)
# Assert — it is a party ceiling (~0 heat loss), not a Pitched roof.
assert result is RoofType.ADJACENT_ANOTHER_DWELLING_ABOVE