Int-code the surveyed secondary-heating label to its Table 4a room-heater code 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-15 00:26:51 +00:00
parent 7b04a9d5f4
commit be1e10e337

View file

@ -6250,7 +6250,9 @@ def _map_sap_heating(
],
has_fixed_air_conditioning=ventilation.has_fixed_air_conditioning,
secondary_fuel_type=secondary_fuel_type,
secondary_heating_type=heating.secondary_heating.secondary_system,
secondary_heating_type=_pashub_secondary_heating_type_code(
heating.secondary_heating.secondary_system
),
shower_outlets=shower_outlets,
cylinder_size=(
_pashub_cylinder_size_code(
@ -6372,6 +6374,37 @@ def _pashub_cylinder_size_code(
return code
# PasHub surveyed "Secondary System:" label → SAP 10.2 Table 4a room-heater
# code (PCDB `room_heaters` descriptions). Passed through raw, the string
# hits `_secondary_efficiency`'s `_int_or_none` and silently defaults to
# code 693 (portable electric heater, eff 1.00) — over-crediting a gas/solid
# open fire that should bill at 40-63% / 32%.
_PASHUB_SECONDARY_HEATING_TYPE_TO_SAP10: Dict[str, int] = {
# Electric direct-acting (eff 1.00) — modal cohort heater.
"Panel, convector or radiant heaters": 691,
# Gas room heaters (Table 4a column A).
"Flush fitting live fuel effect open front fire, sealed to fireplace": 605,
"1980 or later - Open front fire with open flue, sealed to fireplace": 603,
# Solid fuel (eff 0.32 column B).
"Open fire in grate": 631,
}
def _pashub_secondary_heating_type_code(
system_label: Optional[str],
) -> Optional[int]:
"""Resolve a PasHub surveyed secondary-heating system label to its SAP
10.2 Table 4a code at the mapper boundary (ADR-0015). Blank/"No
Secondary Heating" → None; any uncovered non-empty label strict-raises
(mirroring `_pashub_secondary_fuel_code`)."""
if not system_label or system_label == "No Secondary Heating":
return None
code = _PASHUB_SECONDARY_HEATING_TYPE_TO_SAP10.get(system_label)
if code is None:
raise UnmappedPasHubLabel("secondary heating type", system_label)
return code
# PasHub surveyed §Water-Heating cylinder "Insulation Type:" label → SAP10
# `cylinder_insulation_type` cascade code (foam=1 / jacket=2, mirroring
# `_ELMHURST_CYLINDER_INSULATION_LABEL_TO_SAP10`). Passed through raw, the