Commit graph

8249 commits

Author SHA1 Message Date
Khalim Conn-Kowlessar
42ed6f8e46 Persist the explicit basement-wall determination 🟩
RdSAP 10 §5.17 / Table 23. `wall_is_basement` is not a lodged U-value — it is a
disambiguation flag selecting WHICH RdSAP default applies, so unlike
wall/roof/floor_u_value it must survive the round-trip.

Code 6 is canonically SYSTEM-BUILT and the gov-API path infers "basement" from a
code-6 heuristic; the Elmhurst site-notes mapper sets wall_is_basement=False
precisely to defeat it. Dropping the field inverted the answer — a system-built
wall came back as a basement wall, dragging the whole ground floor onto the
Table 23 basement-floor U-value via `has_basement`.

Declared on no RdSAP schema, so it never arrives via the gov API; the earlier
corpus scan showing 0 occurrences measured the wrong population. The Elmhurst
site-notes path sets it and those EPCs are persisted
(scripts/wchg_elmhurst_ingest.py).

Nullable is load-bearing: None = "not stated, use the heuristic", False =
"explicitly system-built, do not".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 17:58:26 +00:00
Khalim Conn-Kowlessar
d867838330 Persist the measured at-rafters roof insulation thickness 🟩
Add `rafter_insulation_thickness` to `EpcBuildingPartModel` (JSONB, matching the
sibling thickness columns so Union[str, int] survives) and wire it through
`from_domain` / `_to_building_part`.

Property 749719 lodges "250mm" -> Table 16 col (2) U 0.23. Dropped, the roof
billed at U 2.30 — a 10x error worth -9.8 SAP (lodged 73, calculated 63.2) that
moved the dwelling a whole band, C -> D, and drew a 9.63-point loft-insulation
recommendation on a roof rated 4/5 by the assessor.

The sibling wall/roof/floor_u_value and wall_is_basement fields have the same
drop but are deliberately NOT persisted: they are full-SAP artefacts and we
re-model as RdSAP, which uses default U-values. Their allow-list entries are
re-justified rather than removed — the previous "not read by the calculator" was
stale and is what hid this drop.

