Audit of the API-SAP error (53% within 0.5) localised the systematic under-rate to ELECTRIC FLATS (houses sit at 60-66% within 0.5; electric flats 13-19%). Decomposing the flat error showed it tracks space-heating demand per m² — the worst certs reach 130-289 kWh/m² (accurate certs sit at 14-110), i.e. a grossly over-stated fabric heat loss, amplified ~4x by the electricity unit price and the steep low-band SAP log curve. Root cause: the gov-EPC API lodges `sheltered_wall="Y"` on alternative wall sub-areas (a sub-area adjacent to an unheated buffer — stair core, adjoining structure), but the field was dropped by the schema + domain dataclasses and the calculator billed the alt sub-area at its full exposed U. RdSAP 10 Table 4 (PDF p.22) "Sheltered": such a wall carries an added external surface resistance R=0.5 m²K/W → U_sheltered = 1/(1/U + 0.5) — the SAME adjustment the main wall already applies for `gable_wall_type=2` (`gable_wall_sheltered`, `_SHELTERED_GABLE_ADDED_RESISTANCE_M2K_W`). Cert 0340-2976 (band-A flat, 42 m² sheltered timber-frame alt) over-stated its wall channel by ~58 W/K → walls 128 -> 70 W/K. Threads the field end-to-end: schema dataclasses (21.0.0/21.0.1) + domain `SapAlternativeWall.is_sheltered` (default False — the Summary/ Elmhurst path leaves it False, sheltering rides through its lodged U-value there, so goldens are untouched) + `from_api_response` mapping `"Y"->True` + `_alt_wall_w_per_k` applying the 0.5 resistance on the cascade path (lodged-U and basement alt-walls return before it). 140 certs (15% of the corpus) carry a sheltered alt-wall; they under- rated at median -0.82 / mean signed -1.33 / 23% within 0.5. Eval: 102 improved, 38 regressed (offsetting-error cases — fix is spec-uniform per [[feedback_software_no_special_handling]]); within-0.5 53.14% -> 54.24%, within-1.0 67.99% -> 69.64%, within-2.0 81.85% -> 83.50%, mean|err| 1.312 -> 1.248, 909 computed / 0 raises. Goldens (6035, 000565) and full calc/epc/parser regression green; pyright net-zero. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .devcontainer | ||
| .github/workflows | ||
| .idea | ||
| .vscode | ||
| applications | ||
| asset_list | ||
| backend | ||
| backlog | ||
| datatypes | ||
| deployment/terraform | ||
| docs | ||
| domain | ||
| epr_data_exports | ||
| etl | ||
| infrastructure | ||
| model_data/requirements | ||
| orchestration | ||
| recommendations | ||
| repositories | ||
| sap worksheets | ||
| 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