`_pv_export_credit_gbp_per_kwh` previously read from `prices.unit_price` (SAP10.2 Table 12 code 60 = 5.59 p/kWh) while the actual rating cascade inside _fuel_cost reads from `table_32_unit_price_p_per_kwh` (RdSAP10 Table 32 code 60 = 13.19 p/kWh, same as standard electricity). The exposed CalculatorInputs.pv_export_credit_gbp_per_kwh therefore misled about what the cascade applied. The calculator's fallback path at calculator.py:442 fires for synthetic inputs without `fuel_cost` and would compute the wrong PV credit by reading the misleading input. Per ADR-0010 §10 the rating cascade uses Table 32 prices. Unified both code paths on Table 32 so the input boundary reports the same 13.19 p/kWh the cascade applies. Cert-path math unchanged (cert path always sets fuel_cost). Synthetic/fallback path now consistent with cert path. Also adds cert 2130-1033-4050-5007-8395 (DE22, end-terrace + 1 ext, gas combi PCDB 17505, 2× 2.04 kWp PV) as 9th golden fixture. First PV-bearing cert in the cohort. Pinned residual is SAP +8 / PE −61 / CO2 +0.19 — spec-version drift not a code bug (cert was scored by SAP10.2 software using Table 12 PV export 5.59 p/kWh = £194 credit → SAP 82; calc targets RdSAP10 Table 32 = 13.19 p/kWh = £457 credit → SAP 90). Both internally consistent against their own price table. The PE residual is amplified because PV gen also offsets PE via inputs.other_primary_factor, which scales with gen kWh independently of the export-credit price. 930/930 Elmhurst cascade green. 14/14 golden cohort + 1 new cert_to_inputs unit test green. Pyright net-zero (49 errors before and after). 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