Commit graph

7471 commits

Author SHA1 Message Date
Jun-te Kim
8e487a9bae docs(elmhurst): validate slice-5 wall fix against accredited Elmhurst worksheet (uprn 200004296092)
Built the cert in accredited Elmhurst RdSAP10-Online on the lodged register
inputs; downloaded Input Summary + SAP Worksheets (committed alongside).

Confirmed:
- Slice 5 DIRECTION validated: the externally-insulated solid-brick wall is
  billed insulated by both tools (Elmhurst U 0.48, engine U 0.29), far below
  the uninsulated 1.40 the pre-fix §5.8 gate produced.
- ROOF matches EXACTLY (U 0.30, 9.35 W/K).
- Engine 71.74 = lodged 71; Elmhurst current SAP 66 (its "unknown external
  insulation" default is more conservative + this build used a generic combi
  and no keyed wall thickness, so 66 is not a clean engine-comparison).

Follow-up lead (documented in ELMHURST_FINDINGS.md): the engine feeds the
UNMEASURED lodged wall_thickness (360 mm, measured=N) into the §5.6 formula,
whereas RdSAP §5.3 uses measured thickness / Table-3 default otherwise. The
party-wall "difference" is NOT a bug (engine 0.25 is spec-correct, Table 15
row 4). Also adds the build script scripts/hyde/build_200004296092.py.

No engine change in this commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 20:49:58 +00:00
Jun-te Kim
0e784cbb1c test(accuracy): ratchet SAP MAE 0.658 -> 0.647 via wall added-insulation unknown-thickness default
A SOLID-BRICK or STONE wall lodging External/Internal insulation
(wall_insulation_type 1/3) but no measured insulation thickness (gov-API
"NI" -> None) was billed at its UNINSULATED §5.6/Table-6 U-value: the §5.8
added-insulation R-value adjustment gates on `insulation_thickness_mm > 0`,
so an unknown thickness fell straight through to the raw solid-wall U
(~1.4-1.7). This over-counted wall heat loss and under-rated the dwelling.

RdSAP 10 §5.4 (PDF p.32): "the U-value with additional insulation is based
on the thickness of insulation of mineral wool type (assume 100 mm if
thickness is unknown)". Apply that 100 mm default so the §5.8 Table-14
R-value fires. Scoped to solid brick / stone (the only constructions with
a §5.8 R-value path in u_wall) so cavity (composite path) and timber /
system-built walls are untouched.

Localised by deep-diving corpus cert 200004296092 (end-terrace, solid
brick 360 mm "with external insulation", NI): walls 101.7 W/K (U~1.40,
HLP 3.46 = absurd for an insulated wall) -> ~0.29; PE +59.6 -> ~0; engine
64.35 (Δ -6.65) -> 71.74 = lodged 71. ~8 solid-brick/stone corpus certs
carry this NI-thickness-with-insulation shape.

Gauge: within-0.5 held at 77.0%, SAP MAE 0.658 -> 0.647, CO2 0.074 ->
0.073, PE 3.2 -> 3.1 (floor ratcheted). Unit-pinned in test_rdsap_uvalues
(brick 360 mm external NI -> 0.29) + RealCertExpectation 200004296092 = 72.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 20:24:56 +00:00
Jun-te Kim
cb089a630c test(accuracy): ratchet SAP MAE 0.668 -> 0.658 via instantaneous-electric-DHW off-peak fix
An instantaneous point-of-use electric water heater (WHC 907/909, no
cylinder) on an off-peak tariff was billed 100% at the off-peak LOW rate
by the generic electric-off-peak else-branch. But SAP 10.2 §12 (PDF line
2680) computes the off-peak on-peak HW proportion via Table 13, "dependent
on the total floor area and the CYLINDER size" — it presumes a stored-water
cylinder charged overnight. An instantaneous heater has NO cylinder, heats
on demand, and cannot shift to the off-peak window, so 100% of its
consumption bills at the HIGH rate (Table 12a WH high-rate fraction 1.0).

Both the SAP-cost rate (`_hot_water_fuel_cost_gbp_per_kwh`) and the
ADR-0014 / CO2-PE fraction (`_hot_water_high_rate_fraction`) fixed
consistently (low-rate scalar -> 7-hour high rate; fraction 0.0 -> 1.0).

Localised by deep-diving corpus cert 74061136 (HHR-storage mid-floor flat,
WHC 909): PE matched lodged (+1.6, roof+floor zero-loss) while SAP over-rated
+7.72 — the cost-only signature. Its DHW was ours £59 vs lodged £344 (5.8x);
the tariff was the whole gap. Fix: +7.72 -> -1.25 (residual is separate small
fabric). 7 corpus certs carry electric-instantaneous DHW on off-peak; the 3
outside 0.5 all move sharply inward (MAE the win, not within-0.5 crossings).

