Commit graph

7389 commits

Author SHA1 Message Date
Jun-te Kim
c1a75fb45b
Merge pull request #1403 from Hestia-Homes/fix/1376-gas-cpsu-dumping-ground
Retire the Gas CPSU dumping ground: solid-fuel room heaters + electric boilers (#1376)
2026-07-02 09:57:15 +01:00
Jun-te Kim
dc868e87a9
Merge pull request #1405 from Hestia-Homes/fix/1376-offpeak-underfloor
Score off-peak electric underfloor on its own codes, not direct-acting single-meter (#1376)
2026-07-02 09:56:57 +01:00
Jun-te Kim
b94c45a392
Merge pull request #1407 from Hestia-Homes/fix/glazing-nd-single-all-schemas
Honour single-glazed ND certs on every reduced-field synthesis seam
2026-07-02 09:21:40 +01:00
KhalimCK
51f1cafb75
Merge pull request #1408 from Hestia-Homes/audit/plan-stuck-in-low-band
Add plan-stuck-in-low-band audit check + refresh weird-recs catalogue
2026-07-02 00:08:06 +01:00
Jun-te Kim
66d70b6833 Add plan-stuck-in-low-band audit check + refresh weird-recs catalogue
`plan-stops-short-of-goal` fires on anything below the goal band — 322/338
on portfolio 814, mostly flats a single band short of B, which drowns the
real hits. Add a sharper, band-keyed check that isolates the genuinely-
stuck tail: a plan that leaves the dwelling still rated E/F/G with the band
UNCHANGED from baseline on an unlimited-budget scenario — the "E->E, no big
movement" worklist. On portfolio 814 / scenario 1271 it flags just 4 (pids
742121, 742210, 742265, 742347) vs 322. No SAP-points threshold; the
strictly-worse case is left to plan-below-baseline-band so the two
partition cleanly.

Also refresh the find-weird-recommendations skill's Phase 4 catalogue:
register the new check in Phase 1, correct the stale 742121 note (it is an
electric maisonette whose HHRSH IS offered but scores -6.3 SAP, so the
Optimiser correctly drops it — not the old mains-gas story), and add the
742265 community-flat findings (HHRSH/ASHP gated out by heat-network
topology; vaulted-ceiling roof with ND insulation).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 17:22:41 +00:00
Jun-te Kim
0e9bceb2d4 Honour single-glazed ND certs on every reduced-field synthesis seam
A pre-SAP10 RdSAP cert that omits per-window records lodges glazing as a
`multiple_glazing_type` code plus a `window.description` and a
`multiple_glazed_proportion`. When the numeric code is the "ND" (Not
Defined) sentinel, the reduced-field synthesis defaulted to the DG-modal
code 2 (double) — ignoring the two register signals that say otherwise.

`_normalize_sap_schema_16_x` already honours an explicit "Single glazed"
description for 16.x certs (rewriting multiple_glazing_type -> 5), but that
rule was never propagated to the 17.0 / 17.1 / 18.0 / 19.0 / 20.0.0
synthesis seams — they all blindly applied ND -> 2. So a genuinely
single-glazed dwelling was:

  1. scored as double-glazed, overstating its baseline SAP, and
  2. hidden from the glazing generator (which upgrades only single-glazed
     windows), producing no glazing recommendation.

Reproduced on cert 2780-3922-3202-6042-9200 (uprn 10033526327), a
single-glazed community-heated flat lodging multiple_glazing_type="ND",
window "Single glazed", multiple_glazed_proportion 0 — mapped to four
double-glazed windows, no glazing measure offered.

Extend the 16.x rule to all five reduced-field seams via one shared
resolver: on the ND fallback, when the description says "single" or the
multiple-glazed proportion is 0, synthesise single glazing
(`_api_cascade_glazing_type(5) == 1`, SAP10 cascade single, Table 24
U~4.8) — the exact single code the glazing generator's {1, 15} set
matches — else keep each seam's DG-modal default. Refines ADR-0028's ND
handling.

Tests: all five seams synthesise single from a "Single glazed" + 0%
proportion cert; the double-glazed control keeps the DG-modal default;
plus unit pins on the resolver.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 17:10:58 +00:00
Khalim Conn-Kowlessar
f50ee5f957 Reclassify electric-underfloor overrides via the generalized main-heating reclassify 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:51:22 +00:00
Khalim Conn-Kowlessar
9d106d9d6d Deterministically guard the electric-underfloor descriptions 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:48:45 +00:00
Khalim Conn-Kowlessar
6dcb8aee21 Deterministically guard the electric-underfloor descriptions 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:47:59 +00:00
Khalim Conn-Kowlessar
6883864c32 Defer the screed-underfloor meter to the cert while off-peak underfloor asserts Dual 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:46:33 +00:00
Khalim Conn-Kowlessar
1c79b69648 Defer the screed-underfloor meter to the cert while off-peak underfloor asserts Dual 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:36:59 +00:00
Khalim Conn-Kowlessar
749ac3a5ff Resolve electric-underfloor overrides to their own SAP codes dragging electricity 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:36:21 +00:00
Khalim Conn-Kowlessar
ef34f76116 Resolve electric-underfloor overrides to their own SAP codes dragging electricity 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:34:41 +00:00
Khalim Conn-Kowlessar
e5c112a2d3 Document the fuel-aware electric-CPSU resolution in ADR-0045 🟪
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:17:22 +00:00
Khalim Conn-Kowlessar
927384e5a9 Resolve electric CPSU from the property's fuel, keeping gas CPSU on 120 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:16:10 +00:00
Khalim Conn-Kowlessar
8b0176976d Resolve electric CPSU from the property's fuel, keeping gas CPSU on 120 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:12:00 +00:00
Khalim Conn-Kowlessar
fedae2ea00 Resolve an electric-CPSU override to SAP 192 electric on an off-peak meter 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:09:56 +00:00
Khalim Conn-Kowlessar
94a5e79067 Resolve an electric-CPSU override to SAP 192 electric on an off-peak meter 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 16:08:42 +00:00
Khalim Conn-Kowlessar
de7bfc5dfe Reclassify Gas CPSU dumping-ground overrides via the generalized main-heating reclassify 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 15:58:29 +00:00
Khalim Conn-Kowlessar
f6f4c3717d Deterministically guard the Gas CPSU solid-fuel and electric-boiler descriptions 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 15:58:29 +00:00
Khalim Conn-Kowlessar
2b5d38a7f9 Deterministically guard the Gas CPSU solid-fuel and electric-boiler descriptions 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 15:58:28 +00:00
Khalim Conn-Kowlessar
098edf6592 Resolve an electric-boiler override to SAP 191 dragging electricity 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 15:58:27 +00:00
Khalim Conn-Kowlessar
e83c420f3b Resolve an electric-boiler override to SAP 191 dragging electricity 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 15:58:27 +00:00
Khalim Conn-Kowlessar
de4e44aacc Resolve solid-fuel room-heater overrides off Gas CPSU to their SAP codes 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 15:58:25 +00:00
Khalim Conn-Kowlessar
f253a7b9ba Resolve solid-fuel room-heater overrides off Gas CPSU to their SAP codes 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 15:58:25 +00:00
Jun-te Kim
de9159f9b8
Merge pull request #1399 from Hestia-Homes/fix/heating-rec-pcdb-boiler-fallback
Classify PCDB-index gas boilers with no SAP code for heating recs (#1388 A#2)
2026-07-01 15:57:07 +01:00
Jun-te Kim
5b4a1b4966 Classify PCDB-index gas boilers with no SAP code for heating recs
Gov-API certs that lodge a gas boiler as main_heating_category=2 + a PCDB
main_heating_index_number but omit sap_main_heating_code were carried with
a null code, so the heating generators (which gated on sap_main_heating_code
alone) never evaluated them for a boiler upgrade or a system tune-up — they
silently got nothing (£0 works, plateau at D). The SAP calculator already
handles this shape (cert_to_inputs._is_wet_boiler_main), so the calculator
modelled these as wet boilers while the recommenders ignored them.

Mirror the calculator's classification in the generator:
- _is_wet_boiler / _is_electric_boiler fall back, when no SAP code is
  lodged, to a PCDB Table 105 boiler index or main_heating_category in
  {1,2} (heat pumps excluded); electric boilers stay excluded by the code
  range when lodged, else by an electricity main fuel.
- _already_condensing reads the boiler's declared PCDB winter efficiency
  when there is no Table 4b code, so a modern condensing boiler lodged this
  way still isn't offered a pointless like-for-like swap (gets a tune-up).

Verified read-only on portfolio 814 / scenario 1271: pids 742304, 742306,
742322, 742325, 742336 now get a gas_boiler_upgrade (two cross D->C on the
boiler alone) where they had £0 works; predicted properties whose heating
donor is a PCDB-shape boiler (e.g. 742095/742102/742105) also recover a
tune-up. Fixes the A#2 slice of #1388 (and unblocks 742302/742367).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:52:47 +00:00
Jun-te Kim
10e260be23
Merge pull request #1395 from Hestia-Homes/fix/neighbour-divergence-fuel-cohort
neighbour_divergence: key cohorts on main-heating fuel
2026-07-01 15:49:38 +01:00
Jun-te Kim
78da4f390e
Merge pull request #1398 from Hestia-Homes/fix/rdsap-insulated-door-u-value
Normalize RdSAP insulated_door_u_value on the 20.0.0 + 21.0.0 paths
2026-07-01 15:49:24 +01:00
Jun-te Kim
ce0f14a829 Normalize RdSAP insulated_door_u_value on the 20.0.0 + 21.0.0 paths
PRD #1385 phase 2. The 20.0.0 and 21.0.0 mappers dropped insulated_door_u_value
(top-level Optional float), unlike 21.0.1. heat_transmission reads it as the
measured door U-value override (cert_to_inputs -> heat_transmission:809), so
dropping it forced every door onto the RdSAP default U-value.

Verification: new test 3 passed (21.0.0 sample lodges 3; 20.0.0 latent -> inject
1.5 + absent -> None); corpus 6002 passed; SAP-accuracy regressions pass; pyright
unchanged (39 -> 39).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:48:25 +00:00
Daniel Roth
0488696df8
Merge pull request #1397 from Hestia-Homes/fix/1376-hhrsh-baseline-archetype
Add the HHRSH baseline archetype so it stops scoring as old storage (#1376)
2026-07-01 15:41:52 +01:00
Khalim Conn-Kowlessar
2f577c3ebc Re-map old-storage HHRSH overrides onto the high-heat-retention archetype 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:34:49 +00:00
Daniel Roth
ae4a8569e9
Merge pull request #1396 from Hestia-Homes/community-heating-hhrsh
Don't recommend HHRSH or ASHP to properties with community heating
2026-07-01 15:33:57 +01:00
Khalim Conn-Kowlessar
04484edc67 Re-map old-storage HHRSH overrides onto the high-heat-retention archetype 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:33:24 +00:00
Jun-te Kim
d03b52b649
Merge pull request #1394 from Hestia-Homes/fix/rdsap-21-0-0-mvhr-ducts
Normalize RdSAP MVHR PCDF index + duct type on the 21.0.0 path
2026-07-01 15:32:20 +01:00
Khalim Conn-Kowlessar
598aac1556 Route main-heating overrides through the HHRSH guard before the LLM 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:32:14 +00:00
Khalim Conn-Kowlessar
b7848848a5 Deterministically guard the high-heat-retention storage description 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:30:40 +00:00
Khalim Conn-Kowlessar
9711b2e5f5 Deterministically guard the high-heat-retention storage description 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:30:13 +00:00
Khalim Conn-Kowlessar
01e7e1d831 Drag HHRSH's intrinsic control, electricity fuel and off-peak meter 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:29:41 +00:00
Khalim Conn-Kowlessar
ca10966c38 Drag HHRSH's intrinsic control, electricity fuel and off-peak meter 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:27:59 +00:00
Khalim Conn-Kowlessar
a2083b9c7d Resolve a high-heat-retention storage override to SAP code 409 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:27:30 +00:00
Khalim Conn-Kowlessar
79f48c0564 Resolve a high-heat-retention storage override to SAP code 409 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:26:25 +00:00
Jun-te Kim
009394bb19 neighbour_divergence: key cohorts on main-heating fuel
The neighbour SAP-divergence cohort was (postcode, property_type, built_form),
which mixed electric- and gas-heated dwellings. Electricity scores materially
lower in SAP than mains gas for identical fabric, so a mixed-fuel postcode
produced cross-fuel false outliers — an electric dwelling flagged only for being
electric among gas neighbours.

Add the main-heating fuel class to the cohort key (electricity variants — 29/30
+ off-peak 31-40 — collapse to one class; every other code is its own bucket).
Now every flagged divergence is a same-fuel comparison worth investigating. On
portfolio 814 this refined 20 raw divergences to 17 same-fuel ones while keeping
the genuine within-fuel outliers (e.g. the all-electric WC2B 4AW flats at SAP
26/38 vs a cohort median of 67).

Reaches the fuel via epc_main_heating_detail through the indexed property_id —
still never touches the recommendation table. Surfaced by the portfolio-814
recommendation audit (Work item B, #1388).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:24:31 +00:00
Jun-te Kim
7ee33b9ce8 Normalize RdSAP MVHR PCDF index + duct type on the 21.0.0 path
PRD #1385 phase 2. The 21.0.0 mapper dropped mechanical_ventilation_index_number
and mechanical_vent_duct_type, unlike 21.0.1. cert_to_inputs reads both (PCDB
Table 4f/329 heat-recovery/SFP lookup + the Table 329 in-use factor), so an
MVHR/MEV cert on the 21.0.0 path fell back to the SAP default efficiency.

Mirrors 21.0.1 exactly -- only the two fields it actually maps. The other four
mechanical_vent_duct_* schema fields have no mapper OR calculator consumer even
on 21.0.1 (verified), so they're deliberately left alone rather than populating
dead domain fields.

Verification: new test 1 passed (harvested 21.0.0 sample lodges index=12,
duct_type=3); corpus 6002 passed; SAP-accuracy regressions pass; pyright
unchanged (39 -> 39).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 14:24:12 +00:00
Daniel Roth
baaadcdf98
Merge pull request #1392 from Hestia-Homes/fix/1376-water-heating-house-coal
Reclassify water-heating overrides off the house-coal dumping ground (#1376)
2026-07-01 15:19:39 +01:00
Daniel Roth
6eb2a02a6e Gate community-heated dwellings from ASHP recommendation 🟩
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 14:18:52 +00:00
Jun-te Kim
e95c3cf906
Merge pull request #1393 from Hestia-Homes/fix/rdsap-21-0-0-percent-draughtproofed
Normalize RdSAP percent_draughtproofed on the 21.0.0 path
2026-07-01 15:17:50 +01:00
Daniel Roth
576fc948a6 Gate community-heated dwellings from ASHP recommendation 🟥
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 14:17:41 +00:00
Daniel Roth
3d562be398 Gate community-heated dwellings from HHRSH recommendation 🟩
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 14:14:52 +00:00
Daniel Roth
afe6638b36 Gate community-heated dwellings from HHRSH recommendation 🟥
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 14:13:57 +00:00