Contains projects associated to the development of modeling products
Find a file
Khalim Conn-Kowlessar e509ffdef4 Slice S0380.87: SAP 10.2 Table 4e GROUP 2 HP control codes close SH +7924→+1460
SAP 10.2 Table 4e (PDF p.172-173) "Heating system controls", GROUP 2:
HEAT PUMPS WITH RADIATORS OR UNDERFLOOR HEATING:

  Code  Description                                        Type
  ----  -------------------------------------------------  ----
  2201  No time or thermostatic control                    1
  2202  Programmer, no room thermostat                     1
  2203  Room thermostat only                               1
  2204  Programmer and room thermostat                     1
  2205  Programmer and at least two room thermostats       2
  2206  Programmer, TRVs and bypass                        2
  2207  Time + temp zone control by plumbing/electrical    3   ← cert 000565
  2208  Time + temp zone control by PCDB device            3
  2209  Room thermostat and TRVs                           2
  2210  Programmer, room thermostat and TRVs               2

Pre-S0380.87 `_CONTROL_TYPE_BY_CODE` contained only Group 1 BOILER
codes (21XX); every Group 2 HP code (22XX) fell through to the
default `return 2`. Cert 000565 lodges `main_heating_control=2207`
on its HP main 1 → silently routed to type 2 → MIT_elsewhere
over-counted by ~+0.5 °C in winter.

The bug: SAP 10.2 Table 9 (PDF p.182) elsewhere off-hours differ
between type 2 and type 3:
  Type 1, 2: off-hours (7, 8) — elsewhere heated longer
  Type 3:    off-hours (9, 8) — elsewhere has separate, shorter
                                heating schedule per §9.4.14

Wrong control type → wrong off-hours → wrong off-period temperature
reduction (Table 9b) → wrong MIT_elsewhere (line (90)m) → wrong
blended MIT (line (92)/(93)m) → wrong space heating demand
(line (98c)).

Diagnosis chain: post-S0380.86 cert 000565 had structural SH
over-count of +7924 kWh independent of fabric. Diff vs worksheet
intermediates traced it to MIT cascade higher by avg +0.45 °C
(+5.42 °C-months). Per-zone breakdown showed MIT_elsewhere over by
+6.25 °C-months while Th2 setpoint matched. Reverse-engineered the
off-period reduction (cascade u≈4.12 vs worksheet u≈5.14, Jan)
matched off-hours (9, 8) — control type 3 — vs cascade (7, 8) —
control type 2. Verified against Table 4e GROUP 2 spec text:
2207 → type 3 spec-correct.

Cohort + golden + cert 9501 unaffected:
  - Elmhurst U985 cohort (000474..000516): all lodge code 2106
    (Group 1, type 2) — unchanged
  - 20 golden API certs lodge code 2206 (Group 2 HP, type 2 per
    spec, type 2 via cascade default) — adding 2206:2 to the
    dispatch dict makes the type explicit, behaviour unchanged
  - Cert 9501: not lodging 22XX codes
  - Only cert 000565 lodges 2207 (and exercises the 22XX→3 fix)

Test (1 new, AAA-structure parametrised across all 10 Group 2 codes
in `test_cert_to_inputs.py`).

**Cert 000565 closure (post-S0380.87 vs post-S0380.86):**

  Pin                    Pre      Post     Δ      worksheet
  ---                    ----     ----     ---    ---------
  sap_score              23       27       +4     29
  sap_score_continuous   22.64    27.35    +4.71  28.51
  ecf                    6.02     5.51     -0.51  5.39
  total_fuel_cost_gbp    5233     4784     -449   4680
  co2_kg_per_yr          7165     6581     -584   6448
  space_heating_kwh      66932    60468    -6464  59008
  main_heating_fuel      39372    35570    -3802  34711

Space heating residual closed +7924 → **+1460 (82% closed)**.
Integer SAP closed Δ-6 → Δ-2 (was the 9th-largest residual; now
gates only on continuous SAP rounding boundary at 28.5).

Test baseline: 561 pass (was 560 + 1 new) + 9 expected
`test_sap_result_pin[000565-*]` fails unchanged. Pyright net-zero
per touched file. SAP 10.2 spec citation included in dispatch dict
comment per [[feedback-spec-citation-in-commits]].

