mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Two review points from @dancafc: 1) Rename the `Comparable` dataclass → `ComparableProperty` (it models one comparable *property*; the collection stays `ComparableProperties`). Applied across domain, repositories, orchestration, harness, scripts, and tests with a word-boundary rename so `ComparableProperties` is untouched. 2) Move `PredictionTarget` out of comparable_properties.py into prediction_target.py (where `PredictionTargetAttributes` + `build_prediction_target` already live). comparable_properties.py now imports it; no import cycle (prediction_target no longer depends on comparable_properties). Importers updated. 92 tests pass across the touched suites; pyright strict clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
"""The ComparableProperties repository port (ADR-0029 decision 3; ADR-0031).
|
|
|
|
Owns the cohort IO for EPC Prediction — given a target's postcode, return the
|
|
candidate `ComparableProperty`s (the postcode's other lodged certs, mapped to
|
|
`EpcPropertyData` with their register metadata + resolved coordinates). The pure
|
|
domain `select_comparables` then filters these into the reference cohort, and
|
|
`EpcPrediction.predict` synthesises the picture. Kept a port so the orchestrator
|
|
depends on the cohort source abstractly and tests substitute a fake.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from domain.epc_prediction.comparable_properties import ComparableProperty
|
|
|
|
|
|
class ComparablePropertiesRepository(ABC):
|
|
@abstractmethod
|
|
def candidates_for(self, postcode: str) -> list[ComparableProperty]:
|
|
"""Every candidate neighbour in `postcode` — one `ComparableProperty` per lodged
|
|
cert, carrying its `EpcPropertyData`, certificate number, address,
|
|
registration date, and resolved coordinates (None when unresolvable)."""
|
|
...
|