Model/backend/epc_api/json_samples
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
..
CEPC-7.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
CEPC-7.1 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
CEPC-8.0.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
RdSAP-Schema-17.0 Map RdSAP-Schema-17.0 certs to EpcPropertyData 🟥 2026-06-12 12:40:04 +00:00
RdSAP-Schema-17.1 Dispatch and map RdSAP-Schema-18.0 certs end-to-end 🟥 2026-06-11 11:12:53 +00:00
RdSAP-Schema-18.0 Dispatch and map RdSAP-Schema-18.0 certs end-to-end 🟥 2026-06-11 11:12:53 +00:00
RdSAP-Schema-19.0 Map RdSAP-Schema-19.0 certs to EpcPropertyData 🟥 2026-06-12 12:19:16 +00:00
RdSAP-Schema-20.0.0 added test for a 1000 examples 2026-06-09 16:02:21 +00:00
RdSAP-Schema-21.0.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
RdSAP-Schema-21.0.1 added test for a 1000 examples 2026-06-09 16:02:21 +00:00
real_life_examples test(accuracy): ratchet 75.5% -> 77.0% via secondary-fuel collision fix on cost path 2026-07-02 19:43:31 +00:00
SAP-Schema-16.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-16.1 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-16.2 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-16.3 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-17.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-17.1 inviestigation with hyde values 2026-06-15 12:13:11 +00:00
SAP-Schema-18.0.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-19.0.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-19.1.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00
SAP-Schema-19.2.0 adding hacky handling for matching on lmk key or uprn 2026-04-09 14:47:54 +01:00