mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Slice 3c.1. Ingestion will persist a UPRN's coordinates and planning protections together as a write-through cache, so resolve them in a single partition read rather than two. `SpatialReference` bundles the coordinates (which drive the Solar fetch) and the `PlanningRestrictions` (which gate wall insulation per ADR-0019/ADR-0020); `GeospatialRepository.spatial_for(uprn)` returns it, and `coordinates_for`/`planning_restrictions_for` now delegate to the one lookup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
954 B
Python
25 lines
954 B
Python
"""One UPRN's row of Ordnance Survey spatial reference data.
|
|
|
|
Bundles the two things the geospatial partition co-locates against a UPRN — the
|
|
coordinates (which drive the Solar fetch) and the planning protections (which
|
|
gate wall insulation, ADR-0019/ADR-0020) — so Ingestion resolves them in a
|
|
single reference lookup and persists them together as a write-through cache
|
|
(`property_details_spatial`). Coordinates are Optional because the legacy
|
|
nearest-UPRN proxy fallback yields the flags with the coordinates nulled.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Optional
|
|
|
|
from domain.geospatial.coordinates import Coordinates
|
|
from domain.geospatial.planning_restrictions import PlanningRestrictions
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SpatialReference:
|
|
"""A Property's resolved spatial reference data, keyed by UPRN."""
|
|
|
|
coordinates: Optional[Coordinates]
|
|
restrictions: PlanningRestrictions
|