mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Deterministically guard the Gas CPSU solid-fuel and electric-boiler descriptions 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2b5d38a7f9
commit
f6f4c3717d
1 changed files with 27 additions and 10 deletions
|
|
@ -8,17 +8,34 @@ from domain.epc.property_overrides.main_heating_system_type import (
|
|||
|
||||
|
||||
def main_heating_guard(description: str) -> Optional[MainHeatingSystemType]:
|
||||
"""Deterministically resolve a High Heat Retention Storage Heater (HHRSH)
|
||||
description, which the LLM funnelled into ``"Electric storage heaters, old"``
|
||||
(SAP 401) for want of an HHRSH archetype (#1376 / ADR-0044).
|
||||
"""Deterministically resolve the structured main-heating descriptions the LLM
|
||||
funnelled into a garbage-drawer archetype for want of a correct target (#1376).
|
||||
|
||||
HHRSH is a distinct RdSAP system (SAP Table 4a 409) with its own intrinsic
|
||||
charge control (2404) — the *best* modern storage, not the *worst* old large-
|
||||
volume type. This guard claims only the structured HHRSH phrasing and returns
|
||||
``None`` for every other description (the remaining storage subtypes the LLM
|
||||
already classifies correctly, and varied phrasings), so they still reach the
|
||||
LLM classifier via ``GuardedColumnClassifier``.
|
||||
Two dumping grounds are rescued:
|
||||
|
||||
- **HHRSH** (ADR-0044): ``"…High heat retention storage heaters"`` went to
|
||||
``"Electric storage heaters, old"`` (SAP 401) — the *worst* old type. HHRSH is
|
||||
SAP Table 4a 409 with its own intrinsic charge control (2404).
|
||||
- **Gas CPSU** (ADR-0045): the mains-gas CPSU garbage drawer also held
|
||||
solid-fuel room heaters (open fire 631 / + back boiler 632 / closed + boiler
|
||||
634) and electric ``"NA"``-type boilers (SAP 191). "NA" is the boiler-type
|
||||
value meaning "not a gas combi/regular/CPSU", i.e. an electric boiler.
|
||||
|
||||
Returns ``None`` for descriptions the LLM already classifies correctly (genuine
|
||||
gas boilers, other storage subtypes, a plain closed room heater) and for varied
|
||||
phrasings, so they still reach the LLM via ``GuardedColumnClassifier``. Order
|
||||
matters: the back-boiler open fire is tested before the bare open fire it
|
||||
contains.
|
||||
"""
|
||||
if "high heat retention" in description.lower():
|
||||
text = description.lower()
|
||||
if "high heat retention" in text:
|
||||
return MainHeatingSystemType.ELECTRIC_STORAGE_HIGH_HEAT_RETENTION
|
||||
if "rated na" in text:
|
||||
return MainHeatingSystemType.ELECTRIC_BOILER
|
||||
if "open fire" in text and "back boiler" in text:
|
||||
return MainHeatingSystemType.SOLID_FUEL_ROOM_HEATER_OPEN_FIRE_BACK_BOILER
|
||||
if "open fire" in text:
|
||||
return MainHeatingSystemType.SOLID_FUEL_ROOM_HEATER_OPEN_FIRE
|
||||
if "closed room heater" in text and "with boiler" in text:
|
||||
return MainHeatingSystemType.SOLID_FUEL_ROOM_HEATER_CLOSED_WITH_BOILER
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue