Model/backend/app
Khalim Conn-Kowlessar 72f3e3a72d Add default-plan export selection + plan_name column (ADR-0065)
A second export selection alongside the per-Scenario one, chosen by
`plan_selection` on the export request:

- "scenario" (default, unchanged): one sheet per Scenario, freshest Plan per
  (property, scenario); scenario_ids required.
- "default" (new): a single "Default Plans" sheet of each home's is_default
  Plan (one-per-property across all Scenarios, ADR-0012/0017) — the portfolio's
  current state, one row per home; scenario_ids ignored.

Repository gains `default_rows_for(portfolio_id, property_ids)`: same read-model
and Effective-EPC join as `rows_for`, with the plan-selection WHERE swapped from
`scenario_id = :scenario_id` to `is_default = TRUE`. Orchestrator branches on
plan_selection; the router validates it and only requires scenario_ids for the
scenario selection. A recipe without plan_selection defaults to "scenario", so
the change is backward-compatible.

Both selections now surface the chosen Plan's `name` as a `plan_name` column.

Tests: repository default_rows_for (scenario-independent selection, plan_name,
non-default excluded); orchestrator default path (one "Default Plans" sheet;
empty selection is a recorded failure). 62 passed, pyright --strict clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 09:21:38 +00:00
..
bulk_uploads property override 2026-06-05 12:18:13 +00:00
db Add remaining planning/address-profiling fields to HubSpot ETL sync 2026-07-08 15:12:24 +00:00
documents Hand-pick selection by landlord_property_id, not property.id 2026-07-08 12:04:35 +00:00
domain define new domain object 2026-04-13 16:18:17 +00:00
energy_assessments Working upload of documents to backend 2024-09-04 19:39:31 +01:00
exports Add default-plan export selection + plan_name column (ADR-0065) 2026-07-22 09:21:38 +00:00
local save 2026-05-07 15:55:44 +00:00
modelling Both postcode batchers share one group-preserving packing core 🟪 2026-07-07 13:24:02 +00:00
plan fix dependency issue 2026-05-12 17:03:16 +00:00
portfolio Trying to get /backend and /model_data working together 2023-07-18 16:45:11 +01:00
requirements Move zip-size checker next to the fastapi requirements it checks 2026-07-06 13:00:59 +00:00
tasks implement trigger_categorisation API 2026-02-24 14:33:29 +00:00
whlg temp clearing endpoint 2025-11-16 16:26:23 +08:00
__init__.py Major project restructure and setup 2023-07-06 11:33:13 +01:00
assumptions.py fixed typing bug 2026-01-10 22:56:30 +00:00
BatterySapScorer.py commiting missing stuff 2025-12-10 17:56:53 +00:00
config.py Add the scenario export route, worker handler and SQS trigger 🟩 2026-07-14 09:36:14 +00:00
dependencies.py basic end up check 2026-05-10 21:07:16 +00:00
exceptions.py Adding database connection to fastapi 2023-07-31 11:02:22 +01:00
main.py Add the scenario export route, worker handler and SQS trigger 🟩 2026-07-14 09:36:14 +00:00
utils.py cleaning up data dictionary references 2026-03-19 18:47:39 +00:00