Two API mapper gaps surfacing the cert 001479 +1.18 SAP gap post Slice 93: (1) `SapVentilation.sheltered_sides` from API `built_form` The API schema doesn't lodge sheltered_sides as a discrete field — it's derived per RdSAP §S5 from the dwelling's built_form. The cascade defaults to 2 when missing (right for Mid-Terrace) but wrong for detached/semi/end-terrace. Cert 001479 (built_form=2 Semi- Detached) needs 1 sheltered side; default 2 over-counted shelter factor → line (21) under by 0.185 → ventilation under by ~2 ACH/yr. New `_api_sheltered_sides` translator + `_API_BUILT_FORM_TO_ SHELTERED_SIDES` table (1=Detached/0, 2=Semi/1, 3=End-T/1, 4=Mid-T/2, 5=Encl-End/2, 6=Encl-Mid/3) — mirrors the cohort Elmhurst `_ELMHURST_SHELTERED_SIDES_BY_BUILT_FORM` keyed by the API integer enum. (2) `SapBuildingPart.floor_type` from API `floor_heat_loss` The Slice 87 spec rule for §2(12) suspended-timber-floor infiltration (`_has_suspended_timber_floor_per_spec` in cert_to_inputs) requires the Main bp's lowest floor to have `floor_type == "Ground floor"` to apply the (12)=0.2/0.1 rule. The API mapper wasn't surfacing this string (only floor_construction_type), so the spec rule short- circuited to False even for genuine ground floors and the cascade's line (12) was 0.0 instead of 0.2. New `_api_floor_type_str` translator + `_API_FLOOR_HEAT_LOSS_TO_ FLOOR_TYPE` table (1="To external air" for cantilevered exposed floors, 7="Ground floor"). Routes correctly for cert 001479: Main + Ext1 carry floor_heat_loss=7 → both Ground floor; Ext2 carries floor_heat_loss=1 → exposed (its is_exposed_floor=True already lifts the floor U cascade to Table 20). **Result on cert 001479 API path:** SAP delta: +1.18 → +0.0006 (essentially exact match at integer SAP) Cascade SAP=69.0100 vs worksheet 69.0094 — within 1e-3 of target. The remaining ~0.001 SAP gap is dominated by: - hot_water_kwh_per_yr: +6.7 (API 2365.0 vs target 2358.3) - internal_gains Σ: +25.7 W·months (subtle gain-cascade differences) - solar_gains Σ: +1.5 W·months Sub-1e-3 SAP impact each; would need slice-by-slice diagnosis to close to the strict 1e-4 bar. Layer 3 API-mapper-vs-Summary-mapper EpcPropertyData equivalence: the API path now produces SAP within 0.001 of the Summary path (Summary Layer 2 = 69.0094 EXACT). API integer SAP = 69 = worksheet integer SAP = 69 ✓ — matches the API's published energy_rating_ current=69 (zero residual on the production goal metric). Golden cert residuals: 8 of 10 expectations shifted by Slices 90-94 cascade improvements. Spec-compliance shifts; new residuals pinned. Pyright: mapper.py 33 → 33. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .devcontainer | ||
| .github/workflows | ||
| .idea | ||
| .vscode | ||
| asset_list | ||
| backend | ||
| backlog | ||
| datatypes | ||
| docs | ||
| epr_data_exports | ||
| etl | ||
| infrastructure/terraform | ||
| model_data/requirements | ||
| packages | ||
| recommendations | ||
| scripts | ||
| services | ||
| sfr/principal_pitch | ||
| survey_report | ||
| utils | ||
| .coveragerc | ||
| .dockerignore | ||
| .gitignore | ||
| __init__.py | ||
| AGENTS.md | ||
| ara_backend_design.md | ||
| BaseUtility.py | ||
| CLAUDE.md | ||
| conftest.py | ||
| CONTEXT.md | ||
| devcontainer.sh | ||
| Dockerfile.test | ||
| Dockerfile.test.dockerignore | ||
| Makefile | ||
| MEMORY.md | ||
| package-lock.json | ||
| package.json | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| pytest.ini | ||
| README.md | ||
| run_backlog.sh | ||
| run_lambda_local.sh | ||
| serverless.yml | ||
| test.requirements.txt | ||
| tox.ini | ||
| UBIQUITOUS_LANGUAGE.md | ||
Model Repository
This repository contains the code pertaining to the development of the data science and machine learning products being utilised by Hestia.
The different folders in this repository relate to services that can be used independently, or can be imported and used as part of a larger application
Getting Started
Prerequisites
Dev Container Setup
This repo uses a Docker Compose-based dev container. The model-backend service joins a shared-dev Docker network so it can communicate with other local services (e.g. a frontend container) running on your machine.
VS Code users: The initializeCommand in devcontainer.json creates the shared-dev network automatically before the container starts. No manual step required — just open the repo and select Reopen in Container.
Non-VS Code / CI workflows: Run the following once before starting the container:
make dev-setup
This is idempotent and safe to re-run if the network already exists.
Folders
backend/
This folder contains the code for the fastapi backend service, which provides an interface to much of the functionality in this repository, for the frontend
model_data/
This folder contains related to the reading and preparation of assessment model data, including pulling out epc attributes
Testing
All tests can be run, against the configuration in pytest.ini running
pytest
This will run the complete panel of tests and report on coverage in the locations specified by the pytest.ini file.
To run tests in a specific service, e.g. inside of model_data, simply run
pytest --cov-config=model_data/.coveragerc --cov=model_data
This will produce the test results and coverage reports