Model/harness
Khalim Conn-Kowlessar 0f6077a830 feat(scripts): DB-catalogue local run + optional --persist for run_modelling_e2e
Slice 5 (local run sources the DB, read-only) + slice 6 (optional persist),
landing together as one script rewrite (the persist path is interleaved with
the compute path).

The same local computation now runs whether or not the result is stored:
- Both modes price against the live `material` catalogue (read-only
  ProductPostgresRepository over one shared Session) and model against a real
  Scenario read from the DB (--scenario-id; its goal_value drives the band,
  rejected if null) — so the inspected recommendations are exactly what gets
  stored. The JSON sample catalogue is no longer used by this script.
- --measures restricts the run to a comma-separated considered_measures
  allowlist (e.g. high_heat_retention_storage_heaters,solar_pv).
- --persist writes the inputs (EPC + spatial + solar) and the *same* computed
  Plan via the production repos in one PostgresUnitOfWork, then commits
  (idempotent: PlanPostgresRepository replaces by (property_id, scenario_id)).
  Gated: --persist requires --scenario-id and --portfolio-id. Default is
  inspect-only — no DB writes.

harness.console.run_modelling gains `products` and `scenario` overrides (the
seam the script drives); defaults unchanged, so existing callers are
unaffected. Suite 257 pass + 3 xfail; pyright clean; --help/guard/measure
parsing verified. Not yet executed against the DB (awaiting property_ids +
write-confirm).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 20:45:50 +00:00
..
__init__.py feat(modelling): sense-check table for a Plan in the DB-less harness 2026-06-04 08:06:53 +00:00
cohort.py feat(modelling): turnkey offline cohort script (tables + CSV) 2026-06-04 09:30:53 +00:00
console.py feat(scripts): DB-catalogue local run + optional --persist for run_modelling_e2e 2026-06-08 20:45:50 +00:00
epc_bulk.py feat(modelling): sample a year from the EPC bulk export, offline-ready 2026-06-04 12:20:57 +00:00
plan_table.py feat(modelling): wire Valuation Uplift onto the Plan 2026-06-04 08:59:04 +00:00
report.py feat(modelling): wire the ASHP bundle into the candidate pool 2026-06-06 17:12:07 +00:00
sample_catalogue.json feat(scripts): run_modelling_e2e — inspect recommendations per property_id 2026-06-08 14:25:33 +00:00