Compare commits
2 Commits
101109b6cf
...
bbf68db78c
| Author | SHA1 | Date | |
|---|---|---|---|
| bbf68db78c | |||
| 36be6ee156 |
@@ -1 +1 @@
|
||||
{"task_id": "31188f42-8544-8074-bad3-d3e1b9b4051f", "token": "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", "readme_path": "connector-superoffice/README.md", "session_start_time": "2026-03-04T16:53:00.439540"}
|
||||
{"task_id": "31188f42-8544-8074-bad3-d3e1b9b4051f", "token": "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", "readme_path": "connector-superoffice/README.md", "session_start_time": "2026-03-04T17:52:02.227148"}
|
||||
@@ -52,6 +52,47 @@ def process_job(job, so_client: SuperOfficeClient):
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
|
||||
# 0b. Noise Reduction: Filter irrelevant field changes
|
||||
# Only re-process if core data (Name, Website) or UDFs (Vertical) changed.
|
||||
if job['event_type'] == 'contact.changed':
|
||||
changes = payload.get('Changes', [])
|
||||
# Normalize to lower case for comparison
|
||||
changes_lower = [str(c).lower() for c in changes]
|
||||
|
||||
# Fields that trigger a re-analysis
|
||||
relevant_fields = [
|
||||
'name', # Company Name change -> Full Re-Scan
|
||||
'urladdress', # Website change -> Full Re-Scan
|
||||
'urls', # Website array change
|
||||
'orgnr', # VAT/Register ID change
|
||||
'userdef_id', # UDFs (Verticals, etc.) changed
|
||||
'country_id' # Country change
|
||||
]
|
||||
|
||||
# Check if ANY relevant field is in the changes list
|
||||
is_relevant = any(field in changes_lower for field in relevant_fields)
|
||||
|
||||
if not is_relevant:
|
||||
logger.info(f"⏭️ Skipping 'contact.changed': No relevant fields changed. (Changes: {changes})")
|
||||
return "SUCCESS"
|
||||
|
||||
if job['event_type'] == 'person.changed':
|
||||
changes = payload.get('Changes', [])
|
||||
changes_lower = [str(c).lower() for c in changes]
|
||||
|
||||
relevant_person_fields = [
|
||||
'jobtitle', # Job Title change
|
||||
'title', # Alternative title field
|
||||
'position_id', # Standard Position/Role dropdown
|
||||
'userdef_id' # UDFs (MA Status, Campaign, etc.)
|
||||
]
|
||||
|
||||
is_relevant = any(field in changes_lower for field in relevant_person_fields)
|
||||
|
||||
if not is_relevant:
|
||||
logger.info(f"⏭️ Skipping 'person.changed': No relevant fields changed. (Changes: {changes})")
|
||||
return "SUCCESS"
|
||||
|
||||
# 1. Extract IDs Early
|
||||
person_id = None
|
||||
contact_id = None
|
||||
|
||||
Reference in New Issue
Block a user