mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Product(measure_type, unit_cost_per_m2, contingency_rate). ProductRepository is the DDD port abstracting the catalogue source; ProductPostgresRepository reads the externally-owned material table (defensive SQLModel view MaterialRow) and maps an active row to a Product — total_cost becomes the fully-loaded unit_cost_per_m2 — joining the per-measure-type contingency (contingencies.py, mirrors Costs.CONTINGENCIES; cavity 0.10). Strict-raise on missing/inactive row. A JSON-backed impl will follow behind the same port for ETL-gap costs. Two DB tests against an ephemeral Postgres (map active row; raise on inactive-only). Toward #1155 cost (4b). Also generalises the CONTEXT Simulation Overlay wording: windows are targeted by index, building-part association carried via window_location (_window_bp_index). pyright clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
16 lines
497 B
Python
16 lines
497 B
Python
"""Product — a catalogue entry a Measure Option installs.
|
|
|
|
Carries the data needed to price an Option: a fully-loaded unit cost and the
|
|
per-Measure-Type contingency rate carried alongside it (CONTEXT.md). The
|
|
catalogue is equipment-dominated (heat pumps, glazing, PV) — hence "Product",
|
|
not "material". Read via a `ProductRepository`.
|
|
"""
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Product:
|
|
measure_type: str
|
|
unit_cost_per_m2: float
|
|
contingency_rate: float
|