From f396d8a62f7ae50bdb26e138c63313398f7eecf7 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 16 Jul 2025 11:16:33 +0200 Subject: [PATCH] Simplify return home heuristics now that we have comprehensive travel data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove complex country-based return home assumptions since we now track actual train and ferry travel back to the UK. The system can rely on real travel data rather than heuristics. - Remove NEARBY_BALKAN_COUNTRIES constant - Remove geographic assumptions about returning home after trips - Keep only UK trip ending logic (if trip ends in UK, you're home) With complete train/ferry tracking, actual return travel is captured rather than inferred. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- agenda/busy.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/agenda/busy.py b/agenda/busy.py index 31cc4b6..9d7e61d 100644 --- a/agenda/busy.py +++ b/agenda/busy.py @@ -11,20 +11,6 @@ from . import events_yaml, get_country, travel from .event import Event from .types import StrDict, Trip -NEARBY_BALKAN_COUNTRIES = { - "GR", - "AL", - "XK", - "HR", - "SI", - "MK", - "BA", - "ME", - "RS", - "BG", - "RO", -} - def busy_event(e: Event) -> bool: """Busy.""" @@ -522,19 +508,6 @@ def _check_return_home_heuristic( if hasattr(final_country, "alpha_2") and final_country.alpha_2 == "GB": return (None, get_country("gb")) - # For short trips to nearby countries or international trips - # (ended >=1 day ago), assume returned home if no subsequent travel data - if days_since_trip >= 1 and ( - # European countries (close by rail/ferry) - final_alpha_2 in {"BE", "NL", "FR", "DE", "CH", "AT", "IT", "ES"} - # Nearby Balkan countries - or final_alpha_2 in NEARBY_BALKAN_COUNTRIES - # International trips (assume return home after trip ends) - or final_alpha_2 - in {"US", "CA", "IN", "JP", "CN", "AU", "NZ", "BR", "AR", "ZA"} - ): - return (None, get_country("gb")) - return None