Model/repositories/property/prediction_target_attributes_reader.py
Khalim Conn-Kowlessar f2f954f459 feat(epc-prediction): slice-5d target assembly + eligibility gate
build_prediction_target assembles an EPC-less Property's PredictionTarget from
its identity (postcode), resolved coordinates, and Landlord-Override attributes
(property_type / built_form / wall_construction). The eligibility GATE: a Property
whose property_type is unknown returns None — never sized from a mixed-type
cohort (ADR-0031). property_type is the hard cohort filter.

The override attributes are read through a PredictionTargetAttributesReader port
(stub seam) — the real adapter (a read over property_overrides) is being built
separately by the team; ingestion wiring depends on the abstraction and tests
substitute a fake. 2 tests (assembly + gate); pyright strict clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 03:56:57 +00:00

23 lines
997 B
Python

"""Read port for an EPC-less Property's prediction attributes (ADR-0031 slice-5d).
Returns the `property_type` / `built_form` / `wall_construction` resolved from
Landlord Overrides that `build_prediction_target` needs. Kept a port because the
real adapter — a read over the `property_overrides` fact layer — is being built
separately (see docs/HANDOVER_EPC_PREDICTION_WIRING.md); the ingestion wiring
depends on this abstraction and tests substitute a fake.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from domain.epc_prediction.prediction_target import PredictionTargetAttributes
class PredictionTargetAttributesReader(ABC):
@abstractmethod
def attributes_for(self, property_id: int) -> PredictionTargetAttributes:
"""The Property's resolved prediction attributes. `property_type` is None
when it could not be resolved — which gates the Property out of
prediction (`build_prediction_target` returns None)."""
...