Map sap_version on full-SAP certs so pre-SAP10 rebaseline fires 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-25 20:36:04 +00:00
parent 14c777f37b
commit cff5b061a4
2 changed files with 8 additions and 0 deletions

View file

@ -734,6 +734,10 @@ class EpcPropertyDataMapper:
door_count, insulated_door_u = _sap_door_aggregates(schema)
return EpcPropertyData(
uprn=schema.uprn,
# SAP 2012 (~9.92) for this family — carried so CalculatorRebaseliner
# fires trigger (a) (sap_version < 10.2 → Effective = the SAP-10.2
# calc) instead of keeping the lodged SAP-2012 score (ADR-0037).
sap_version=schema.sap_version,
dwelling_type=(
schema.dwelling_type
if isinstance(schema.dwelling_type, str)

View file

@ -198,6 +198,10 @@ class SapSchema17_1:
sap_heating: SapHeating
sap_energy_source: SapEnergySource = field(default_factory=SapEnergySource)
sap_ventilation: SapVentilation = field(default_factory=SapVentilation)
# SAP spec the cert was lodged under (~9.92 = SAP 2012 for this family).
# Drives Rebaselining trigger (a): sap_version < 10.2 → Effective = the
# SAP-10.2 calc, not the lodged figure (ADR-0037). Optional defensively.
sap_version: Optional[float] = None
# measured living-room area (m²); the engine consumes it via a back-solved
# habitable_rooms_count (Table 27). Optional — 100% present in the corpus.
living_area: Optional[Union[int, float]] = None