Model/scripts
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
..
analyse_api_sap_clusters.py scripts: promote the API SAP-accuracy toolkit from /tmp 2026-06-04 16:52:09 +00:00
decompose_api_cost_error.py feat(diag): per-component cost decomposition for API SAP errors 2026-06-06 17:37:05 +00:00
download_cotality_evidence.py new methods for downloading all core files for pashub URL. Download currently not being authorised 2026-03-24 08:47:59 +00:00
elmhurst_input_sheet.py fix(debug-tool): read the domain field names, not the schema ones 2026-06-05 19:48:02 +00:00
eval_api_sap_accuracy.py scripts: promote the API SAP-accuracy toolkit from /tmp 2026-06-04 16:52:09 +00:00
fetch_2026_epc_sample.py scripts: promote the API SAP-accuracy toolkit from /tmp 2026-06-04 16:52:09 +00:00
fetch_cohort2_api_jsons.py Move sap10_calculator tests to tests/domain/sap10_calculator/ for CI 2026-06-02 16:58:00 +00:00
fetch_epc_bulk_sample.py feat(modelling): sample a year from the EPC bulk export, offline-ready 2026-06-04 12:20:57 +00:00
fetch_epc_dump.py feat(modelling): CLI to fetch an EPC dump + build the inspection report 2026-06-04 11:26:17 +00:00
historic_epc_demo.py added type hinting to uprn 2026-05-12 09:40:12 +00:00
init_db.py init db 2026-03-31 11:45:59 +00:00
profile_api_error.py feat(diag): profile API SAP error against raw-API characteristics 2026-06-07 20:38:19 +00:00
rename_sharepoint_files.py rename files in sharepoint to desired structure 2026-05-20 16:26:07 +00:00
run_modelling_cohort.py feat(modelling): turnkey offline cohort script (tables + CSV) 2026-06-04 09:30:53 +00:00
run_modelling_e2e.py feat(scripts): DB-catalogue local run + optional --persist for run_modelling_e2e 2026-06-08 20:45:50 +00:00
run_property_report.py feat(modelling): CLI to fetch an EPC dump + build the inspection report 2026-06-04 11:26:17 +00:00
sero_address_list.csv add address list 2026-05-21 15:30:03 +00:00