Merge pull request #930 from Hestia-Homes/feature/ara-rebaselining

fixing property.property and passing task id
This commit is contained in:
KhalimCK 2026-03-30 18:58:16 +01:00 committed by GitHub
commit d43f6dd50b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 8 deletions

View file

@ -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)

View file

@ -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

View file

@ -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()]

View file

@ -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",