Model/tests
Jun-te Kim efdb8e816c feat(modelling_e2e): condition prediction on the expired Historic EPC (ADR-0054)
ADR-0054 gives a prediction conditioned by an expired Historic EPC the source
"expired", so reporting can tell "no EPC at all" apart from "only an expired
one". It was implemented in IngestionOrchestrator — but the pipeline that
actually runs is modelling_e2e, which predicts through its own _predict_epc and
never adopted it. Result: zero `expired` rows have ever been written, and
`epc_property.source` holds only 'lodged' and 'predicted'.

Two things kept the flavour unreachable here, and both had to go:

  - _predict_epc never looked at the historic backup at all, so no prediction
    was ever conditioned.
  - _flush_writes passed the literal source="predicted", and _PropertyWrite had
    no field to carry a flavour, so one would have been dropped before the write
    even if computed.

_predict_epc now mirrors IngestionOrchestrator._predict: the expired cert's
stable attributes fill the gaps Landlord Overrides left (overrides still win
where both speak) and condition the cohort, and it returns the source alongside
the EPC. _PropertyWrite carries it; _flush_writes persists it. save_batch
already groups deletes by source family, so a mixed predicted/expired batch
clears the shared slot correctly.

Ships dark: the reader is built only when HISTORIC_EPC_S3_ROOT is set, so
without it every prediction stays plain "predicted", exactly as today.
DEFAULT_S3_ROOT names the dev bucket, so defaulting to it would have a prod
lambda silently reading dev data — Terraform sets the var per environment.

Note this also rescues properties that currently fail to model outright: an
expired cert can supply the property_type no override resolved, where today
that raises UnresolvedPropertyTypeError.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 11:15:39 +00:00
..
abri Surface both canceljob failure shapes as verbatim rejections 🟥 2026-07-07 15:33:16 +00:00
applications feat(modelling_e2e): condition prediction on the expired Historic EPC (ADR-0054) 2026-07-14 11:15:39 +00:00
backend Hand-pick selection by landlord_property_id, not property.id 2026-07-08 12:04:35 +00:00
datatypes Map SAP-Schema-15.0's "Main building" identifier to MAIN 2026-07-10 15:03:28 +00:00
domain Gate the loft top-up strictly below the 270mm building-regs depth 🟩 2026-07-10 16:07:48 +00:00
e2e Prove prediction resolves landlord overrides to a real cohort match end-to-end 🟩 2026-06-16 15:20:49 +00:00
fixtures Expired-pairs integration gate: frozen single-file corpus + ratcheting floors 🟩 2026-07-06 13:05:18 +00:00
harness The multi-measure trigger fixture is a cert the sized ASHP alone cannot clear 🟩 2026-07-03 12:25:03 +00:00
infrastructure Merge pull request #1533 from Hestia-Homes/fix/epc-schema-allowlist 2026-07-10 12:43:40 +01:00
lambdas new application to trigger e2e for a single property and scenario 2026-06-22 12:54:53 +00:00
magic_plan Mapper reads new 'Total Trickle Vent Effective Area' label 🟥 2026-06-30 12:56:54 +00:00
orchestration Merge pull request #1526 from Hestia-Homes/feature/fabric-first-scenario 2026-07-10 12:48:06 +01:00
repositories Scenario carries its Fabric First flag from the scenario table 🟥 2026-07-09 11:44:31 +00:00
scripts The historic roof description conditions the cohort by form family 🟩 2026-07-06 12:05:56 +00:00
utilities abri_api not abri 2026-07-07 14:40:33 +00:00
utils SharePoint 404s raise ResourceNotFoundError without error-level logging 🟩 2026-07-03 12:26:33 +00:00
__init__.py added postcode splitter rewrite to ddd 2026-05-19 16:35:09 +00:00
conftest.py Audit generator populates XLSX, uploads to S3, and records UploadedFile row 🟪 2026-06-09 12:05:55 +00:00
test_lambda_packaging.py better smoke tests to check what is failign 2026-06-17 11:53:33 +00:00