RdSAP 10 §12 tariff routing confirmed spec-correct (Unknown meter + storage
409 -> off-peak 7-hour, Rule 2) — the bug was the DHW rate, not the tariff.
Unit-pinned in test_cert_to_inputs; RealCertExpectation 74061136 = 72.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 20:04:58 +00:00
Jun-te Kim
928ce293d0 docs(ledger): re-rank at 77.0% + triage electric-tariff & fabric tail
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 19:48:10 +00:00
Jun-te Kim
06a2c413f5 test(accuracy): ratchet 75.5% -> 77.0% via secondary-fuel collision fix on cost path
The gov-API `secondary_fuel_type` enums 5 (anthracite) / 9 (dual fuel) /
33 (coal) collide in VALUE with same-valued RdSAP-10 Table-32 codes for
OTHER fuels (5=bulk LPG, 9=LPG SC11F, 33=elec 10h-low). The main-fuel
boundary and the CO2/display `_secondary_fuel_cost_gbp_per_kwh` already
canonicalise these via `canonical_fuel_code`, but the SAP-DRIVING
`_fuel_cost` cascade had a SEPARATE inline secondary rate that passed the
raw enum straight to the price lookup — so the two paths diverged and the
cost path silently mis-priced.

Anthracite (enum 5) was billed at the bulk-LPG code-5 rate 12.19 p/kWh
instead of 3.64 — a 3x over-cost on the secondary that under-rated every
solid-fuel-secondary dwelling. Worst: corpus cert 100050355518 (semi,
2 extensions, anthracite room-heater secondary) lodged 36 / engine 20.8
-> 35.5. Its CO2/PE already matched lodged (the demand cascade was right)
— a pure cost-side gap, which is what localised it.

Fix: canonicalise `secondary_fuel` before the Table-32 lookup in
`_fuel_cost`, mirroring the main-fuel boundary. 55 corpus certs carry a
colliding secondary.

Gauge: within-0.5 75.5% -> 77.0%, SAP MAE 0.708 -> 0.668 (floors
ratcheted). The prior enum-9 test only guarded the display helper; new
test_fuel_cost_secondary_colliding_fuel_priced_at_canonical_rate pins the
_fuel_cost cost path directly. RealCertExpectation pinned for
100050355518 (36 = lodged).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 19:43:31 +00:00
Jun-te Kim
a11b10f427 docs(skill): bank corpus-1000 findings (cost triangulation, software divergences, assumed-roof rule)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 19:12:48 +00:00
Jun-te Kim
c380377948 test(accuracy): ratchet 74.2% -> 75.5% via 'insulated (assumed)' roof Table-18 fix
RdSAP 10 §5.11.4: a pitched roof lodging thickness "NI" with description
"...insulated (assumed)" was billed at the §5.11.4 observed-retrofit
50 mm row (U 0.68) while the SAME description lodged with "ND" fell
through to the Table 18 age-band default (0.40 for bands A-G). The
ND-vs-NI sentinel is lodging-software noise; "(assumed)" means the
insulation PRESENCE is an age-band assumption, not an observed
retrofit, so Table 18's "thickness cannot be determined" clause
governs both forms. The bare "insulated" description (observed
retrofit, no qualifier) keeps the 50 mm row.

Evidence: the 27-cert loc4+NI corpus cohort was systematically
under-rated (~-1 SAP; zero positive movers among "(assumed)" certs),
vs the 102-cert loc4+ND cohort already on Table 18 at ~0 bias.

Gauge: within-0.5 74.2% -> 75.5%, SAP MAE 0.721 -> 0.708, CO2 MAE
0.09 -> 0.074, PE MAE 3.5 -> 3.2 (floors ratcheted). Unit-pinned in
test_rdsap_uvalues (assumed -> Table 18; bare-insulated -> 0.68
regression guard); integration pin in test_heat_transmission updated;
RealCertExpectation pinned for 10094975827 (66 = lodged, was -1.87).

Ledger: C002 103001004 deferred pending Elmhurst arbitration
(single-immersion off-peak pricing + declared cylinder loss vs
Table-2); C006 quadruplet marked ⚠ (LIG-21.0 software honours lodged
0 extract fans literally vs the Elmhurst-validated 0=unknown->default
convention, worksheet case 46).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 19:06:26 +00:00
Jun-te Kim
b9f1f428b9 test(accuracy): corpus-1000 campaign ledger + C001 4510053280 pinned 75 (lodged-software PSR gap)
Setup for the RdSAP-21.0.1 corpus gauge campaign (74.2% within-0.5,
SAP MAE 0.721 at HEAD, 1000/1000 computed):

