mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
`_pv_export_credit_gbp_per_kwh` previously read from `prices.unit_price` (SAP10.2 Table 12 code 60 = 5.59 p/kWh) while the actual rating cascade inside _fuel_cost reads from `table_32_unit_price_p_per_kwh` (RdSAP10 Table 32 code 60 = 13.19 p/kWh, same as standard electricity). The exposed CalculatorInputs.pv_export_credit_gbp_per_kwh therefore misled about what the cascade applied. The calculator's fallback path at calculator.py:442 fires for synthetic inputs without `fuel_cost` and would compute the wrong PV credit by reading the misleading input. Per ADR-0010 §10 the rating cascade uses Table 32 prices. Unified both code paths on Table 32 so the input boundary reports the same 13.19 p/kWh the cascade applies. Cert-path math unchanged (cert path always sets fuel_cost). Synthetic/fallback path now consistent with cert path. Also adds cert 2130-1033-4050-5007-8395 (DE22, end-terrace + 1 ext, gas combi PCDB 17505, 2× 2.04 kWp PV) as 9th golden fixture. First PV-bearing cert in the cohort. Pinned residual is SAP +8 / PE −61 / CO2 +0.19 — spec-version drift not a code bug (cert was scored by SAP10.2 software using Table 12 PV export 5.59 p/kWh = £194 credit → SAP 82; calc targets RdSAP10 Table 32 = 13.19 p/kWh = £457 credit → SAP 90). Both internally consistent against their own price table. The PE residual is amplified because PV gen also offsets PE via inputs.other_primary_factor, which scales with gen kWh independently of the export-credit price. 930/930 Elmhurst cascade green. 14/14 golden cohort + 1 new cert_to_inputs unit test green. Pyright net-zero (49 errors before and after). 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/.