mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Resolve a depthless sloping-ceiling marker to as built 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6603d98c2c
commit
870cb04631
1 changed files with 21 additions and 1 deletions
|
|
@ -1,9 +1,29 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
from domain.epc.property_overrides.roof_type import RoofType
|
||||
|
||||
# The gov-API sloping-ceiling roof token (before any ``: <insulation>`` suffix),
|
||||
# normalised to lower alphanumerics. A slope-following ceiling (roof_construction
|
||||
# 8) has no loft void, so it must resolve to the `Pitched, sloping ceiling, …`
|
||||
# family, never the loft ladder (ADR-0066).
|
||||
_SLOPING_CEILING_TOKEN = "pitchedwithslopingceiling"
|
||||
|
||||
|
||||
def _normalise_roof_token(description: str) -> str:
|
||||
token = description.split(":", 1)[0]
|
||||
return re.sub(r"[^a-z0-9]", "", token.lower())
|
||||
|
||||
|
||||
def roof_sloping_ceiling_guard(description: str) -> Optional[RoofType]:
|
||||
raise NotImplementedError
|
||||
"""Deterministically resolve a `PitchedWithSlopingCeiling` roof description to
|
||||
its `Pitched, sloping ceiling, …` RoofType member (ADR-0066).
|
||||
|
||||
Returns None for anything that is not a sloping-ceiling marker, so the
|
||||
party-ceiling guard and the LLM classifier still handle the rest.
|
||||
"""
|
||||
if _normalise_roof_token(description) != _SLOPING_CEILING_TOKEN:
|
||||
return None
|
||||
return RoofType.PITCHED_SLOPING_CEILING_AS_BUILT
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue