FULL CLOSURE. Cascade 768/768 + e2e 72/72 across all 6 Elmhurst fixtures. Adds Table 12d (p.194) monthly CO2 emission factors for electricity to `tables/table_12.py` + `co2_monthly_factors_kg_per_kwh(fuel_code)` helper. Per the spec text: "Where electricity is the fuel used, the relevant set of factors in the table below should be used to calculate the monthly CO2 emissions INSTEAD the annual average factor given in Table 12." Calculator now consumes per-end-use CO2 factors on `CalculatorInputs` (`main_heating_co2_factor_kg_per_kwh`, `secondary_heating_co2_factor_ kg_per_kwh`, `hot_water_co2_factor_kg_per_kwh`, `pumps_fans_co2_factor_ kg_per_kwh`, `lighting_co2_factor_kg_per_kwh`, `electric_shower_kwh_ per_yr`, `electric_shower_co2_factor_kg_per_kwh`). Defaults to None → falls back to the global `co2_factor_kg_per_kwh` (legacy synthetic path); cert_to_inputs supplies real values. `_effective_monthly_co2_factor(monthly_kwh, fuel_code)` translates the Table 12d monthly cascade into the calculator's annual×factor shape: effective = Σ(kWh_m × CO2_m) / Σ(kWh_m). Used for the 4 electricity end-uses (secondary, pumps/fans, lighting, electric shower). Gas end- uses keep the annual Table 12 factor. Adds `environmental_section_from_cert(epc) -> EnvironmentalSection` exposing (261)..(274) line refs. Worksheet display conventions: - (265) excludes (264a) — electric shower CO2 contributes to (272) total but not the "space + water heating" subtotal. - (273) is rounded to 2 d.p. half-up — the PDF displays with trailing zeros to 4 d.p. but precision is 2 d.p. throughout. §12 LINE_ constants added to all 6 fixtures: (261), (262), (263), (264), (264a), (265), (266), (267), (268), (269), (272), (273), EI continuous, (274). 000487 (electric shower) has non-zero (264a). FINAL SCOREBOARD: - Cascade pins: 684/684 → 768/768 (§7..§12 all closed, 100%) - e2e SapResult: 66/66 → 72/72 (all CO2 + sap + ecf + fuel cost) - Wider regression: 1490/1490 PASS — zero failures anywhere 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