fix(mapper): map truncated Elmhurst glazing label "Double between 2002" (RdSAP 10 Table 24 code 3)

The full RdSAP-Schema-21 label is "Double between 2002 and 2021" (double
glazing installed 2002-2021, SAP 10.2 Table 24 code 3). When the Elmhurst
Summary PDF wraps the trailing "and 2021" into an adjacent table cell that
the extractor joins away, the surfaced label truncates to "Double between
2002" — the same artifact already handled for "Triple post or during".
`_elmhurst_glazing_type_code` raised UnmappedElmhurstLabel on it, blocking
the whole Summary (surfaced on the simulated-case-46 multi-attribute
worksheet). Added the truncated form as a code-3 alias.

pyright not installed in this container.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-21 06:15:25 +00:00
parent d7a60efcdf
commit d05fdbe6f2
2 changed files with 32 additions and 0 deletions

View file

@ -6942,6 +6942,12 @@ _ELMHURST_GLAZING_LABEL_TO_SAP10: Dict[str, int] = {
"Single glazing": 1,
"Double pre 2002": 2,
"Double between 2002 and 2021": 3,
# Year-truncated form of "Double between 2002 and 2021": the trailing
# "and 2021" wraps to an adjacent PDF table cell that the extractor
# joins away (same artifact as "Triple post or during" below). Same
# SAP 10.2 code 3 (DG 2002-2021) — surfaced on the simulated-case-46
# multi-attribute worksheet.
"Double between 2002": 3,
"Double with unknown install date": 3,
"Double with unknown 16 mm or install date more": 3,
# Elmhurst §11 lodgement of RdSAP-21 schema row 7 "double, known

View file

@ -0,0 +1,26 @@
"""Mapper boundary: the Elmhurst §11 "Double between 2002" glazing label.
The full RdSAP-Schema-21 label is "Double between 2002 and 2021" (SAP 10.2
Table 24 code 3 double glazing installed 2002-2021). When the Elmhurst
Summary PDF wraps the trailing "and 2021" into an adjacent table cell the
extractor joins away, the surfaced label truncates to "Double between 2002"
(the same artifact already handled for "Triple post or during"). Before this
was mapped the truncated form raised `UnmappedElmhurstLabel`, blocking the
whole Summary (surfaced on the simulated-case-46 multi-attribute worksheet).
"""
from datatypes.epc.domain.mapper import (
_elmhurst_glazing_type_code, # pyright: ignore[reportPrivateUsage]
)
def test_truncated_double_between_2002_maps_to_code_3() -> None:
# Arrange — the year-truncated form of "Double between 2002 and 2021".
# Act
code = _elmhurst_glazing_type_code("Double between 2002")
full = _elmhurst_glazing_type_code("Double between 2002 and 2021")
# Assert — both resolve to SAP 10.2 Table 24 code 3 (DG 2002-2021).
assert code == 3
assert full == 3