Two coupled bugs surfaced by cert 001479's mains-gas-fire secondary heating (Summary §14.1 lodges "SAP code 605, Flush fitting live effect gas fire" → fuel 26 mains gas): 1. **Mapper**: `_map_elmhurst_sap_heating` only set `secondary_heating_type` (the SAP code int) — `secondary_fuel_type` stayed None. The Summary PDF doesn't lodge the fuel int separately; it has to be derived from the SAP code range. Add `_elmhurst_secondary_fuel_from_sap_code`: codes 601-630 → 26 (mains gas); other codes return None (the cascade defaults to electric, matching cohort 000490 SAP code 691 electric panel). 2. **Cascade**: `_fuel_cost` in cert_to_inputs hardcoded `secondary_high_rate_gbp_per_kwh = other_uses_gbp_per_kwh` (the standard-electricity tariff) regardless of `secondary_fuel_type`. For gas secondaries this charged 1846 kWh/yr at electric rate (£0.132/kWh = £243) instead of gas rate (£0.0348/kWh = £64) — a ~£175/yr ECF distortion ≈ 9 SAP points on cert 001479. Route the cost through `table_32_unit_price_p_per_kwh(secondary_fuel)` when lodged. Worksheet line (242) confirms the gas pricing: `Space heating - secondary 2025.93 3.4800 70.5022` Cert 001479 chain pin delta narrows: SAP_continuous 61.39 → 70.64 (was −7.62 vs 69.0094, now +1.63 — overshooting target by 1.63 SAP). The remaining overshoot maps to the cascade's ~16 W/K HLC undercount (cascade HLP 2.89 vs worksheet 3.13 × TFA) — work for follow-up slices. Cohort 6 chain certs still green at 1e-4 (all-electric or no- secondary). Golden cohort: cert 0300-2747 (mains-gas secondary) SAP residual tightens −7 → +2 — biggest single SAP improvement on the golden cohort to date; pin updated and notes annotated. Other 7 golden certs unchanged (None or electric secondary fuel). Pyright net-zero (35 baseline each on mapper.py + cert_to_inputs.py). Chain pin `test_summary_001479_full_chain_sap_matches_worksheet_pdf_ exactly` is the load-bearing RED — committed failing per TDD; closes to GREEN once the HLC undercount lands. 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