Model/backend/documents_parser
Khalim Conn-Kowlessar 7d46018386 Slice 100a: API path — surface Detailed-RR per-surface areas
Two RR shapes coexist in real-API JSON: cohort certs (6035, 0240,
schema test 21_0_1.json) lodge `room_in_roof_type_1` (RdSAP §3.9.1
Simplified Type 1 — gable lengths only, cascade applies the 2.45 m
default storey height); cert 9501 lodges `room_in_roof_details`
(RdSAP §3.9 Detailed RR — per-surface lengths + heights + flat-
ceiling detail). The schema only modelled the Simplified-Type-1
wrapper, so `from_dict` parsed cert 9501's Detailed-RR block as
None and the API mapper built `SapRoomInRoof` with `detailed_
surfaces=None`. The cascade then defaulted to Simplified Type 2
"all elements" (RR floor area × Table 18 col(4) age-B U=2.30) for
the whole RR → roof HLC 149.43 W/K vs worksheet 18.10 (Δ +131.32).

Changes:
- Add `RoomInRoofDetails` dataclass to both schema 21.0.0 and 21.0.1
  with the 10 fields the JSON lodges: gable_wall_type_{1,2} +
  gable_wall_length_{1,2} + gable_wall_height_{1,2} + flat_ceiling_
  length_1 + flat_ceiling_height_1 + flat_ceiling_insulation_
  type_1 + flat_ceiling_insulation_thickness_1. `SapRoomInRoof`
  gains a sibling `room_in_roof_details` field next to the legacy
  `room_in_roof_type_1`; both shapes are now lossless.
- Extract `_api_build_room_in_roof` mapper helper that reads from
  whichever block is present and populates
  `SapRoomInRoof.detailed_surfaces` from the Detailed-RR block.
  Gables route to `gable_wall_external` for flats (top-floor flats
  with RR sit at the end of the building, no neighbour above) and
  to `gable_wall` (party at U=0.25) otherwise — mirrors the Summary
  mapper's `_map_elmhurst_rir_surface` heuristic.
- Replace both inline `SapRoomInRoof(...)` builds in
  `from_rdsap_schema_21_0_0` and `from_rdsap_schema_21_0_1` with
  the helper.

Effect on cert 9501 API path:
- roof HLC 149.43 → 18.10 (= worksheet 18.10 exact)
- walls HLC 168.74 → 218.81 (= worksheet 218.81 exact)
- (37) total HLC 382.19 → 297.54 (worksheet 296.68; Δ +0.86)
- sap_continuous still -9.27 vs worksheet because TFA on the API
  path is still 81.28 (missing the 31.8 m² RR floor area) — next
  slice closes that.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 22:01:41 +00:00
..
handler address JTK review comments 2026-04-20 15:11:17 +00:00
tests Slice 100a: API path — surface Detailed-RR per-surface areas 2026-05-26 22:01:41 +00:00
__init__.py Map to RdSapSiteNotes from site notes JSON 🟥 2026-04-16 13:54:03 +00:00
db_writer.py include updating epc_property_data to pashub to ara workflow 2026-04-29 09:55:14 +00:00
elmhurst_extractor.py Slice 99d: surface PV array from Elmhurst Summary §19.0 2026-05-26 21:38:14 +00:00
extractor.py Handle wall thickness "Unmeasurable" 🟩 2026-04-30 16:41:16 +00:00
local_runner.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00
parser.py load ecmk site notes to db 2026-04-29 11:20:47 +00:00
pdf.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00