mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Move the EpcClientService package (client + _retry + exceptions + tests) from the dying backend/ tree to infrastructure/epc_client/ as the New-EPC-API Fetcher; update the two callers (address2UPRN, a script). All 14 client tests pass. Add SolarRepository port + SolarPostgresRepository persisting Google Solar building insights as JSONB (solar_building_insights table), one row per Property. The EPC repo half of this slice already landed in #1129. pyright strict clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
847 B
Python
22 lines
847 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any, ClassVar, Optional
|
|
|
|
from sqlalchemy import Column
|
|
from sqlalchemy.dialects.postgresql import JSONB
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class SolarBuildingInsightsRow(SQLModel, table=True):
|
|
"""Persisted Google Solar `buildingInsights` response for one Property.
|
|
|
|
Stored as JSONB — the raw fetched insights are retained whole so the
|
|
structured projection a future SolarPotential type needs can be derived
|
|
without re-fetching. One row per Property.
|
|
"""
|
|
|
|
__tablename__: ClassVar[str] = "solar_building_insights" # pyright: ignore[reportIncompatibleVariableOverride]
|
|
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
property_id: int = Field(index=True, unique=True)
|
|
insights: dict[str, Any] = Field(sa_column=Column(JSONB, nullable=False))
|