Requires the Drizzle migration in Hestia-Homes/assessment-model to land FIRST;
without the column, EPC reads fail outright.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 17:53:17 +00:00
Khalim Conn-Kowlessar
d2168d518f Persist the measured at-rafters roof insulation thickness 🟥
RdSAP 10 §5.11.2 — a roof insulated at rafters lodges its thickness in
`rafter_insulation_thickness`, not `roof_insulation_thickness`. The field had no
DB column, so it was mapped from the gov-EPC API and silently dropped on save;
every at-rafters roof then fell back to the Table 18 col (2) unknown-thickness
default (2.30 W/m²K for bands A-D — the spec's *uninsulated* value).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 17:53:16 +00:00
KhalimCK
ccba02b51a
Merge pull request #1614 from Hestia-Homes/feat/1602-1603-pashub-floor-exposure-alt-walls
PasHub floor exposure + alternative walls + extension floor (#1601 keep-raw, #1602, #1603)
2026-07-15 16:52:13 +01:00
Khalim Conn-Kowlessar
6fd0393a4e Tighten pashub accuracy ratchets to 0.51 / 0.625 🟪
#1602 (floor exposure flags) + #1603 (alternative walls + extension floor
construction) move the Guinness 205 cohort within-0.5 50.2% -> 51.2% and MAE
0.653 -> 0.624. Lock the gain: floor 0.50 -> 0.51, ceiling 0.653 -> 0.625.
#1601 note updated from HELD to RESOLVED (keep-raw).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 15:46:06 +00:00
Khalim Conn-Kowlessar
5324ae0e57 PasHub floor exposure + alternative walls + extension floor 🟩
Resolve #1601 and land #1602/#1603 on the merged-#1609 tree, adjudicated
against Khalim's verified ground truth (not pre_sap).

#1601 (upper-floor +0.25 m joist void) — RESOLVED as keep-raw. The
gov-API/Elmhurst mappers add 0.25 m to upper-storey heights because their
lodged height is a clear internal ceiling. Against verified truth RAW beats
+0.25 on all 7 verified dwellings (16 Stillwater raw -0.35 within-band vs
+0.25 -0.75; every verified property is already under truth and +0.25 only
lowers SAP). pashub surveys internal dimensions (202/205 "Measurements
Location: Internal") and its upper-ground height gap is modal 0.00, so the
joist void is not differentially present and a blanket +0.25 is unsafe.
_map_floor_dimensions keeps the raw surveyed height with a RESOLVED note.

#1602 — semi-exposed / exposed floor exposure. The surveyed "Floor type"
"Semi Exposed (unheated)" now sets is_above_partially_heated_space (RdSAP
§5.14 U=0.7) and "Exposed Floor" sets is_exposed_floor (§5.13 Table 20), on
the lowest storey (floor==0) only, mirroring the gov-API/Elmhurst siblings.
New strict-raise _pashub_floor_exposure (ADR-0015).

#1603a — alternative walls. New AlternativeWall survey dataclass +
extract_alternative_walls (the "Alternative Wall"->"Windows" section) +
_map_pashub_alternative_walls -> sap_alternative_wall_1/2. The cascade
deducts each alt-wall area from the part's main opaque wall (no double
count), so a mixed-facade dwelling is billed at each sub-area's own
construction. The alt-wall block lodges "As Built" (capital B) — aliased to
the existing default insulation code.

#1603b — extension floor construction. ExtensionConstruction gains a floor
block (parsed like the main building) and _map_extension_building_part now
threads floor_type/construction/insulation/u_value_known, which the main
path already did and the extension silently dropped.

Cohort: within-0.5 50.2% -> 51.2%, MAE 0.652 -> 0.624, 0 strict-raise
errors across all 205. Verified-truth safe: none of the 7 verified
dwellings have alt walls, and #1602 moves the one it touches (2 Philips
exposed ext floor) by -0.00. pyright 0-new (mapper baseline 39). Goldens
test_full_building_construction + end_to_end EXTENSION_1 updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 15:46:06 +00:00
Daniel Roth
c54ee4cad7
Merge pull request #1610 from Hestia-Homes/fix/1606-water-only-c6-half-standing-charge
[1592] Include the C6 half standing charge for water-only heat networks
2026-07-15 15:21:23 +01:00
Daniel Roth
7fc4e6be52 Merge branch 'main' into fix/1606-water-only-c6-half-standing-charge 2026-07-15 14:15:18 +00:00
KhalimCK
85e536bda7
Merge pull request #1609 from Hestia-Homes/feat/1596-pashub-two-clusters
PasHub SAP accuracy: three extraction silent-drop fixes (within-0.5 23.9% → 50.2%)
2026-07-15 15:08:33 +01:00
Khalim Conn-Kowlessar
644bc300a6 Merge remote-tracking branch 'origin/main' into feat/1596-pashub-two-clusters
# Conflicts:
#	backend/documents_parser/tests/test_pashub_sap_accuracy.py
2026-07-15 14:02:15 +00:00
Daniel Roth
589eedba8a Cite C6 rather than C3.2 for the heat-network standing charge rule 🟪
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:53:59 +00:00
Khalim Conn-Kowlessar
30b1728337 PasHub extraction: thread showers/baths, normalize floor label, code no-water-heating 🟩
Three silent-drop extraction fixes the gov-API/Elmhurst mappers already apply
but `from_site_notes` uniquely omitted — each let a favorable default reach the
SAP-10.2 calculator and over-rate the dwelling. Same calculator, so the whole
gap was extraction fidelity (gov-API corpus 78.6% within-0.5 vs pashub 23.9%).

#1598 — electric-shower + bath counts: `_map_sap_heating` built `shower_outlets`
  but never set `electric_shower_count`/`mixer_shower_count`/`number_baths`, so
  the cascade defaulted to 1 gas mixer / 0 electric, billing electric-shower hot
  water off the cheap main system. 100/205 fixtures lodge "Electric Shower".
#1599 — floor label: pashub lodges "Ground Floor" (capital F); the calculator's
  RdSAP §5(12) suspended-timber floor-infiltration gate is case-sensitive on
  "Ground floor", so the 0.2-ACH term was silently dropped. Normalized at the
  mapper boundary. 98/205 suspended-timber.
#1600 — water-heating "None": the RdSAP 10 §10.7 "no water heating system"
  signal was discarded and HW inherited the gas combi (58 Hackle 67.7 vs
  verified 59). Coded to WHC 999 so the existing electric-immersion + Table
  28/29 default fires (also folds in #1594: blank cylinder size is no cylinder,
  not a phantom one).

