Model/packages
Khalim Conn-Kowlessar 4da8a4703d Slice 36: §12 + §13a demand cascade closure (96/96 EPC Block 2 pins)
Pins the EPC's published "Current Carbon" + "Current Primary Energy"
values against the U985 Block 2 (postcode-climate cascade via PCDB
Table 172) for all 6 Elmhurst fixtures at abs=1e-4.

Adds:
- `PrimaryEnergySection` dataclass exposing §13a line refs (275)..(286).
- `primary_energy_section_from_cert(epc, postcode_climate=...)` —
  composes §9a per-system fuel kWh × Table 12 (gas) / Table 12e
  (electricity, monthly) PE factors. Handles (279) excludes (278a)
  electric-shower PE convention (mirrors §12 (265) excludes (264a)).
- Real postcode on each Elmhurst fixture (bd3 8aq / bd3 9DR / bd5 8dn /
  bd3 9JZ / bd19 3TF / BD4 7JR) via new `postcode` kwarg on
  `make_minimal_sap10_epc`.
- DEMAND_LINE_* constants per fixture for §9a annual kWh, §12 CO2 line
  refs (261..272), §13a PE line refs (275..286).
- 16 cascade pins per fixture × 6 fixtures = 96 demand pins.

EXACT match (000474, the canonical test):
  EPC Current Carbon (LINE_272) = 3104.1222 kg/yr ✓ (Summary PDF: 3.104t)
  EPC Current PE     (LINE_286) = 16931.7227 kWh/yr ✓

Reference: SAP 10.2 Appendix U paragraph 1 (p.124) — "For ratings (SAP
rating and environmental impact rating) the calculations are done with
UK average weather. Other calculations (such as for energy use and
costs on EPCs) are done using local weather. Weather data for each
postcode district are taken from the PCDB."

Full scoreboard: 840 rating-cascade pins + 96 demand-cascade pins +
existing 5 postcode-weather unit tests = 941 total pins. Wider
regression: 1585/1585 PASS — zero failures.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 09:53:06 +00:00
..
domain Slice 36: §12 + §13a demand cascade closure (96/96 EPC Block 2 pins) 2026-05-24 09:53:06 +00:00
fetchers added potential file scaffolding: 2026-05-15 10:56:53 +00:00
repos added potential file scaffolding: 2026-05-15 10:56:53 +00:00
utils added potential file scaffolding: 2026-05-15 10:56:53 +00:00
README.md added potential file scaffolding: 2026-05-15 10:56:53 +00:00

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/.