mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Move the scenario and installed_measure tables into
infrastructure/postgres/modelling/ as full-parity SQLModel definitions
(ScenarioModel, InstalledMeasureModel + MeasureType), completing the cluster
consolidation. backend/app/db/models/recommendations.py is now a pure
re-export shim.
ScenarioModel.goal is the PortfolioGoal enum (legacy planning branches on it),
sourced from domain/modelling/portfolio_goal.py; the repo's to_domain maps it to
its value string, so domain Scenario.goal is now the value ("Increasing EPC")
consistent with the orchestrator's check — fixing the latent name-vs-value
inconsistency the old str column masked (the scenario repo test stored the enum
*name*). Parity columns are nullable (mirror convention; live NOT-NULLs owned by
Drizzle).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Re-export shim (ADR-0017 amendment).
|
|
|
|
The Modelling-stage persistence models — `plan`, `recommendation`,
|
|
`recommendation_materials`, `scenario`, `installed_measure` — moved to
|
|
`infrastructure/postgres/modelling/` as single SQLModel definitions (the
|
|
`epc_property` pattern). This module re-exports them under their legacy names so
|
|
the dying `backend/` callers keep working; new code imports from
|
|
`infrastructure.postgres.modelling` directly. The `plan_recommendations` m2m is
|
|
retired — measures link to their Plan via `recommendation.plan_id`.
|
|
"""
|
|
|
|
from typing import NamedTuple
|
|
|
|
from infrastructure.postgres.modelling import (
|
|
InstalledMeasureModel,
|
|
PlanModel,
|
|
PlanType,
|
|
RecommendationMaterialModel,
|
|
RecommendationModel,
|
|
ScenarioModel,
|
|
)
|
|
|
|
# Legacy names → the single SQLModel definitions now in
|
|
# `infrastructure/postgres/modelling/`.
|
|
Recommendation = RecommendationModel
|
|
RecommendationMaterials = RecommendationMaterialModel
|
|
PlanTypeEnum = PlanType
|
|
InstalledMeasure = InstalledMeasureModel
|
|
|
|
__all__ = [
|
|
"PlanModel",
|
|
"ScenarioModel",
|
|
"Recommendation",
|
|
"RecommendationMaterials",
|
|
"InstalledMeasure",
|
|
"PlanTypeEnum",
|
|
"PlanPersistence",
|
|
]
|
|
|
|
|
|
class PlanPersistence(NamedTuple):
|
|
plan: PlanModel
|
|
scenario: ScenarioModel
|