Model/packages
Khalim Conn-Kowlessar 006e9842c9 Slice 89: PS pitched-sloping-ceiling roof area uses inclined surface
RdSAP 10 §3.8 "Roof area" spec:
  "Roof area is the greatest of the floor areas on each level...
   In the case of a pitched roof with a sloping ceiling, divide the
   area so obtained by cos(30°)."

The cascade previously used `top_floor_area_m2` (horizontal projection)
verbatim for the roof area calculation — correct for flat roofs and
pitched-with-loft (where assessors measure on the horizontal), but
~15% under-area for PS pitched-sloping-ceiling roofs (1/cos(30°) =
1.1547). For cert 001479 Ext1 + Ext2 (both PS sloping ceiling):

  Ext1: cascade 5.37 m² × 0.15 = 0.81 W/K
        worksheet 6.20 m² × 0.15 = 0.93 W/K  (delta -0.12)
  Ext2: cascade 1.92 m² × 2.30 = 4.42 W/K
        worksheet 2.22 m² × 2.30 = 5.11 W/K  (delta -0.69)
  Total roof W/K shortfall: -0.81

Fix: detect PS pitched-sloping-ceiling roofs via `bp.roof_construction
_type` (string lodgement from the Summary §8 "Roof Type" line) and
apply the 1/cos(30°) inclination factor before rounding the gross
roof area.

Schema addition: `SapBuildingPart.roof_construction_type: Optional[
str] = None` mirrors the existing `floor_construction_type`. Mapper
populates it via `_strip_code(roof.roof_type)` for both Main and
Extension bps — the Elmhurst Summary lodges the roof type
explicitly (e.g. "PS Pitched, sloping ceiling" / "PA Pitched (slates
/tiles), access to loft" / "Flat").

**Result: cert 001479 Summary → mapper → cascade now lands at SAP
69.0094 EXACT (delta -0.0000) — Layer 2 GREEN at 1e-4.** Full fabric
breakdown matches the worksheet exactly:
  fabric_heat_loss = 139.4957 W/K  ✓
    walls   = 39.7652 ✓  party   = 17.0700 ✓
    roof    = 10.3438 ✓  floor   = 23.1705 ✓
    windows = 43.5962 ✓  doors   =  5.5500 ✓

Layer 2 status across the 7 cert chain tests:
  000477  GREEN (was GREEN)
  000516  GREEN (was GREEN)
  001479  GREEN (new — was +1.19 before Slice 87)
  000474  RED   -0.7524 (Elmhurst (12) non-spec — orthogonal)
  000480  RED   -1.0273 (Elmhurst (12) non-spec — orthogonal)
  000487  RED   +0.4834 (Elmhurst (12) non-spec — orthogonal)
  000490  RED   -1.1042 (Elmhurst (12) non-spec — orthogonal)

Cohort cascade pins remain GREEN (66 of 66) — hand-built fixtures
have roof_construction_type=None (default) so the new code path is
inert for them; their roofs use RR detailed_surfaces with explicit
areas already.

Pyright net-zero on every touched file (heat_transmission 13 → 13,
mapper 35 → 35, epc_property_data 0 → 0).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 21:00:34 +00:00
..
domain Slice 89: PS pitched-sloping-ceiling roof area uses inclined surface 2026-05-25 21:00:34 +00:00
fetchers added potential file scaffolding: 2026-05-15 10:56:53 +00:00
repos added potential file scaffolding: 2026-05-15 10:56:53 +00:00
utils added potential file scaffolding: 2026-05-15 10:56:53 +00:00
README.md added potential file scaffolding: 2026-05-15 10:56:53 +00:00

Shared packages

Workspace packages consumed by services/*. Each package is its own Python distribution with its own pyproject.toml; services import via the workspace dependency mechanism ({ workspace = true }).

Package Purpose
domain/ Shared domain types — Property, BaselinePerformance, Plan, Scenario, EpcPropertyData, etc. No persistence, no IO, no business logic.
repos/ Persistence layer — one repo per aggregate. Owns the SQL. Depends on domain.
fetchers/ External API clients (gov EPC, Ofgem, Google Solar, etc.). Depend on domain for response shapes.
utils/ Cross-cutting infra — logging, S3, CloudWatch URL builders, SQS task helpers.

Adding a new shared package

Only when a real second consumer materialises. Don't pre-shatter (repos-epc, repos-property, ...) — split when a deployment needs to drop a dep, not before.

See ../ara_backend_design.md §11 for the broader monorepo layout and ../CONTEXT.md for the domain glossary that names the types living in domain/.