diff --git a/backend/documents_parser/elmhurst_extractor.py b/backend/documents_parser/elmhurst_extractor.py index 1f61fedf..e8a90d91 100644 --- a/backend/documents_parser/elmhurst_extractor.py +++ b/backend/documents_parser/elmhurst_extractor.py @@ -563,6 +563,7 @@ class ElmhurstSiteNotesExtractor: u_value_known=main_walls.u_value_known, party_wall_type=main_walls.party_wall_type, thickness_mm=main_walls.thickness_mm, + insulation_thickness_mm=main_walls.insulation_thickness_mm, alternative_walls=self._alternative_walls_from_lines(wall_lines), ) else: diff --git a/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py b/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py index e2c32953..635b5308 100644 --- a/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py +++ b/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py @@ -59,6 +59,7 @@ _SUMMARY_001479_PDF = _FIXTURES / "Summary_001479.pdf" _SUMMARY_000897_PDF = _FIXTURES / "Summary_000897.pdf" _SUMMARY_000784_PDF = _FIXTURES / "Summary_000784.pdf" _SUMMARY_000899_PDF = _FIXTURES / "Summary_000899.pdf" +_SUMMARY_000903_PDF = _FIXTURES / "Summary_000903.pdf" # GOV.UK EPB API JSON for cert 001479 — the API-path counterpart of the # Summary_001479.pdf fixture. Together they drive the API ≡ Summary @@ -620,6 +621,35 @@ def test_summary_0380_cylinder_block_surfaces_full_15_1_lodging() -> None: assert epc.sap_heating.cylinder_thermostat == "Y" +def test_summary_0350_ext1_inherits_main_wall_insulation_thickness() -> None: + # Arrange — cert 0350-2968-2650-2796-5255 is a multi-bp dwelling + # (Main + 1st Extension). Its Summary §7 Walls block lodges + # "1st Extension / As Main Wall / Yes" — the extension's walls + # inherit Main's lodgings (CA Cavity, FE Filled Cavity + External, + # 100 mm). The `_extract_extensions` "As Main Wall" inheritance + # at `elmhurst_extractor.py:559-567` builds a new WallDetails by + # copying Main's fields, but the field set it copies was frozen + # before Slice S0380.4 added `insulation_thickness_mm` — so the + # extension's `WallDetails.insulation_thickness_mm` falls through + # to its dataclass default (None), and the mapper surfaces + # `wall_insulation_thickness=None` on bp[1]. The cascade then + # routes Ext1's composite walls off the lodged-thickness path, + # over-stating Ext1 `external_walls_w_per_k` against worksheet + # line ref (29a) "External walls Ext1 5.21 0.25 1.3025". + pages = _summary_pdf_to_textract_style_pages(_SUMMARY_000903_PDF) + site_notes = ElmhurstSiteNotesExtractor(pages).extract() + + # Act + epc = EpcPropertyDataMapper.from_elmhurst_site_notes(site_notes) + + # Assert — Ext1 inherits Main's 100 mm thickness and the EPC + # surfaces "100mm" on bp[1] (matching bp[0]). + assert len(epc.sap_building_parts) == 2 + main_bp, ext1_bp = epc.sap_building_parts + assert main_bp.wall_insulation_thickness == "100mm" + assert ext1_bp.wall_insulation_thickness == "100mm" + + def test_summary_0380_full_chain_sap_within_spec_floor_of_worksheet() -> None: # Arrange — cert 0380-2471-3250-2596-8761 (Summary_000899.pdf / # dr87-0001-000899.pdf) is the first heat-pump cert under per-cert