mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Slice 4b — closes the #1157 tracer. ModellingOrchestrator.run(property_ids, scenario_ids, portfolio_id) now does real work in one Unit of Work, committed once (ADR-0011/0012/0016/0017): read Property (effective EPC) + Scenario via repos → recommend_cavity_wall → select its Option → PackageScorer.score (role-2 package total) + marginal_impacts (role-3 attribution) → build Plan/PlanMeasure → uow.plan.save → commit. - AraFirstRunPipeline / ModellingStage thread portfolio_id from the trigger body (one source of truth); handler builds the real orchestrator (unit_of_work + Sap10Calculator), dropping the Scenario/Materials stubs. - ScenarioRepository.get_many promoted to @abstractmethod now the bare-stub instantiations are gone. - New ara_first_run-style integration test: a property with an uninsulated cavity wall yields a persisted Plan + one cavity_wall_insulation Plan Measure (priced from the Product, figures present, linked by plan_id). Numeric SAP correctness is pinned separately in test_elmhurst_cascade_pins. - Existing pipeline integration test updated: seeds scenario 7 and runs the real Modelling stage (its already-insulated sample wall yields an empty package — no crash). 121 pass across repositories/modelling/orchestration/app; pyright strict clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
670 B
Python
20 lines
670 B
Python
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from domain.modelling.scenario import Scenario
|
|
|
|
|
|
class ScenarioRepository(ABC):
|
|
"""Loads the Scenarios the Modelling stage scores a Property against.
|
|
|
|
The FE creates a Scenario in the scenario-builder and passes only its id
|
|
to the pipeline (#1130); the orchestrator reads it back through this port
|
|
at modelling time. Bulk read by id, load-whole per ADR-0012.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def get_many(self, scenario_ids: list[int]) -> list[Scenario]:
|
|
"""Return the Scenarios for ``scenario_ids``, in the same order,
|
|
raising if any id has no row."""
|
|
...
|