The gov-API `secondary_fuel_type` enums 5 (anthracite) / 9 (dual fuel) / 33 (coal) collide in VALUE with same-valued RdSAP-10 Table-32 codes for OTHER fuels (5=bulk LPG, 9=LPG SC11F, 33=elec 10h-low). The main-fuel boundary and the CO2/display `_secondary_fuel_cost_gbp_per_kwh` already canonicalise these via `canonical_fuel_code`, but the SAP-DRIVING `_fuel_cost` cascade had a SEPARATE inline secondary rate that passed the raw enum straight to the price lookup — so the two paths diverged and the cost path silently mis-priced. Anthracite (enum 5) was billed at the bulk-LPG code-5 rate 12.19 p/kWh instead of 3.64 — a 3x over-cost on the secondary that under-rated every solid-fuel-secondary dwelling. Worst: corpus cert 100050355518 (semi, 2 extensions, anthracite room-heater secondary) lodged 36 / engine 20.8 -> 35.5. Its CO2/PE already matched lodged (the demand cascade was right) — a pure cost-side gap, which is what localised it. Fix: canonicalise `secondary_fuel` before the Table-32 lookup in `_fuel_cost`, mirroring the main-fuel boundary. 55 corpus certs carry a colliding secondary. Gauge: within-0.5 75.5% -> 77.0%, SAP MAE 0.708 -> 0.668 (floors ratcheted). The prior enum-9 test only guarded the display helper; new test_fuel_cost_secondary_colliding_fuel_priced_at_canonical_rate pins the _fuel_cost cost path directly. RealCertExpectation pinned for 100050355518 (36 = lodged). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .claude/skills | ||
| .devcontainer | ||
| .github/workflows | ||
| .idea | ||
| .vscode | ||
| applications | ||
| asset_list | ||
| backend | ||
| backlog | ||
| datatypes | ||
| deployment/terraform | ||
| docs | ||
| domain | ||
| epr_data_exports | ||
| etl | ||
| harness | ||
| 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 | ||
| modelling_audit.md | ||
| next_claude_prompt.txt | ||
| P960-0001-001431-2.pdf | ||
| package-lock.json | ||
| package.json | ||
| playground.py.local-backup | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| pytest.ini | ||
| README.md | ||
| run_lambda_local.sh | ||
| serverless.yml | ||
| Summary_001431-3.pdf | ||
| 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