diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 27151437..db15b09a 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -174,6 +174,8 @@ async def trigger_plan_entrypoint(body: PlanTriggerRequest): service="plan_engine", inputs=data, task_only=True, + source=SourceEnum.PORTFOLIO, + source_id=str(body.portfolio_id), ) subtask_interface = SubTaskInterface() @@ -222,6 +224,8 @@ async def trigger_plan_entrypoint(body: PlanTriggerRequest): service="plan_engine", inputs=data, task_only=False, + source=SourceEnum.PORTFOLIO, + source_id=str(body.portfolio_id), ) data["task_id"] = str(task_id) data["subtask_id"] = str(subtask_id) diff --git a/backend/export/property_scenarios/main.py b/backend/export/property_scenarios/main.py index d38db4c9..f3ea0100 100644 --- a/backend/export/property_scenarios/main.py +++ b/backend/export/property_scenarios/main.py @@ -134,10 +134,18 @@ def handler(event: Mapping[str, Any], context: Optional[Any]) -> Mapping[str, Un body_dict = { "task_id": "test", "subtask_id": "test", - "portfolio_id": 569, + "portfolio_id": 655, "scenario_ids": [], "default_plans_only": True, } + + body_dict = { + "task_id": "test", + "subtask_id": "test", + "portfolio_id": 655, + "scenario_ids": [1174], + "default_plans_only": False, + } :param event: Lambda event containing export request details :param context: Lambda context (not used in this handler but included for completeness) :return: HTTP response indicating success or failure of the export operation diff --git a/backend/tests/test_rebaselining_pipeline.py b/backend/tests/test_rebaselining_pipeline.py index 9fbe1f35..a0c62f34 100644 --- a/backend/tests/test_rebaselining_pipeline.py +++ b/backend/tests/test_rebaselining_pipeline.py @@ -2,6 +2,10 @@ import os import pickle import pandas as pd import pytest +from datetime import datetime +from backend.ml_models.api import ModelApi +from backend.app.utils import sap_to_epc +from backend.app.config import get_prediction_buckets def load_sample_certificates(): @@ -60,12 +64,6 @@ def load_cleaning_data(): @pytest.mark.integration def test_rebaselining_pipeline_with_real_data(): - import pandas as pd - from datetime import datetime - from backend.ml_models.api import ModelApi - from backend.app.utils import sap_to_epc - from backend.app.config import get_prediction_buckets - df = load_sample_certificates() cleaning_data = load_cleaning_data() input_properties = [make_property_from_row(row, cleaning_data=cleaning_data) for _, row in df.iterrows()] diff --git a/recommendations/Costs.py b/recommendations/Costs.py index f2d43339..cb67a90f 100644 --- a/recommendations/Costs.py +++ b/recommendations/Costs.py @@ -209,7 +209,7 @@ class Costs: # Try and get the region after converting the keys to lower self.region = { k.lower(): v for k, v in county_to_region_map.items() - }.get(self.property.property.epc_record.local_authority_label.lower(), None) + }.get(self.property.epc_record.local_authority_label.lower(), None) if self.region is None: logger.warning("No region found for county %s, defaulting to South East England",