Pre-S0380.64 the mapper silently fell through to wall_construction=None
on three Elmhurst code lodgements that the cohort PDFs use:
- "SG Stone: granite or whinstone" (cert 000565 Ext1)
- "B Basement wall" (cert 000565 Ext3 + Ext4)
- "CF Cavity masonry filled" party wall (cert 000565 Ext1)
Cascade impact on cert 000565 (vs U985-0001-000565.pdf worksheet):
- sap_score 30 → 29 EXACT (was Δ +1)
- sap_score_continuous 30.23 → 29.14 (Δ +1.72 → +0.63)
- space_heating_kwh_per_yr 57909 → 59274 (Δ −1100 → +266)
- HTC 1281 → 1321 W/K (was 234 W/K short
of worksheet line 39 monthly avg 1515.38)
Spec basis:
- SG → 1 (WALL_STONE_GRANITE per domain.sap10_ml.rdsap_uvalues)
is the granite-specific Elmhurst variant of "ST Stone"; same
SAP10 enum, no cascade behaviour change for stone walls.
- B → 6 (BASEMENT_WALL_CONSTRUCTION_CODE per
datatypes/epc/domain/epc_property_data.py:361) routes the
cascade through `part.main_wall_is_basement` →
`u_basement_wall(age_band)` per RdSAP 10 §5.17 / Table 23
(heat_transmission.py:640). Empirically established from a
2026 50k-bulk GOV.UK API sweep (88% co-occurrence with
walls[].description = "Basement wall").
- CF → 4 (Cavity, RdSAP 10 Table 15 row 3 spec U=0.20). The
cascade's `u_party_wall` returns 0.0 / 0.5 / 0.25 for code 4
today, so CF conservatively rounds up to the cavity-unfilled
U=0.5 — matches the pre-existing
`_API_PARTY_WALL_CONSTRUCTION_TO_SAP10[3]` approximation
until `u_party_wall` gains a filled-cavity branch (TODO).
Strict-coverage gate per [[reference-unmapped-api-code]] mirror:
`_elmhurst_wall_construction_int` and
`_elmhurst_party_wall_construction_int` now raise
`UnmappedElmhurstLabel` on a non-empty Elmhurst code that isn't in
the lookup dict, rather than silently returning None. Empty
lodgings (absent fields) continue to return None — the cascade's
own defaults apply. The silent-None failure mode is what hid cert
000565's ~300 W/K cascade fabric-loss gap from the audit chain
until the S0380.64 space-heating residual probe surfaced it.
Cohort coverage swept: every Summary PDF in the test fixtures
folder lodges only {SO, CA, CW, SG, B} wall types and
{'', S, U, CU, CF} party-wall types — the new dict entries cover
all observed codes, so strict-raise does not regress any cohort
fixture (478 pass, 9 expected 000565 cascade-gap fails; was 427
pass + 10 fails per HANDOVER_CERT_000565_COST_CASCADE.md).
Pyright net-zero on touched files (mapper.py 32 → 32 errors;
test_summary_pdf_mapper_chain.py 13 → 13 errors — all pre-existing
in unrelated sections).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
||
|---|---|---|
| .devcontainer | ||
| .github/workflows | ||
| .idea | ||
| .vscode | ||
| applications | ||
| asset_list | ||
| backend | ||
| backlog | ||
| datatypes | ||
| deployment/terraform | ||
| docs/adr | ||
| domain | ||
| epr_data_exports | ||
| etl | ||
| infrastructure | ||
| model_data/requirements | ||
| orchestration | ||
| recommendations | ||
| repositories | ||
| scripts | ||
| sfr/principal_pitch | ||
| survey_report | ||
| tests | ||
| utilities | ||
| utils | ||
| .coveragerc | ||
| .dockerignore | ||
| .gitignore | ||
| __init__.py | ||
| 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_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