Model/domain/epc/property_overlays/attribute_overlay.py
2026-06-18 10:04:14 +00:00

29 lines
1.1 KiB
Python

"""Map a Landlord-Override property-type / built-form value to a Simulation
Overlay (ADR-0032).
These are whole-dwelling categorical corrections, not building-part fabric — so
the overlay sets the top-level `EpcSimulation.property_type` / `built_form`
rather than a `BuildingPartOverlay`. The landlord value is written as-is (text):
`property_type` consumers are tolerant of text, and the calculator's park-home
check is text-only (`"park home"`). `property_type` drives party-wall heat loss
and ASHP/solar/wall eligibility; `built_form` has no calculator consumer today
(it feeds the ML transform + reporting). `"Unknown"` resolves to no overlay.
"""
from __future__ import annotations
from typing import Optional
from domain.modelling.simulation import EpcSimulation
def property_type_overlay_for(value: str, building_part: int) -> Optional[EpcSimulation]:
if not value or value == "Unknown":
return None
return EpcSimulation(property_type=value)
def built_form_overlay_for(value: str, building_part: int) -> Optional[EpcSimulation]:
if not value or value == "Unknown":
return None
return EpcSimulation(built_form=value)