Model/domain/epc/attribute_overlay.py
Jun-te Kim 4219ef9d8b Overlay landlord property-type and built-form corrections onto the Effective EPC 🟩
Adds whole-dwelling property_type/built_form to EpcSimulation (folded by
apply_simulations) and maps those override components. property_type drives
party-wall heat loss + ASHP/solar/wall eligibility, so a landlord correction now
moves both the SAP calc and the measure menu; built_form has no calculator
consumer today (feeds the ML transform). Written as the landlord text value
(park-home check is text-only). Refines ADR-0032 dec-4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 18:06:29 +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)