Model/backend/documents_parser/tests
Khalim Conn-Kowlessar f2e8b657ce Slice S0380.116: A_RR_shell rounded to 2 d.p. per RdSAP 10 §15 (p.66)
RdSAP 10 Specification §15 "Rounding of data" (PDF p.66):

  "For consistency of application, after expanding the RdSAP data into
   SAP data using the rules in this Appendix, the data are rounded
   before being passed to the SAP calculator. The rounding rules are:
     U-values: 2 d.p.
     All element areas (gross) including window areas and conservatory
     wall area: 2 d.p."

The §3.9.1 / §3.10.1 shell formula A_RR_shell = 12.5 × √(A_RR_floor /
1.5) produces a gross element area for the room-in-roof. Pre-slice the
cascade kept the raw float (e.g. cert 000565 BP[0]: 12.5 × √30 =
68.46532...), then subtracted lodged wall surfaces to obtain the (30)
residual roof area. The worksheet rounds A_RR_shell to 2 d.p. (68.47)
BEFORE the subtraction — per §15 above.

Cert 000565 has three BPs that fire this path (Main, Ext1, Ext3 — all
have detailed wall surfaces with no `slope` / `flat_ceiling` /
`stud_wall` lodgement, so §3.10.1 residual fires). Each contributes a
sub-rounding residual that the unrounded cascade was missing:

  BP[0] Main: 68.4653 → 68.47; residual 43.9653 → 43.97 (+0.0016 W/K)
  BP[1] Ext1: 59.5119 → 59.51; residual 18.2519 → 18.25 (−0.0007 W/K)
  BP[3] Ext3: 57.7350 → 57.74; residual 17.3450 → 17.35 (+0.0017 W/K)

Movement (HEAD `d0268a5b` → this slice) for cert 000565:
  roof_w_per_k        51.3768 → 51.3795 ✓ EXACT (Δ −0.0027 → 0.0)
  thermal_bridging   128.6448 → 128.6460 ✓ EXACT (Δ −0.0012 → 0.0)
  total_external_a   857.6323 → 857.6400 ✓ EXACT (Δ −0.0077 → 0.0)
  space_heating_kwh 59008.2363 → 59008.3499 ✓ EXACT (Δ −0.1136 → 0.0)
  main_fuel_kwh     34710.7272 → 34710.7941 ✓ EXACT (Δ −0.0669 → 0.0)
  total_fuel_cost    4680.2515 → 4680.2593 ✓ EXACT (Δ −0.0078 → 0.0)
  co2_kg_per_yr      6447.6161 → 6447.6263 ✓ EXACT (Δ −0.0102 → 0.0)
  sap_score_cont       28.5087 → 28.5087 ✓ EXACT (Δ +4.2e-5 → −4.7e-5)
  sap_score (int)           29 ✓ EXACT (preserved)
  ecf                  5.38682 → 5.38683 (vs ws 5.3868, Δ +3.2e-5)

Cert 000565 truly closes — every SAP-result field within 1e-4 of the
worksheet PDF.

Cohort safety: 6 cohort certs (000474..000516) unchanged — cohort
000516's roof routes through the Detailed branch with `slope` /
`flat_ceiling` / `stud_wall` lodgements, so `has_roof_lodgement=True`
short-circuits the §3.10.1 residual block. Cohort certs 000474/477/
480/487/490 are pre-S0380.103 hand-built fixtures whose RR fields don't
exercise the simplified A_RR_shell path (rir.floor_area=0 or
detailed_surfaces only).

Test added: `test_summary_000565_a_rr_shell_rounded_2_dp_closes_roof_
w_per_k_per_rdsap_10_section_15` pins the cascade roof_w_per_k = 51.3795
exactly (Δ ≤ 1e-4 vs worksheet (30) Σ).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 20:18:53 +00:00
..
fixtures Slice S0380.52: cert 000565 Elmhurst-only mapper-driven cascade pin + glazing-label coverage 2026-05-28 22:03:52 +00:00
__init__.py Map to RdSapSiteNotes from site notes JSON 🟥 2026-04-16 13:54:03 +00:00
test_elmhurst_end_to_end.py Slice S0380.17: map Elmhurst §11 glazing-type labels to SAP10 codes 2026-05-27 23:05:52 +00:00
test_elmhurst_extractor.py extract window frame details from elmhurst site notes 🟥 2026-04-27 15:50:25 +00:00
test_end_to_end.py P6.1 follow-on: unbox BuildingPartIdentifier at backend boundaries 2026-05-20 09:58:23 +00:00
test_extractor.py Handle wall thickness "Unmeasurable" 🟩 2026-04-30 16:41:16 +00:00
test_pdf.py rename example site notes to PasHub_ and add Elmhurst example 2026-04-24 13:01:51 +00:00
test_summary_pdf_mapper_chain.py Slice S0380.116: A_RR_shell rounded to 2 d.p. per RdSAP 10 §15 (p.66) 2026-05-30 20:18:53 +00:00