Guinness GMCA 205 cohort: within-0.5 23.9% -> 50.2% (103/205), MAE 1.410 ->
0.650. Ratchets tightened to 0.50 / 0.65. Verified vs Khalim's ground truth
(16 Stillwater 78.2 -> 75.7 vs 76). #1601 (upper-floor +0.25 m) held — it
empirically over-corrects this cohort (internal-vs-external dimension question,
under investigation). pyright: 0 new errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:52:13 +00:00
Daniel Roth
a412c8942b Ratchet the API-corpus SAP MAE ceiling to 0.626 for the water-only C6 standing charge 🟪
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:50:17 +00:00
Daniel Roth
dd9e316796 Take the full heat-network standing charge, not both, when space heating is also on the network 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:46:08 +00:00
Daniel Roth
43e69f159a Charge the C6 half heat-network standing charge on a water-only dwelling's off-peak fuel bill 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:45:21 +00:00
Daniel Roth
b14fa31dde Charge the C6 half heat-network standing charge on a water-only dwelling's off-peak fuel bill 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:43:46 +00:00
Daniel Roth
4472e47ed4 Charge the C6 half heat-network standing charge on a water-only dwelling's fuel cost worksheet 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:41:17 +00:00
Daniel Roth
bd3a7ac317 Charge the C6 half heat-network standing charge on a water-only dwelling's fuel cost worksheet 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:37:19 +00:00
Daniel Roth
cc84a091e6 Include the C6 half heat-network standing charge on top of a water-only dwelling's fuel standing 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:32:34 +00:00
Daniel Roth
8a96003d45 Include the C6 half heat-network standing charge on top of a water-only dwelling's fuel standing 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 13:31:33 +00:00
Daniel Roth
70d65291c3
Merge pull request #1597 from Hestia-Homes/fix/1592-water-only-heat-network-dhw
Fix the water-only heat-network DHW plant-efficiency double count (#1592 B)
2026-07-15 12:09:30 +01:00
Daniel Roth
53ba1f1694 Re-baseline the pashub MAE ceiling to 1.415 for the water-only DHW fix 🟪
Second sanctioned exception to "ratchets never loosen" — needs @KhalimCK's
call, since the prior note expected to re-tighten here. Exactly one cohort
property is WHC 950 (16 Bingley Close, +5.946 -> +6.818 = the whole +0.0043);
within-0.5 unchanged at 23.9%. Its pre_sap is verified correct but its ~+6
residual is a known extraction bug, and this hybrid gauge cannot adjudicate a
calculator fix (#1592 Problem 2). The gov-API corpus, which gauges the
calculator alone, improves.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:57:16 +00:00
Daniel Roth
a400005353 Ratchet the API-corpus within-0.5 floor to 78.8% for the water-only DHW fix 🟪
Enumerates the 3 corpus certs that can move (all WHC 950) individually per
#1592 sub-task D: two improve (one crossing inside 0.5), one worsens and is
handed to sub-task C for an accredited oracle. No loosening required.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:34:19 +00:00
Daniel Roth
97ab27c914 Assert water-only heat-network fuel with the file's tolerance idiom 🟪
pytest.approx is untyped under pyright strict, so the new assertions added
3 errors against the repo's zero-new-errors bar. Switches to the abs(...)
<= tol form already dominant in this file. No behaviour change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:33:10 +00:00
Daniel Roth
7e355ce2ea Treat water-only heat-network primary pipework as insulated 🟩
SAP 10.2 Table 3 ("For heat networks apply the formula above with p = 1.0
and h = 3 for all months") and §4.3's "insulated pipework" literal both
scope on the DHW source, so a water-only network gets the same row as a
network space main. Was falling back to the RdSAP §3 age-band default —
band E → p=0, h=5 — billing 64.58 kWh in January against the spec's 23.26.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:29:48 +00:00
Daniel Roth
15b78ba312 Treat water-only heat-network primary pipework as insulated 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:29:12 +00:00
Daniel Roth
ef44a744a3 Accrue Table 3 primary-circuit loss for water-only heat-network cylinders 🟩
SAP 10.2 §4.3 (p.24) scopes itself to "where hot water is provided by a
heat network" and requires the Table 3 primary loss, so the gate keys on
the DHW source. Checked off the WHC before the main-keyed branches so a
non-boiler space main (cert 9093's warm air) can't zero it out.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:28:19 +00:00
Daniel Roth
d10b5210c6 Accrue Table 3 primary-circuit loss for water-only heat-network cylinders 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:27:54 +00:00
Daniel Roth
5f3e9f893f Bill water-only heat-network DHW identically whatever plant is behind it 🟩
950 boilers / 951 CHP / 952 community heat pump differ only in plant
efficiency, which SAP 10.2 §4.3 puts in the Table 12 heat price — so the
dwelling's delivered-heat demand must not vary with it. Passes on the
previous commit's expression; verified RED against the prior impl, where
951 leaked 0.80/0.75 and 952 under-billed its DHW fuel by 3.15×.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:25:59 +00:00
Daniel Roth
353ebe5556 Price water-only heat-network DHW without a plant-efficiency divisor 🟩
SAP 10.2 §4.3 (p.24) puts the water-heating efficiency in the Table 12
heat price, and C4 (p.53) scopes the plant efficiency to CO2/PE only, so
worksheet (310) = (64) × (305a) × (306) carries no efficiency term. The
dwelling-side divisor was applying it a second time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:24:34 +00:00
Daniel Roth
bf4af89b3a Price water-only heat-network DHW without a plant-efficiency divisor 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 10:22:37 +00:00
Daniel Roth
217dcecfa9
Merge pull request #1595 from Hestia-Homes/fix/1589-refetch-epc-is-ignored
Apply the ADR-0001 Recency Tie-Break when refetch_epc=True (#1589)
2026-07-15 11:00:56 +01:00
Daniel Roth
093e5ce041 Merge branch 'main' into fix/1589-refetch-epc-is-ignored 2026-07-15 09:45:20 +00:00
Daniel Roth
b02519320f update local trigger script 2026-07-15 09:42:24 +00:00
Daniel Roth
dcf5628029 Model the newer stored survey when refetching EPCs 🟪
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:40:52 +00:00
Daniel Roth
870ec68dba Model the newer stored survey when refetching EPCs 🟩
Read stored lodged EPCs whatever refetch_epc says, so a stored assessment
can win the ADR-0001 Recency Tie-Break against the gov register.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:40:15 +00:00
Daniel Roth
7a2f29027c Model the newer stored survey when refetching EPCs 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:37:35 +00:00
KhalimCK
7f68912308
Merge pull request #1591 from Hestia-Homes/feat/pashub-extractor-fixes-and-runner
PasHub extractor accuracy: Guinness cohort 12.4%→20.0% within-0.5, MAE 2.56→1.38
2026-07-15 10:36:56 +01:00
Daniel Roth
04f72e2d32 Keep the stored survey when the register has no cert or ties on date 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:36:21 +00:00
Daniel Roth
aeae322a4e Use the fetched gov cert when nothing is stored 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:35:19 +00:00
Daniel Roth
3a76bd0f7c Use the fetched gov cert when nothing is stored 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:35:01 +00:00
Daniel Roth
dd1ea99c3d Use the fetched gov cert when it is the newer assessment 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:34:37 +00:00
Daniel Roth
22bd0eadbe Use the fetched gov cert when it is the newer assessment 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:33:28 +00:00
Daniel Roth
ec584fc84c Prefer the newer of a stored survey and a fetched gov cert 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:33:06 +00:00
Daniel Roth
d1be7c2842 Prefer the newer of a stored survey and a fetched gov cert 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 09:32:50 +00:00
Khalim Conn-Kowlessar
bb7f05693c Update golden for the secondary-heating int-code + retighten pashub MAE post-#1592-revert
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 09:15:46 +00:00
Khalim Conn-Kowlessar
dc271e959a Revert the water-only heat-network calculator changes (tracked in #1592)
Backs out the WHC-950/951/952 primary-loss (d3c0b9e4) and flat-rate-charging
(fecf4f62) changes to cert_to_inputs.py: they fire on ANY cert with those
water-heating codes, regressing the gov-API RdSAP corpus
(test_api_path_sap_accuracy_on_rdsap_21_0_1_corpus MAE 0.627 -> 0.630), and an
Opus audit found the water-only branch has a pre-existing plant-efficiency
double count they flow more kWh through. The calculator work + the correct
fix (water_eff = 1.0/(DLF*1.05)) + an Elmhurst-worksheet regression are
tracked in #1592, isolated from the extractor accuracy PR. The cylinder-
insulation MAPPER fix (f5e4814b) is retained.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 09:09:18 +00:00
Khalim Conn-Kowlessar
21674d5ed0 Re-baseline the pashub gauge to 23% within-0.5 / MAE 1.41 for the orientation fix
Khalim-authorised MAE loosening: coding window orientation exposes the known
SAP-10.2-vs-lodged offset the zeroed solar gains were masking; within-0.5 is
the north-star metric and jumps 20.0% -> 23.9%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 08:51:52 +00:00
Khalim Conn-Kowlessar
27accc6bb1 Int-code the surveyed window orientation to its SAP10 octant code 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 08:48:36 +00:00
Khalim Conn-Kowlessar
5276b45836 Int-code the surveyed window orientation to its SAP10 octant code 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 08:45:22 +00:00