mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
FULL CLOSURE. Cascade 768/768 + e2e 72/72 across all 6 Elmhurst fixtures. Adds Table 12d (p.194) monthly CO2 emission factors for electricity to `tables/table_12.py` + `co2_monthly_factors_kg_per_kwh(fuel_code)` helper. Per the spec text: "Where electricity is the fuel used, the relevant set of factors in the table below should be used to calculate the monthly CO2 emissions INSTEAD the annual average factor given in Table 12." Calculator now consumes per-end-use CO2 factors on `CalculatorInputs` (`main_heating_co2_factor_kg_per_kwh`, `secondary_heating_co2_factor_ kg_per_kwh`, `hot_water_co2_factor_kg_per_kwh`, `pumps_fans_co2_factor_ kg_per_kwh`, `lighting_co2_factor_kg_per_kwh`, `electric_shower_kwh_ per_yr`, `electric_shower_co2_factor_kg_per_kwh`). Defaults to None → falls back to the global `co2_factor_kg_per_kwh` (legacy synthetic path); cert_to_inputs supplies real values. `_effective_monthly_co2_factor(monthly_kwh, fuel_code)` translates the Table 12d monthly cascade into the calculator's annual×factor shape: effective = Σ(kWh_m × CO2_m) / Σ(kWh_m). Used for the 4 electricity end-uses (secondary, pumps/fans, lighting, electric shower). Gas end- uses keep the annual Table 12 factor. Adds `environmental_section_from_cert(epc) -> EnvironmentalSection` exposing (261)..(274) line refs. Worksheet display conventions: - (265) excludes (264a) — electric shower CO2 contributes to (272) total but not the "space + water heating" subtotal. - (273) is rounded to 2 d.p. half-up — the PDF displays with trailing zeros to 4 d.p. but precision is 2 d.p. throughout. §12 LINE_ constants added to all 6 fixtures: (261), (262), (263), (264), (264a), (265), (266), (267), (268), (269), (272), (273), EI continuous, (274). 000487 (electric shower) has non-zero (264a). FINAL SCOREBOARD: - Cascade pins: 684/684 → 768/768 (§7..§12 all closed, 100%) - e2e SapResult: 66/66 → 72/72 (all CO2 + sap + ecf + fuel cost) - Wider regression: 1490/1490 PASS — zero failures anywhere Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| domain | ||
| fetchers | ||
| repos | ||
| utils | ||
| README.md | ||
Shared packages
Workspace packages consumed by services/*. Each package is its own Python distribution with its own pyproject.toml; services import via the workspace dependency mechanism ({ workspace = true }).
| Package | Purpose |
|---|---|
domain/ |
Shared domain types — Property, BaselinePerformance, Plan, Scenario, EpcPropertyData, etc. No persistence, no IO, no business logic. |
repos/ |
Persistence layer — one repo per aggregate. Owns the SQL. Depends on domain. |
fetchers/ |
External API clients (gov EPC, Ofgem, Google Solar, etc.). Depend on domain for response shapes. |
utils/ |
Cross-cutting infra — logging, S3, CloudWatch URL builders, SQS task helpers. |
Adding a new shared package
Only when a real second consumer materialises. Don't pre-shatter (repos-epc, repos-property, ...) — split when a deployment needs to drop a dep, not before.
See ../ara_backend_design.md §11 for the broader monorepo layout and ../CONTEXT.md for the domain glossary that names the types living in domain/.