mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-08-03 05:18:22 +00:00
Offer EWI/IWI on a gov-API system-built wall (code 8) 🟥
The gov-EPC API lodges a system-built wall as `wall_construction == 8` per the authoritative GOV.UK RdSAP `WallConstructionCode` enumeration (communitiesuk/epb-data-warehouse `.../SAP-Domains.xsd`: 8 = "system built" in every schema version 17.0-21.0.1; park home is 10). The solid- wall Recommendation Generator instead read code 8 as the Elmhurst park-home label and suppressed the whole cohort's EWI/IWI Recommendation (a 2026 DB sweep finds ~5.1k certs at code 8, ~2.1k uninsulated main walls). Rewrite the mislabelled park-home test to pin the correct behaviour (code 8 → EWI+IWI), and add a genuine park-home test on the gov code 10 so the fix doesn't start over-offering on real park homes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DX8oAGsGkBHq3U4dsxYRzz
This commit is contained in:
parent
7f0056c700
commit
79bf28d8cb
1 changed files with 35 additions and 5 deletions
|
|
@ -153,13 +153,43 @@ def test_treatable_old_band_solid_wall_keeps_its_insulation_options() -> None:
|
|||
}
|
||||
|
||||
|
||||
def test_park_home_wall_yields_no_solid_wall_recommendation() -> None:
|
||||
# Arrange — a park home (wall_construction code 8) with an uninsulated
|
||||
# as-built wall. Code 8 is NOT system-built (ADR-0019); a park home's
|
||||
# proprietary panel is never EWI/IWI-suitable, so the generator excludes it.
|
||||
def test_gov_api_system_built_wall_keeps_its_insulation_options() -> None:
|
||||
# Arrange — a SYSTEM-BUILT dwelling as ingested from the gov-EPC API,
|
||||
# where `wall_construction == 8` means "system built" per the
|
||||
# GOV.UK RdSAP `WallConstructionCode` enumeration (8 = system built in
|
||||
# EVERY schema version 17.0-21.0.1). A precast/no-fines-concrete system-
|
||||
# built wall IS solid-wall-insulation-suitable (EWI + IWI), exactly like
|
||||
# `u_wall`'s `_GOV_API_WALL_CODE_TO_TYPE[8] = WALL_SYSTEM_BUILT` already
|
||||
# resolves it for the U-value cascade. Age band B, uninsulated: the
|
||||
# Wall U-Value Gate lets both Options through (0.35 << 2.0).
|
||||
baseline: EpcPropertyData = build_epc() # age band B
|
||||
main: SapBuildingPart = _part(baseline, BuildingPartIdentifier.MAIN)
|
||||
main.wall_construction = 8 # gov-API "system built"
|
||||
main.wall_insulation_type = 4 # as-built / uninsulated — the trigger
|
||||
|
||||
# Act
|
||||
recommendation: Recommendation | None = recommend_solid_wall(
|
||||
baseline, _StubProducts()
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert recommendation is not None
|
||||
assert {option.measure_type for option in recommendation.options} == {
|
||||
"external_wall_insulation",
|
||||
"internal_wall_insulation",
|
||||
}
|
||||
|
||||
|
||||
def test_gov_api_park_home_wall_yields_no_solid_wall_recommendation() -> None:
|
||||
# Arrange — a genuine park home as ingested from the gov-EPC API, where
|
||||
# `wall_construction == 10` means "park home wall" per the GOV.UK RdSAP
|
||||
# `WallConstructionCode` enumeration (10 = park home in every schema
|
||||
# version). A park home's proprietary panel is never EWI/IWI-suitable,
|
||||
# so the generator must still exclude it — the fix for system-built
|
||||
# (code 8) must not start over-offering on real park homes.
|
||||
baseline: EpcPropertyData = build_epc()
|
||||
main: SapBuildingPart = _part(baseline, BuildingPartIdentifier.MAIN)
|
||||
main.wall_construction = 8
|
||||
main.wall_construction = 10 # gov-API "park home wall"
|
||||
main.wall_insulation_type = 4 # as-built / uninsulated — the trigger
|
||||
|
||||
# Act
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue