Merge branch 'main' into feature/ecmk-to-ara

This commit is contained in:
Daniel Roth 2026-04-02 14:49:21 +00:00
commit eda990285b
3 changed files with 24 additions and 10 deletions

View file

@ -462,6 +462,15 @@ def handler(event, context, local=False):
# Validate postcode before processing # Validate postcode before processing
if not AddressMatch.is_valid_postcode(postcode): if not AddressMatch.is_valid_postcode(postcode):
logger.warning(f"Postcode {postcode} is invalid, skipping") logger.warning(f"Postcode {postcode} is invalid, skipping")
for row in postcode_rows:
results_data.append(
{
**row,
"address2uprn_uprn": "invalid postcode",
"address2uprn_address": "invalid postcode",
"address2uprn_lexiscore": "invalid postcode",
}
)
continue continue
# Fetch EPC data once per postcode # Fetch EPC data once per postcode

View file

@ -365,9 +365,11 @@ class HubspotDataToDb:
for attr, value in { for attr, value in {
"dealname": deal_data.get("dealname"), "dealname": deal_data.get("dealname"),
"dealstage": deal_data.get("dealstage"), "dealstage": deal_data.get("dealstage"),
"listing_id": listing.get("listing_id"), "listing_id": listing.get("listing_id", None) if listing else None,
"landlord_property_id": listing.get("owner_property_id"), "landlord_property_id": (
"uprn": listing.get("national_uprn"), listing.get("owner_property_id", None) if listing else None
),
"uprn": listing.get("national_uprn", None) if listing else None,
"outcome": deal_data.get("outcome"), "outcome": deal_data.get("outcome"),
"outcome_notes": deal_data.get("outcome_notes"), "outcome_notes": deal_data.get("outcome_notes"),
"project_code": deal_data.get("project_code"), "project_code": deal_data.get("project_code"),
@ -385,7 +387,9 @@ class HubspotDataToDb:
"pashub_link": deal_data.get("pashub_link"), "pashub_link": deal_data.get("pashub_link"),
"sharepoint_link": deal_data.get("sharepoint_link"), "sharepoint_link": deal_data.get("sharepoint_link"),
"dampmould_growth": deal_data.get("dampmould_growth"), "dampmould_growth": deal_data.get("dampmould_growth"),
"damp_mould_and_repairs_comments": deal_data.get("damp_mould_and_repairs_comments"), "damp_mould_and_repairs_comments": deal_data.get(
"damp_mould_and_repairs_comments"
),
"pre_sap": deal_data.get("pre_sap"), "pre_sap": deal_data.get("pre_sap"),
"coordinator": deal_data.get("coordinator"), "coordinator": deal_data.get("coordinator"),
"mtp_completion_date": self._parse_hs_date( "mtp_completion_date": self._parse_hs_date(
@ -472,9 +476,9 @@ class HubspotDataToDb:
deal_id=deal_id, deal_id=deal_id,
dealname=deal_data.get("dealname"), dealname=deal_data.get("dealname"),
dealstage=deal_data.get("dealstage"), dealstage=deal_data.get("dealstage"),
listing_id=listing.get("listing_id", None), listing_id=listing.get("listing_id", None) if listing else None,
landlord_property_id=listing.get("owner_property_id"), landlord_property_id=listing.get("owner_property_id") if listing else None,
uprn=listing.get("national_uprn"), uprn=listing.get("national_uprn") if listing else None,
outcome=deal_data.get("outcome"), outcome=deal_data.get("outcome"),
outcome_notes=deal_data.get("outcome_notes"), outcome_notes=deal_data.get("outcome_notes"),
project_code=deal_data.get("project_code"), project_code=deal_data.get("project_code"),
@ -490,7 +494,9 @@ class HubspotDataToDb:
pashub_link=deal_data.get("pashub_link"), pashub_link=deal_data.get("pashub_link"),
sharepoint_link=deal_data.get("sharepoint_link"), sharepoint_link=deal_data.get("sharepoint_link"),
dampmould_growth=deal_data.get("dampmould_growth"), dampmould_growth=deal_data.get("dampmould_growth"),
damp_mould_and_repairs_comments=deal_data.get("damp_mould_and_repairs_comments"), damp_mould_and_repairs_comments=deal_data.get(
"damp_mould_and_repairs_comments"
),
pre_sap=deal_data.get("pre_sap"), pre_sap=deal_data.get("pre_sap"),
coordinator=deal_data.get("coordinator"), coordinator=deal_data.get("coordinator"),
mtp_completion_date=self._parse_hs_date( mtp_completion_date=self._parse_hs_date(

View file

@ -2,8 +2,6 @@ from etl.hubspot.hubspotClient import HubspotClient
from etl.hubspot.hubspotDataTodB import HubspotDataToDb from etl.hubspot.hubspotDataTodB import HubspotDataToDb
from backend.utils.subtasks import task_handler from backend.utils.subtasks import task_handler
from typing import Any from typing import Any
import json
import time
@task_handler() @task_handler()
@ -14,6 +12,7 @@ def handler(body: dict[str, Any], context: Any) -> None:
raise RuntimeError( raise RuntimeError(
"Missing Hubspot Deal ID in SQS body request, 'hubspot_deal_id'" "Missing Hubspot Deal ID in SQS body request, 'hubspot_deal_id'"
) )
hubspot_deal_id = "327170793707"
hubspot: HubspotClient = HubspotClient() hubspot: HubspotClient = HubspotClient()
dbloader: HubspotDataToDb = HubspotDataToDb() dbloader: HubspotDataToDb = HubspotDataToDb()