Commit graph

32 commits

Author SHA1 Message Date
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
c1c7b06f09 refactor(modelling): consolidate plan/recommendation models into infrastructure
Move the live plan, recommendation, recommendation_materials and (retiring)
plan_recommendations tables into a new infrastructure/postgres/modelling/
subpackage as single SQLModel definitions (the epc_property pattern), absorbing
the rebuild's partial PlanRow/RecommendationRow mirrors and carrying full
legacy column parity plus recommendation.plan_id. Out-of-cluster references are
plain indexed ints (mirror convention); the live FKs are owned by the Drizzle
schema. backend/app/db/models/recommendations.py becomes a re-export shim
(ScenarioModel/InstalledMeasure stay for a later slice).

Fix the export conftest to create SQLModel-first (so Base funding_package's FK
to the now-SQLModel plan resolves) and skip the redundant drop_all on its
function-scoped throwaway DB (the epc enum type is now shared across both
metadatas). Resolves the pre-existing dual-definition collision: the rebuild
and legacy export suites are now co-runnable. No behaviour change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:00:14 +00:00
Jun-te Kim
6504785e7c merged from main 2026-05-11 12:30:29 +00:00
Khalim Conn-Kowlessar
c8dcf29845 minor commit to test git message 2026-05-01 08:54:54 +00:00
Khalim Conn-Kowlessar
aca503e877 fixing broken unit tests 2026-05-01 08:46:17 +00:00
Khalim Conn-Kowlessar
02cc1b9978 fixing failing tests 2026-04-30 20:18:39 +00:00
Khalim Conn-Kowlessar
87afac8631 minor exporting data 2026-04-30 09:58:24 +01:00
Khalim Conn-Kowlessar
077f14764b updated test for 101 columns with new fields on property_details_epc 2026-04-25 23:03:11 +00:00
Jun-te Kim
02432f8d72 Merge github.com:Hestia-Homes/Model into feature/address_trigger_from_frontend 2026-04-17 14:51:20 +00:00
Jun-te Kim
4dbafe3992 added local devconaitner 2026-04-16 22:21:54 +00:00
Daniel Roth
fa3e276dc4 define new domain object 2026-04-13 16:18:17 +00:00
Jun-te Kim
9c1181475e be the same as main 2026-04-13 15:20:55 +00:00
Jun-te Kim
ef366f1cd5 be the same as main 2026-04-13 15:20:10 +00:00
Jun-te Kim
17b8f22840 fix BOM issue 2026-04-13 14:59:00 +00:00
Jun-te Kim
a946eb2959 added sql model to db 2026-03-31 11:27:23 +00:00
Khalim Conn-Kowlessar
1173066888 remove redundant code 2026-03-30 18:47:13 +01:00
Khalim Conn-Kowlessar
354c8fcb27 fixing property.property and passing task id 2026-03-30 17:51:13 +01:00
Khalim Conn-Kowlessar
0f99fbc739 fixed initial export test 2026-03-27 01:25:18 +00:00
Khalim Conn-Kowlessar
261e0769e3 created test to cover off the case of solar pv + battery 2026-03-02 17:49:58 +00:00
Khalim Conn-Kowlessar
facc81d741 expanded keys being checked in tests 2026-03-02 14:45:51 +00:00
Khalim Conn-Kowlessar
8db3d29850 added postgres to docker & added to readme 2026-02-27 18:58:59 +00:00
Khalim Conn-Kowlessar
63879b8fdd adding missing csvs 2026-02-26 18:28:46 +00:00
Khalim Conn-Kowlessar
e5d7a3ff14 Fixed outputs of export test 2026-02-26 18:16:50 +00:00
Khalim Conn-Kowlessar
1df4fb7815 working on export issues 2026-02-26 16:53:23 +00:00
Khalim Conn-Kowlessar
1717e7b4c2 fixing typing issues 2026-02-26 12:45:52 +00:00
Khalim Conn-Kowlessar
f13bffec7c implementing scenario_ids_ignored feedback 2026-02-26 12:45:52 +00:00
Khalim Conn-Kowlessar
e645f90b0e fixing stict typing issues 2026-02-26 12:45:52 +00:00
Khalim Conn-Kowlessar
bf865811c0 added handler typing 2026-02-26 12:45:52 +00:00
Khalim Conn-Kowlessar
3d18827961 added plan name to export 2026-02-25 13:36:02 +00:00
Khalim Conn-Kowlessar
bf3d6f4d51 working on integration test 2026-02-23 12:13:59 +00:00
Khalim Conn-Kowlessar
3e0444b3a7 working on export logic 2026-02-20 17:01:09 +00:00