From 744aa5482d20a79f4a2ffbfed7a2f7feb5571b72 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 11 Jun 2026 12:02:16 +0000 Subject: [PATCH] =?UTF-8?q?Derive=20hot-water=20bath=20and=20mixer=20count?= =?UTF-8?q?s=20from=20room=20counts=20for=2018.0=20certs=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- datatypes/epc/domain/mapper.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/datatypes/epc/domain/mapper.py b/datatypes/epc/domain/mapper.py index e738f381..514e78e2 100644 --- a/datatypes/epc/domain/mapper.py +++ b/datatypes/epc/domain/mapper.py @@ -743,6 +743,8 @@ class EpcPropertyDataMapper: @staticmethod def from_rdsap_schema_18_0(schema: RdSapSchema18_0) -> EpcPropertyData: es = schema.sap_energy_source + # ADR-0028: instantaneous_wwhrs holds bath/shower ROOM counts. + iw = schema.sap_heating.instantaneous_wwhrs return EpcPropertyData( uprn=schema.uprn, assessment_type=schema.assessment_type, @@ -809,6 +811,20 @@ class EpcPropertyDataMapper: ), sap_heating=SapHeating( instantaneous_wwhrs=InstantaneousWwhrs(), + # ADR-0028: derive HW demand counts from the bath/shower + # ROOM counts (instantaneous_wwhrs is the false-friend container). + number_baths=( + iw.rooms_with_bath_and_or_shower + + iw.rooms_with_bath_and_mixer_shower + if iw is not None + else None + ), + mixer_shower_count=( + iw.rooms_with_mixer_shower_no_bath + + iw.rooms_with_bath_and_mixer_shower + if iw is not None + else None + ), main_heating_details=[ MainHeatingDetail( has_fghrs=d.has_fghrs == "Y",