Per [[feedback-spec-floor-skepticism]] + [[feedback-verify-handover-claims]]:
the handover post-S0380.86 listed several candidate SH-channel
root causes (solar gains, internal gains, η, T_int, ventilation).
The single-line spec-dispatch gap was the dominant driver. The
remaining +1460 kWh residual splits roughly: ~+750 kWh from HLC
over-count (+42 W/K, mostly ventilation +27 W/K), ~+700 kWh from
remaining MIT residual.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 16:28:47 +00:00
.devcontainer pr review, move domain and orhcestration 2026-06-01 14:00:31 +00:00
.github/workflows added landlord description overrides 2026-05-29 12:12:54 +00:00
.idea scaffolding for ml pipeline 2026-05-16 14:15:56 +00:00
.vscode added utils to allow easier subtask management 2026-03-02 15:15:39 +00:00
applications move landlord overrides 2026-06-01 15:46:46 +00:00
asset_list redeploy old postcode splitter 2026-05-21 09:46:47 +00:00
backend Slice S0380.86: §5.6 thin-wall stone + §5.8 dry-line closes BP[0] alt1 cascade gap 2026-06-01 16:28:47 +00:00
backlog implemented onboarding 2026-04-21 20:23:33 +00:00
datatypes Slice S0380.86: §5.6 thin-wall stone + §5.8 dry-line closes BP[0] alt1 cascade gap 2026-06-01 16:28:47 +00:00
deployment/terraform added landlord description overrides 2026-05-29 12:12:54 +00:00
docs/adr move landlord overrides 2026-06-01 15:46:46 +00:00
domain Slice S0380.87: SAP 10.2 Table 4e GROUP 2 HP control codes close SH +7924→+1460 2026-06-01 16:28:47 +00:00
epr_data_exports allowing carbon and energy otimisation by removing slack 2025-07-31 19:13:16 +01:00
etl added batch description and nonfunded measures 2026-05-27 10:30:19 +00:00
infrastructure move landlord overrides 2026-06-01 15:46:46 +00:00
model_data/requirements its working the way khalim wanted wiht postcode and then search that 2026-01-22 15:17:13 +00:00
orchestration moved classifier data transformation to an easy one 2026-06-01 14:53:34 +00:00
recommendations save 2026-05-07 15:55:44 +00:00
repositories move landlord overrides 2026-06-01 15:46:46 +00:00
scripts Slice S0380.39: bulk-fetch 38 cohort-2 EPC API JSONs for cross-mapper parity 2026-06-01 16:28:47 +00:00
sfr/principal_pitch added added historic epc data class with shape 2026-05-08 12:03:35 +00:00
survey_report quidos site notes extraction 2025-02-18 19:49:29 +00:00
tests move landlord overrides 2026-06-01 15:46:46 +00:00
utilities get rid of comments 2026-05-20 13:21:11 +00:00
utils rename files in sharepoint to desired structure 2026-05-20 16:26:07 +00:00
.coveragerc fixed unit tests 2023-10-05 16:04:12 +01:00
.dockerignore deployment from infrastructure 2026-05-19 12:55:30 +00:00
.gitignore fixed merge conflicts from main 2026-05-26 11:21:09 +00:00
__init__.py added checking for directory before creation and made some minor style changes 2023-08-25 15:21:17 +01:00
ara_backend_design.md refactor: lift-and-shift packages/domain/src/domain/ml → domain/sap10_ml 2026-05-26 13:01:35 +00:00
BaseUtility.py fixed missing task and subtask for single remote assessments 2025-11-27 17:50:26 +00:00
CLAUDE.md fixed merge conflicts from main 2026-05-26 11:21:09 +00:00
conftest.py working on integrating new EPC api into address2UPRN 2026-04-27 11:32:44 +00:00
CONTEXT.md refactor: lift-and-shift packages/domain/src/domain/ml → domain/sap10_ml 2026-05-26 13:01:35 +00:00
devcontainer.sh add dev container 2026-04-17 14:50:57 +00:00
Dockerfile.test fix: address 22 project-wide test failures from previous sweep 2026-05-26 13:34:51 +00:00
Dockerfile.test.dockerignore deployment from infrastructure 2026-05-19 12:55:30 +00:00
Makefile adding to dev container to create shared network on start up 2026-04-25 15:03:07 +00:00
MEMORY.md memory 2026-04-02 10:24:31 +00:00
package-lock.json restructuring openUrpn code 2023-07-20 11:41:43 +01:00
package.json restructuring openUrpn code 2023-07-20 11:41:43 +01:00
pyproject.toml slice 14a: ml_training_data pkg + sample.py (CSV filter + random sample) 2026-05-16 17:39:43 +00:00
pyrightconfig.json slice 14d: build_features wires bulk reader -> mapper -> EpcMlTransform 2026-05-16 18:38:41 +00:00
pytest.ini refactor: lift-and-shift packages/domain/src/domain/ml → domain/sap10_ml 2026-05-26 13:01:35 +00:00
README.md adding to dev container to create shared network on start up 2026-04-25 15:03:07 +00:00
run_lambda_local.sh debugging local lambda run and updating the sap point checking condition 2023-09-13 18:47:12 +01:00
serverless.yml added logic to add to serverless 2026-04-22 12:39:44 +00:00
test.requirements.txt tests wrong environemnt 2026-05-29 16:17:06 +00:00
tox.ini removing playright install for integration test 2026-04-30 20:08:13 +00:00
UBIQUITOUS_LANGUAGE.md postcode_splitter: pure domain (UserAddress, sanitise_postcode, postcode_batching) 2026-05-19 16:45:47 +00:00

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