Model/domain/property/site_notes.py
Khalim Conn-Kowlessar 92de07efba feat(property): Property aggregate + PropertyRepository (#1132)
Add the Ara modelling aggregate root (ADR-0002): domain/property/ with
PropertyIdentity, SiteNotes, Property, Properties. Property.source_path
implements the two disjoint source paths + Recency Tie-Break (ADR-0001;
survey wins on an equal date); effective_epc resolves to the surveyed data
(Site Notes path) or the public EPC (epc_with_overlay path — Landlord
Overrides overlay is a later slice). Pure dataclasses, no infrastructure imports.

PropertyRepository port + PropertyPostgresRepository hydrate the aggregate
whole from a defensive view of the FE-owned 'property' table (identity columns)
plus the EPC slice via EpcRepository.get_for_property. Reads only from repos
(ADR-0003). 8 domain + 1 hydration test; pyright strict clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 19:39:54 +00:00

23 lines
707 B
Python

from __future__ import annotations
from dataclasses import dataclass
from datetime import date
from datatypes.epc.domain.epc_property_data import EpcPropertyData
@dataclass
class SiteNotes:
"""A Domna survey of a single Property (CONTEXT.md: Site Notes).
Committed by the domain to being full-coverage — it carries every EPC field
the modelling pipeline needs, expressed as an `EpcPropertyData`. When present
(and not older than the public EPC) it is the complete source of truth for
the Property; the public EPC is then irrelevant (ADR-0001).
"""
surveyed_at: date
epc: EpcPropertyData
def to_epc_property_data(self) -> EpcPropertyData:
return self.epc