SAP 10.2 Appendix L §L2a (PDF p.88) verbatim:
GL = 0.9 × Σ (Aw × gL × FF × ZL) / TFA (L2a)
where
FF is the frame factor (fraction of window that is glazed) for
the actual window or from Table 6c
Aw is the area of a window, m²
gL is the light transmittance factor from Table 6b
ZL is the light access factor from Table 6d
Table 6b gL (PDF p.178) — light transmittance column:
Single glazed 0.90
Double glazed (any variant) 0.80
Triple glazed (any variant) 0.70
Table 6d note 2 (PDF p.178): "A solar access factor of 1.0 and a light
access factor of 1.0 should be used for roof windows/rooflights."
Pre-slice `_daylight_factor_from_cert` collapsed every rooflight into
a single `rooflight_total_area_m2 × _G_LIGHT_DEFAULT (0.80) ×
_FRAME_FACTOR_DEFAULT (0.70)` product, overcounting any Triple-glazed
rooflight (gL=0.70) or any non-default frame factor.
Cert 000565 §11 lodges 2 rooflights (per S0380.107 routing):
Item 2 (Ext2 NR rooflight): 1.2 m², "Triple between 2002 and 2021",
PVC FF=0.70 → gL=0.70 (Table 6b Triple). Correct numerator
contribution 1.2 × 0.70 × 0.70 = 0.588; pre-slice cascade used
1.2 × 0.80 × 0.70 = 0.672 (+0.084 over).
Item 5 (Ext4 A rooflight): 0.5 m², "Double between 2002 and 2021",
Wood FF=0.70 → gL=0.80 (Table 6b Double). Already matched.
The +0.084 numerator delta lowered GL → lowered C_daylight → lowered
worksheet (232) by 2.17 kWh/yr.
3-layer fix:
1. `datatypes/epc/domain/epc_property_data.py`: add `glazing_type:
int = 3` to SapRoofWindow (default = Double 2002-2021, the cohort
modal).
2. `datatypes/epc/domain/mapper.py` `_map_elmhurst_roof_window`:
populate `glazing_type` via `_elmhurst_glazing_type_code(w.
glazing_type)` — mirror of `_map_elmhurst_window`.
3. `domain/sap10_calculator/worksheet/internal_gains.py`
`_daylight_factor_from_cert`: iterate `epc.sap_roof_windows` for
the rooflight g_L numerator, dispatching via existing
`_G_LIGHT_BY_GLAZING_CODE` + `rw.frame_factor`. Z_L = 1.0 per
Table 6d note 2.
Test coverage:
- AAA test `test_summary_000565_rooflight_per_window_g_l_routes_via_
glazing_type_per_sap_10_2_appendix_l_l2a` pins both per-rooflight
glazing codes (9 Triple / 3 Double) AND `inputs.lighting_kwh_per_
yr` at 1384.8353 ±1e-4.
- 000516 hand-built fixture updated to explicitly set glazing_type=2
("Double pre 2002") matching the lodged label.
Cert 000565 cascade snapshot (HEAD
|
||
|---|---|---|
| .devcontainer | ||
| .github/workflows | ||
| .idea | ||
| .vscode | ||
| applications | ||
| asset_list | ||
| backend | ||
| backlog | ||
| datatypes | ||
| deployment/terraform | ||
| docs/adr | ||
| domain | ||
| epr_data_exports | ||
| etl | ||
| infrastructure | ||
| model_data/requirements | ||
| orchestration | ||
| recommendations | ||
| repositories | ||
| 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