diff --git a/domain/epc/property_overrides/main_heating_guard.py b/domain/epc/property_overrides/main_heating_guard.py new file mode 100644 index 000000000..fe8e54126 --- /dev/null +++ b/domain/epc/property_overrides/main_heating_guard.py @@ -0,0 +1,11 @@ +from __future__ import annotations + +from typing import Optional + +from domain.epc.property_overrides.main_heating_system_type import ( + MainHeatingSystemType, +) + + +def main_heating_guard(description: str) -> Optional[MainHeatingSystemType]: + raise NotImplementedError diff --git a/tests/domain/epc/test_main_heating_guard.py b/tests/domain/epc/test_main_heating_guard.py new file mode 100644 index 000000000..452474d61 --- /dev/null +++ b/tests/domain/epc/test_main_heating_guard.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +import pytest + +from domain.epc.property_overrides.main_heating_guard import main_heating_guard +from domain.epc.property_overrides.main_heating_system_type import ( + MainHeatingSystemType, +) + + +def test_guard_resolves_high_heat_retention_storage() -> None: + # Arrange — the structured phrasing the LLM funnelled into "old storage" (401). + description = "Electric Storage Systems: High heat retention storage heaters" + + # Act + result = main_heating_guard(description) + + # Assert — HHRSH has its own archetype (SAP 409), never old storage (ADR-0044). + assert result is MainHeatingSystemType.ELECTRIC_STORAGE_HIGH_HEAT_RETENTION + + +@pytest.mark.parametrize( + "description", + [ + # Other storage subtypes the LLM already classifies correctly — the guard + # only rescues the HHRSH gap, leaving the rest to the fallback classifier. + "Electric Storage Systems: Old (large volume) storage heaters", + "Electric Storage Systems: Modern (slimline) storage heaters", + "Electric Storage Systems: Fan storage heaters", + # Unrelated / varied phrasings are the LLM's job. + "Gas boiler", + "", + ], +) +def test_guard_defers_non_hhrsh_descriptions_to_the_llm(description: str) -> None: + # Act + result = main_heating_guard(description) + + # Assert + assert result is None