A scrape that fires Abri triggers builds one message naming the fired flows 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-07 10:13:48 +00:00
parent 2e72f32d52
commit 28b4a8927f

View file

@ -26,4 +26,34 @@ def build_abri_trigger_message(
old_deal: HubspotDealData,
) -> Optional[Dict[str, Any]]:
"""The Abri trigger message for this scrape, or None if no flow fired."""
raise NotImplementedError
flows: List[str] = []
if HubspotDealDiffer.check_for_abri_job_amendment(
new_deal=new_deal, new_project=new_project, old_deal=old_deal
):
flows.append("amend_job")
if HubspotDealDiffer.check_for_abri_job_logging(
new_deal=new_deal, new_project=new_project, old_deal=old_deal
):
flows.append("log_job")
if HubspotDealDiffer.check_for_abri_tenant_data_fetch(
new_deal=new_deal, new_project=new_project, old_deal=old_deal
):
flows.append("sync_tenant_data")
if not flows:
return None
confirmed_survey_date = parse_hs_date(new_deal.get("confirmed_survey_date"))
listing = new_listing or {}
return {
"hubspot_deal_id": hubspot_deal_id,
"flows": flows,
"place_ref": listing.get("owner_property_id"),
"deal_name": new_deal.get("dealname"),
"confirmed_survey_date": (
confirmed_survey_date.date().isoformat()
if confirmed_survey_date is not None
else None
),
"confirmed_survey_time": new_deal.get("confirmed_survey_time"),
}