mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Re-map house-coal water-heating overrides onto faithful biomass and immersion archetypes 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
36ead3ca1d
commit
ffbef2d047
2 changed files with 80 additions and 0 deletions
12
scripts/reclassify_water_heating.py
Normal file
12
scripts/reclassify_water_heating.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"""One-time re-classification of water-heating overrides funnelled into house coal.
|
||||
|
||||
Placeholder — decision function stubbed; filled in GREEN.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
|
||||
|
||||
def water_heating_corrections(stored: Iterable[tuple[str, str]]) -> dict[str, str]:
|
||||
raise NotImplementedError
|
||||
68
tests/scripts/test_reclassify_water_heating.py
Normal file
68
tests/scripts/test_reclassify_water_heating.py
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
"""The water-heating reclassify maps the house-coal dumping ground onto faithful
|
||||
biomass / wood / dual-fuel / biodiesel / immersion archetypes, leaves genuine coal
|
||||
and already-correct rows alone, and is idempotent (#1376 / ADR-0043)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from scripts.reclassify_water_heating import water_heating_corrections
|
||||
|
||||
|
||||
def test_house_coal_bucket_rows_are_remapped_to_faithful_fuels() -> None:
|
||||
# Arrange — the biomass/wood family + the "no system / immersion assumed" case
|
||||
# all funnelled into house coal, plus a genuinely-coal row and a correctly-
|
||||
# classified mains-gas row (descriptions arrive lower-cased from the query).
|
||||
stored = [
|
||||
("from main heating system: wood logs", "From main system, house coal"),
|
||||
(
|
||||
"from main heating system: dual fuel: mineral and wood",
|
||||
"From main system, house coal",
|
||||
),
|
||||
(
|
||||
"hot-water only community scheme - boilers: biomass (community)",
|
||||
"From main system, house coal",
|
||||
),
|
||||
(
|
||||
"hot-water only community scheme - boilers: heat from boilers using "
|
||||
"biodiesel from any source (community)",
|
||||
"From main system, house coal",
|
||||
),
|
||||
(
|
||||
"no hot water system present - electric immersion assumed: "
|
||||
"no heating or hot water",
|
||||
"From main system, house coal",
|
||||
),
|
||||
# Genuinely coal — stays (guard resolves house coal, value unchanged).
|
||||
("from main heating system: house coal", "From main system, house coal"),
|
||||
# Already correct — the guard does not claim it.
|
||||
("from main heating system: mains gas", "From main system, mains gas"),
|
||||
]
|
||||
|
||||
# Act
|
||||
corrections = water_heating_corrections(stored)
|
||||
|
||||
# Assert — only the mis-scored rows move, each to its faithful archetype.
|
||||
assert corrections == {
|
||||
"from main heating system: wood logs": "From main system, wood logs",
|
||||
"from main heating system: dual fuel: mineral and wood": (
|
||||
"From main system, dual fuel (mineral and wood)"
|
||||
),
|
||||
"hot-water only community scheme - boilers: biomass (community)": (
|
||||
"From main system, biomass (community)"
|
||||
),
|
||||
"hot-water only community scheme - boilers: heat from boilers using "
|
||||
"biodiesel from any source (community)": (
|
||||
"From main system, biodiesel (community)"
|
||||
),
|
||||
"no hot water system present - electric immersion assumed: "
|
||||
"no heating or hot water": "Electric immersion, electricity",
|
||||
}
|
||||
|
||||
|
||||
def test_already_corrected_rows_need_no_change() -> None:
|
||||
# Act / Assert — idempotent: a re-run against corrected data is a no-op.
|
||||
assert (
|
||||
water_heating_corrections(
|
||||
[("from main heating system: wood logs", "From main system, wood logs")]
|
||||
)
|
||||
== {}
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue