May 2026 Release#1996
Conversation
… dropdown The scraper selected addresses by UPRN value in the dropdown, which fails when the resolved UPRN doesn't exactly match one of the council's dropdown option values. Now tries UPRN match first, then falls back to matching the dropdown option text by house number prefix.
…ch in dropdown select_by_visible_text fails when the dropdown text includes the street name (e.g. "72, Birchanger Lane") but only the house number is provided. Now tries exact match first, then iterates options matching by house number prefix.
…umber provided The Recollect address-suggest API needs a street name to find a specific property, but callers often only have a house number + postcode. Added postcodes.io + Nominatim reverse geocoding to resolve the street name from the postcode coordinates, then builds search queries combining the house number with the resolved street.
📝 WalkthroughWalkthroughThis PR improves address dropdown matching robustness across three council handlers (Broxtowe, Stirling, Uttlesford) by introducing fallback matching strategies that first attempt exact matches or UPRN-based selection, then resort to case-insensitive prefix matching on house numbers. Stirling additionally adds helper functions and constants for enhanced address query building using postcode-to-coordinate and reverse-geocoding lookups. ChangesAddress Matching Robustness Across Council Handlers
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 4❌ Failed checks (1 warning, 3 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1996 +/- ##
=======================================
Coverage 86.67% 86.67%
=======================================
Files 9 9
Lines 1141 1141
=======================================
Hits 989 989
Misses 152 152 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
uk_bin_collection/uk_bin_collection/councils/BroxtoweBoroughCouncil.py (1)
59-66: 💤 Low valueConsider logging the UPRN selection failure for debugging.
The silent
except: passpattern makes debugging difficult when UPRN matching fails unexpectedly. While the fallback logic is sound, adding a debug log would help diagnose issues.📝 Suggested improvement
if user_uprn: try: dropdownSelect.select_by_value("U" + user_uprn) matched = True - except Exception: - pass + except Exception as e: + # Expected if UPRN not found; fall back to house number match + passOr, if logging is available in scope:
except Exception: logging.debug(f"UPRN '{user_uprn}' not found in dropdown, falling back to house number match")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@uk_bin_collection/uk_bin_collection/councils/BroxtoweBoroughCouncil.py` around lines 59 - 66, The current silent except in the UPRN selection block (around dropdownSelect.select_by_value("U" + user_uprn") in BroxtoweBoroughCouncil.py) should log failures for debugging: replace the bare except with an exception handler that emits a debug-level log including the user_uprn and the exception details (e.g., logging.debug or logging.exception/with exc_info=True) and then falls back to the house-number matching logic while leaving matched=False; ensure you reference dropdownSelect.select_by_value and user_uprn in the log message so the failure is traceable.uk_bin_collection/uk_bin_collection/councils/StirlingCouncil.py (1)
53-68: Add error logging or comments to silent exception handler.The silent
except Exception: passat lines 67–68 swallows failures from both the postcodes.io API call and Nominatim reverse geocoding, making debugging difficult. While the code includes a proper User-Agent header (satisfying Nominatim's policy requirements), the exception handling lacks visibility into why geocoding fails.The implementation calls Nominatim at most once per
parse_data()invocation, so the 1-request-per-second rate limit is not a practical concern for typical use.Suggested improvement
Add a comment to clarify intent:
except Exception: + # Geocoding fallback failed; continue with other query strategies passOr if logging is preferred:
except Exception as e: logging.debug(f"Geocoding fallback failed for postcode {postcode}: {e}")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@uk_bin_collection/uk_bin_collection/councils/StirlingCouncil.py` around lines 53 - 68, The broad except in parse_data() around the postcodes.io and Nominatim reverse call is swallowing errors; update the except Exception: pass to either log the failure or document the intent—capture the exception as e and call logging.debug or logging.error with context including postcode, lat/lng and e (e.g. refer to rev_resp, NOMINATIM_URL, HEADERS, paon, lat, lng) so failures in the geocoding fallback are visible, or replace the pass with a clear comment stating that failures are intentionally ignored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@uk_bin_collection/uk_bin_collection/councils/BroxtoweBoroughCouncil.py`:
- Around line 59-66: The current silent except in the UPRN selection block
(around dropdownSelect.select_by_value("U" + user_uprn") in
BroxtoweBoroughCouncil.py) should log failures for debugging: replace the bare
except with an exception handler that emits a debug-level log including the
user_uprn and the exception details (e.g., logging.debug or
logging.exception/with exc_info=True) and then falls back to the house-number
matching logic while leaving matched=False; ensure you reference
dropdownSelect.select_by_value and user_uprn in the log message so the failure
is traceable.
In `@uk_bin_collection/uk_bin_collection/councils/StirlingCouncil.py`:
- Around line 53-68: The broad except in parse_data() around the postcodes.io
and Nominatim reverse call is swallowing errors; update the except Exception:
pass to either log the failure or document the intent—capture the exception as e
and call logging.debug or logging.error with context including postcode, lat/lng
and e (e.g. refer to rev_resp, NOMINATIM_URL, HEADERS, paon, lat, lng) so
failures in the geocoding fallback are visible, or replace the pass with a clear
comment stating that failures are intentionally ignored.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 01117015-d562-4ef0-9fbf-0d8558a015d1
📒 Files selected for processing (3)
uk_bin_collection/uk_bin_collection/councils/BroxtoweBoroughCouncil.pyuk_bin_collection/uk_bin_collection/councils/StirlingCouncil.pyuk_bin_collection/uk_bin_collection/councils/UttlesfordDistrictCouncil.py
May 2026 Release — 63 PRs Consolidated
All open PRs merged into a single release branch with merge conflicts resolved.
Council Fixes (56 PRs)
Bug Fixes
Dependencies (4 PRs)
Issues Resolved (23)
Closes #1555, #1616, #1725, #1768, #1804, #1806, #1889, #1890, #1893, #1902, #1904, #1906, #1908, #1910, #1911, #1914, #1931, #1946, #1951, #1962, #1966, #1970, #1982
Code Review Notes
Summary by CodeRabbit