Model/datatypes/epc/schema
Khalim Conn-Kowlessar 6385a0be85 fix(mapper): map dropped §3.9.2 Simplified Type-2 room-in-roof (API)
The gov API lodges a §3.9.2 Simplified Type-2 RR (a room-in-roof bounded by
continuous common walls) under `room_in_roof_type_2` — gable + common-wall
lengths AND heights. The block was undeclared → `from_dict` dropped it →
neither the Type-1 nor Detailed path fired → the cascade's Simplified branch
billed the WHOLE A_RR shell (12.5√(floor/1.5)) at the Table-18-col-4 default
with no gable/common-wall deduction (over-count → under-rate; 7 corpus certs
at signed −5.02).

Fix: declare `RoomInRoofType2` on rdsap_schema_21_0_0/_21_0_1 + SapRoomInRoof,
and build `detailed_surfaces` by MIRRORING the worksheet-validated Summary
path (`_map_elmhurst_rir_surface`, is_simplified) rather than back-solving:
  common wall → L × (0.25 + H)                    (billed at the main-wall U)
  gable       → L × (0.25 + H) − Σ (H − H_cw)²/2  (RdSAP 10 §3.9.2 + Table 4)
The gable correction sums all common walls (exposed/party/sheltered, incl.
the H=0 absent-gable negative-area case that deducts from the A_RR residual);
a Connected gable sums only the common walls it overtops. The
`gable_wall_type_*` code routes the kind (0/1/2/3 = Party/Exposed/Sheltered/
Connected). A raw-L×H prototype scattered; the §3.9.2 quadratic is the
missing piece.

Validation is cross-mapper parity, NOT a corpus back-solve: `_api_type_2_
surfaces` produces surfaces IDENTICAL to the Summary path on cohort cert
000565 (connected_wall 3.68, gable_wall_external 16.08/27.68, common walls,
and the −0.17 absent-gable quadratic), and 000565 is pinned to 1e-4 in the
harness — so the API RR fabric is now correct by construction. The remaining
type-2 cohort SAP scatter is unrelated per-cert causes (stone walls,
secondary fuel), not the RR.

Gauges: corpus within-0.5 67.6% → 67.9% (MAE 0.979 → 0.959); /tmp 71.7% →
71.8% (MAE 0.838 → 0.822). Harness 47/47 (000565 unchanged); regression =
the 3 pre-existing fails; pyright net-zero (65=65).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 15:01:11 +00:00
..
tests Slice 44: flat_roof_insulation_thickness mapper fix — surface lodged value on SapBuildingPart 2026-05-24 15:28:10 +00:00
__init__.py first draft dataclasses with loading tests 2026-04-10 11:33:17 +00:00
common.py first draft dataclasses with loading tests 2026-04-10 11:33:17 +00:00
helpers.py slice 10.5: PhotovoltaicArray on SAP10 schema + EpcPropertyData 2026-05-16 16:00:25 +00:00
rdsap_schema_17_0.py Map RdSAP-Schema-17.0 certs to EpcPropertyData 🟩 2026-06-12 12:45:19 +00:00
rdsap_schema_17_1.py Dispatch and map RdSAP-Schema-17.1 certs end-to-end 🟩 2026-06-11 12:21:17 +00:00
rdsap_schema_18_0.py Map Not-Defined glazing code to a valid type for windowless 18.0 certs 🟩 2026-06-11 11:55:46 +00:00
rdsap_schema_19_0.py Map RdSAP-Schema-19.0 certs to EpcPropertyData 🟩 2026-06-12 12:29:36 +00:00
rdsap_schema_20_0_0.py fix(mapper): handle 'ND' multiple_glazing_type on RdSAP-Schema-20.0.0 2026-06-15 06:43:55 +00:00
rdsap_schema_21_0_0.py fix(mapper): map dropped §3.9.2 Simplified Type-2 room-in-roof (API) 2026-06-16 15:01:11 +00:00
rdsap_schema_21_0_1.py fix(mapper): map dropped §3.9.2 Simplified Type-2 room-in-roof (API) 2026-06-16 15:01:11 +00:00