- scripts/corpus_1000/build_worklist.py — runs all 1000 corpus certs
  through the gauge's own path (from_api_response -> Sap10Calculator),
  ranks |engine - lodged| descending, clusters by dwelling signature,
  and (re)writes scripts/corpus_1000/worklist.md preserving per-cert
  statuses and notes. 258 certs outside 0.5 in 249 clusters.

- C001 (worst cert, Δ +23.9): uprn 4510053280, ground-floor flat 47 m²
  on ASHP PCDB 100053 (Mitsubishi Ecodan 5 kW, PSR table 0.2-2.0).
  Dwelling PSR 2.031 -> SAP 10.2 N2 footnotes 44/45 heat-pump extension
  (reciprocal interpolation toward 100% at 2x largest PSR) = 305%
  space efficiency, which accredited Elmhurst also applies (golden
  case 56, record 100061). The LODGED software instead treated the
  out-of-range record as invalid and billed 100% direct electric +
  standard schedule (reproduces lodged CO2 to 1%). Lodged-software
  methodology gap, worklist ⚠, engine untouched; observed engine 75
  pinned in test_real_cert_sap_accuracy.

Gauge floors unchanged (no engine change).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 18:28:20 +00:00
Daniel Roth
fad2264def
Merge pull request #1437 from Hestia-Homes/feature/abri-api-integration
Abri API: hubspot deal differ for AmendJob
2026-07-02 18:01:51 +01:00
Jun-te Kim
99ab1ca88f
Merge pull request #1436 from Hestia-Homes/fix/cylinder-uninsulated-storage-loss
Uninsulated / unknown-insulation cylinders no longer drop the SAP storage loss
2026-07-02 17:55:02 +01:00
Jun-te Kim
cde8a5d6ca
Merge pull request #1433 from Hestia-Homes/fix/audit-cylinder-storage-loss-check
Audit check: lodged cylinder with unresolvable insulation drops storage loss
2026-07-02 17:54:49 +01:00
Daniel Roth
60146f0c30 Abri survey amendment trigger defers first-time survey dates to the creation trigger 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:52:49 +00:00
Daniel Roth
1529544c19 Abri survey amendment trigger defers first-time survey dates to the creation trigger 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:52:26 +00:00
Daniel Roth
597cd1c83f Abri survey amendment trigger fires when the confirmed survey time changes on an Abri condition deal 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:52:00 +00:00
Daniel Roth
8c5d1a27ff Abri survey amendment trigger fires when the confirmed survey time changes on an Abri condition deal 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:50:53 +00:00
Daniel Roth
bf344e1b58 Abri survey amendment trigger stays quiet when the survey date and time are unchanged 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:49:19 +00:00
Daniel Roth
fce9d30589 Abri survey amendment trigger stays quiet when the survey date and time are unchanged 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:48:53 +00:00
Daniel Roth
7bfd26476e Abri survey amendment trigger ignores deals that are not Abri condition deals 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:48:26 +00:00
Daniel Roth
16b25c4b54 Abri survey amendment trigger ignores deals that are not Abri condition deals 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:47:51 +00:00
Daniel Roth
dbbb12fa54 Abri survey amendment trigger fires when the confirmed survey date changes on an Abri condition deal 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:47:29 +00:00
Daniel Roth
1c75b44630 Abri survey amendment trigger fires when the confirmed survey date changes on an Abri condition deal 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:47:07 +00:00
Daniel Roth
5df78cf9ba Merge branch 'main' into feature/abri-api-integration 2026-07-02 16:41:46 +00:00
Daniel Roth
ffb0f8cc66
Merge pull request #1434 from Hestia-Homes/feature/abri-api-integration
Abri API: hubspot deal differ for CreateJob
2026-07-02 17:41:18 +01:00
Daniel Roth
fdeb15501f Abri survey creation trigger falls back to project code only when no project is associated 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:29:11 +00:00
Daniel Roth
911e77d7cf Abri survey creation trigger falls back to project code only when no project is associated 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:28:13 +00:00
Daniel Roth
cf5a272d7e Abri survey creation trigger recognises deals by their associated Abri project id 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:27:29 +00:00
Daniel Roth
cc682e3e74 Abri survey creation trigger recognises deals by their associated Abri project id 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:27:05 +00:00
Jun-te Kim
ecefd439fd Cylinder with unknown insulation defaults per RdSAP Table 29 age band 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:11:10 +00:00
Jun-te Kim
6accf365d7 Cylinder with unknown insulation defaults per RdSAP Table 29 age band 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:09:46 +00:00
Jun-te Kim
233f085fb3 Elmhurst 'No Insulation' cylinder (0 mm lodged) takes the uninsulated storage loss 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:08:46 +00:00
Jun-te Kim
4cf3db388f Elmhurst 'No Insulation' cylinder (0 mm lodged) takes the uninsulated storage loss 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:07:20 +00:00
Jun-te Kim
e813cc0ef2 Uninsulated cylinder (type 0) takes the SAP Table 2 jacket t=0 storage loss 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:06:33 +00:00
Jun-te Kim
db488de43d Uninsulated cylinder (type 0) takes the SAP Table 2 jacket t=0 storage loss 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:04:16 +00:00
Daniel Roth
592173e1e5 Abri Condition project gate is a reusable helper for future Abri triggers 🟪
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:03:34 +00:00
Daniel Roth
7aabfdfa5b Abri survey creation trigger ignores syncs with no parseable confirmed_survey_date 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:02:36 +00:00
Daniel Roth
c059771af5 Abri survey creation trigger ignores syncs with no parseable confirmed_survey_date 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:02:08 +00:00
Daniel Roth
fb2b7e164c Abri survey creation trigger matches the Abri Condition project code case-insensitively 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:01:43 +00:00
Daniel Roth
5b9038ab61 Abri survey creation trigger matches the Abri Condition project code case-insensitively 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:01:25 +00:00
Daniel Roth
bd0c45aa57 Abri Condition project code lives in a reusable class constant 🟪
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:00:09 +00:00
Daniel Roth
97bf001fbf Abri survey creation trigger ignores deals outside the Abri Condition project 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:59:38 +00:00
Daniel Roth
882eb1eff9 Abri survey creation trigger ignores deals outside the Abri Condition project 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:59:05 +00:00
Daniel Roth
fc2ba88759 Abri survey creation trigger ignores deals that already have a confirmed_survey_date 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:58:41 +00:00
Daniel Roth
697df8ade3 Abri survey creation trigger ignores deals that already have a confirmed_survey_date 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:58:09 +00:00
Daniel Roth
51ac5e2f5e Abri survey creation trigger fires when confirmed_survey_date is first set on an Abri Condition deal 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:57:26 +00:00
Jun-te Kim
26bcb3e9a6 Pass new cylinder fields through _make_audit test helper
PropertyAudit gained three required cylinder fields; the pre-existing
divergence/goal-shortfall tests construct it via _make_audit, which
wasn't updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:57:04 +00:00
Daniel Roth
bd3c45d81c Abri survey creation trigger fires when confirmed_survey_date is first set on an Abri Condition deal 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:56:49 +00:00
Jun-te Kim
318a859e88 Audit check: lodged cylinder with unresolvable insulation drops storage loss
Portfolio 814 / scenario 1271 audit (2026-07-03): all 26 properties lodging
has_hot_water_cylinder with insulation type 0 (none) or NULL over-rate their
effective baseline by up to +18 SAP (avg +12.7) because
_cylinder_storage_loss_override returns None for any insulation label it
can't resolve and the worksheet keeps the zero-storage-loss combi default.
Same-lodged neighbours split by 19 effective points (WD5 0DP pids
742215/742216, both lodged 54, effective 50 vs 69) and the inflated members
distorted neighbour-divergence cohort medians (E17 6EB pid 742355 Δ+18).

New HIGH check cylinder-storage-loss-dropped fires on the deterministic
input pattern (cylinder present, insulation type ∉ {factory, loose jacket}
or thickness missing) — 28/338 on the motivating portfolio (the 26 above
plus 2 same-pattern rows with no lodged score). The calculator fix
(uninsulated Table 2 loss, or RdSAP Table 29 age-band default) is separate
follow-up work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 15:27:15 +00:00
Jun-te Kim
cf50c53cad
Merge pull request #1431 from Hestia-Homes/fix/refetch-solar-reuse-stored
Fix refetch_solar=False dropping solar from re-modelled plans (reuse stored Solar instead)
2026-07-02 15:27:44 +01:00
Jun-te Kim
100949073f refetch_solar=False models with stored Solar insights and never calls Google 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 14:21:46 +00:00
Jun-te Kim
c1a558d2b5 refetch_solar=False models with stored Solar insights and never calls Google 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 14:19:31 +00:00