Commit graph

152 commits

Author SHA1 Message Date
Khalim Conn-Kowlessar
6f0dcc0455 test(modelling): characterise the portfolio aggregation over plan_id
Pin the FE-facing aggregate_portfolio_recommendations (previously untested): it
sums a Scenario's default Recommendations onto the Scenario row, joining
Recommendation → Plan on recommendation.plan_id. Locks the m2m→plan_id read cut
for the FE-critical path, now testable thanks to the full-parity ScenarioModel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 22:54:15 +00:00
Khalim Conn-Kowlessar
b97d06882f feat(modelling): drop the plan_recommendations m2m
Stop writing the m2m (remove create_plan_recommendations + its call, the bulk
link insert and the now-dead plan_ids_by_index, and the plan_recommendations
delete in delete_property_batch) and remove the PlanRecommendationRow model +
its shim alias and the test_export fixture inserts. Measures now link to their
Plan solely via recommendation.plan_id (writers set it, readers join on it).

The live drop of the plan_recommendations table is the FE-owned Drizzle
migration documented in docs/migrations/recommendation-plan-id.md, sequenced
after the read-cut + backfill.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:13:00 +00:00
Khalim Conn-Kowlessar
af5dbe325d feat(modelling): cut plan→recommendation readers onto plan_id
Rewrite the three structurally-identical m2m-join readers
(portfolio_functions.aggregate_portfolio_recommendations,
Outputs.get_recommendations_from_db, export get_recommendations) to join
PlanModel directly via recommendation.plan_id, dropping the plan_recommendations
join and its now-unused import. The writers set plan_id (prior slice), so the
rows resolve. test_export pins the export reader through the cut (its fixtures
now set recommendation.plan_id). A portfolio_functions DB characterization test
lands with the scenario consolidation (which provides the full-parity scenario
table the aggregation writes to).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:09:43 +00:00
Khalim Conn-Kowlessar
27fcc5b184 feat(modelling): legacy writers set recommendation.plan_id (dual-write)
upload_recommendations and bulk_upload_recommendations_and_materials now set
plan_id on each recommendation row (the plan id is already in scope), while
still writing the plan_recommendations m2m — the dual-write that lets readers
move onto plan_id with no breakage during the transition (ADR-0017 amendment /
docs/migrations/recommendation-plan-id.md). The m2m write is removed in a later
slice once no reader depends on it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:01:56 +00:00
Daniel Roth
265be9849b Store uploaded_file_id on magic_plan_plan row 🟥 2026-05-13 10:50:28 +00:00
Daniel Roth
f56dba4ad1 use pytest-postgresql in db tests instead of mocking and checking sql strings 2026-05-08 10:13:44 +00:00
Daniel Roth
6b29086a1e typing and renaming 🟪 2026-05-07 13:26:49 +00:00
Daniel Roth
2f8e08a676 save_plan persisting domain Plan to magic_plan_* tables 🟩 2026-05-07 13:09:09 +00:00
Daniel Roth
5ec0fa5d04 save_plan persisting domain Plan to magic_plan_* tables 🟥 2026-05-07 13:01:04 +00:00
Jun-te Kim
a6849b28b3 added backend funciton to functions 2026-04-22 14:21:39 +00:00
Jun-te Kim
d7b8ca34bf made everything complete not compelted 2026-04-21 20:37:34 +00:00
Jun-te Kim
c4f6d77845 implemented onboarding 2026-04-21 20:23:33 +00:00
Daniel Roth
38305e558b
Merge pull request #962 from Hestia-Homes/feature/ecmk-to-ara
ECMK to Sharepoint, S3 and database
2026-04-10 11:02:31 +01:00
Khalim Conn-Kowlessar
2fb14858eb reduced freshness down to 14 days 2026-04-09 17:17:41 +01:00
Khalim Conn-Kowlessar
3380b6cbc8 hacky fix to pick up lmk key or epc cert # 2026-04-09 16:01:33 +01:00
Daniel Roth
15f1fde16a skip file if already processed according to db 2026-04-07 14:34:33 +00:00
Khalim Conn-Kowlessar
e946b7254a updating database pushes for rebaselined properties 2026-03-25 22:16:30 +00:00
Khalim Conn-Kowlessar
7e253d500c tidying up engine pipeline with rebaselining 2026-03-20 09:53:48 +00:00
Khalim Conn-Kowlessar
84d4263d9a removing data 2026-03-18 19:17:22 +00:00
Khalim Conn-Kowlessar
f45260706e fixed bug in epc record cleaning" 2026-03-18 18:16:57 +00:00
Khalim Conn-Kowlessar
6d3b6beadc Merge branch 'main' of https://github.com/Hestia-Homes/Model into feature/ara-rebaselining
# Conflicts:
#	asset_list/app.py
2026-03-06 09:55:24 +00:00
Daniel Roth
c0b2bf669c add source and source_id to Task object 2026-03-05 11:27:43 +00:00
Daniel Roth
add53a1949 Correct maths and prepare to trigger sqs from api 2026-02-26 12:58:33 +00:00
Daniel Roth
76b648c861 implement trigger_categorisation API 2026-02-24 14:33:29 +00:00
Daniel Roth
5646376d1e pass min and max IDs to consider to processor and db functions 2026-02-24 09:59:42 +00:00
Daniel Roth
31cfa47d8f dont worry about default scenarios 2026-02-20 17:10:53 +00:00
Daniel Roth
96fbd7f24c ensure all defaults are unset before setting new ones, refactor of processor 2026-02-20 15:26:40 +00:00
Daniel Roth
ec01e1d190 only get most recently added plans for scenario 2026-02-20 13:39:07 +00:00
Daniel Roth
9d12eef0e5 Remove unused db functions 2026-02-19 12:22:19 +00:00
Daniel Roth
dae74d2f8b Fix bug where default plans were not being unset if they weren't included in scenarios to be considered 2026-02-19 12:18:22 +00:00
Daniel Roth
475b3d0e13 input is list of scenarios to consider not list of plans 2026-02-18 17:19:38 +00:00
Daniel Roth
490c8946d7 Unset existing default before setting new one 2026-02-18 17:11:00 +00:00
Daniel Roth
cc901d999b option to only consider a specific list of plans 2026-02-18 11:54:55 +00:00
Daniel Roth
fac418adbe Don't re-get scenarios for every plan 2026-02-17 15:25:51 +00:00
c2640a91fc Merge github.com:Hestia-Homes/Model into feautre/postcode_splitter_address_uprn_automator_2000 2026-02-16 12:44:25 +00:00
Daniel Roth
bd9e553e35 bulk update of plans 2026-02-13 14:50:48 +00:00
Daniel Roth
16386173af get update_plan working 2026-02-13 13:39:38 +00:00
Daniel Roth
e0e50d696a fixes so it runs (as far as the database update), plus some temp prints 2026-02-13 12:26:31 +00:00
Daniel Roth
61d9e64e1b also update scenario when updating plan 2026-02-13 09:44:35 +00:00
Daniel Roth
f34a6269f7 Move updating of is_default to domain rather than database layer 2026-02-13 09:39:25 +00:00
Khalim Conn-Kowlessar
043f57e04a testing out rebaselining 2026-02-12 22:25:03 +00:00
Daniel Roth
4b07310d6b define database methods 2026-02-12 17:36:47 +00:00
Daniel Roth
f955184260 refactor processor 2026-02-12 14:25:35 +00:00
Daniel Roth
b3fa7c3051 rename Plan and Scenario to PlanModel and ScenarioModel 2026-02-12 12:01:39 +00:00
Daniel Roth
e7f941d5e4 use sqlalchemy 2.0 typing in recommendations , and write processing logic 2026-02-12 10:00:47 +00:00
Daniel Roth
598a612b40 define db methods 2026-02-12 09:23:47 +00:00
1a0d463e2e missing init.py 2026-02-09 23:07:51 +00:00
Daniel Roth
4ad200ea76 define models and bulk insert function 2026-01-28 15:01:10 +00:00
Khalim Conn-Kowlessar
3fe102c385 added rebaselining for installed measures 2026-01-10 18:52:26 +00:00
Khalim Conn-Kowlessar
808a5122ee added re-baselining to the property model 2026-01-10 14:59:46 +00:00