Skip to content

feat: Add more bins to Edinburgh City Council#2133

Open
ashh87 wants to merge 5 commits into
robbrad:masterfrom
ashh87:edi_more_bins
Open

feat: Add more bins to Edinburgh City Council#2133
ashh87 wants to merge 5 commits into
robbrad:masterfrom
ashh87:edi_more_bins

Conversation

@ashh87

@ashh87 ashh87 commented Jun 14, 2026

Copy link
Copy Markdown

Summary


  • Adds food waste and garden waste collections to Edinburgh City Council

Summary by CodeRabbit

Release Notes

  • New Features

    • Added improved Food Waste Bin scheduling for Edinburgh, including correct cadence calculation
    • Enhanced Garden Waste Bin handling with a no-collection holiday window and accurate garden-cycle offsets
  • Refactor

    • Improved Edinburgh Council bin schedule generation for greater reliability, including better directory selection and calendar parsing

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ashh87, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 12 minutes and 11 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 10701f0e-13d0-4c54-969b-0e14103f8ebf

📥 Commits

Reviewing files that changed from the base of the PR and between 65ad8ea and 957a086.

📒 Files selected for processing (1)
  • uk_bin_collection/uk_bin_collection/councils/EdinburghCityCouncil.py
📝 Walkthrough

Walkthrough

Refactors EdinburghCityCouncil.py to extract directory scraping and calendar parsing into dedicated helper functions. _search_directory now accepts a record ID. New helpers extract collection day and garden calendar data from record pages. _get_three_bins, _get_food_bin, and _get_garden_bin replace inline logic. parse_data uses these helpers to emit food waste, garden waste (with a skip window), grey, green, and glass bin entries.

Changes

Edinburgh Council Bin Collection Refactor

Layer / File(s) Summary
Directory search and record scraping helpers
uk_bin_collection/uk_bin_collection/councils/EdinburghCityCouncil.py
_search_directory updated to accept a record directory ID alongside street_name. New helpers parse "collection day" and garden calendar URLs from record pages.
Calendar parsing and bin scheduling helpers
uk_bin_collection/uk_bin_collection/councils/EdinburghCityCouncil.py
Adds _parse_garden_calendar_code, _get_best_url, _get_three_bins, _get_food_bin, and _get_garden_bin with hard-coded no-garden-waste date windows and week-index-based start-date selection.
parse_data bin emission
uk_bin_collection/uk_bin_collection/councils/EdinburghCityCouncil.py
parse_data now calls the new helpers and emits Food Waste Bin, Brown Garden Waste Bin (skipping the no-garden-waste window), Grey Bin, Green Bin, and Glass Box entries via computed offsets.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hippity-hop through the bins we go,
Grey, green, and glass all in a row,
Garden waste skips its wintry rest,
Food waste joins the weekly quest.
The helpers hop in, clean and neat —
Edinburgh rubbish: can't be beat! 🗑️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding food waste and garden waste collection types to Edinburgh City Council, expanding bin collection support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@uk_bin_collection/uk_bin_collection/councils/EdinburghCityCouncil.py`:
- Around line 198-203: In the _get_food_bin function, add explicit validation
after calling _get_collection_day to check if the returned food_collection_day
is None. If it is None, raise an exception with a clear error message indicating
that the collection day field could not be found on the record page, rather than
allowing the subsequent days_of_week.index() call to fail with a confusing
ValueError. This ensures debugging is easier when the field is missing from the
webpage.
- Around line 110-127: The _get_garden_calendar_code function has two issues:
First, the condition on line 125 uses `if target_idx > 0` but str.find() returns
-1 when the substring is not found (not some value less than 0), so the check
should be `if target_idx >= 0` or `if target_idx != -1` to correctly handle
cases where "garden-waste-calendar-" appears at position 0. Second, the
docstring incorrectly states the function "extract the collection day" when it
actually extracts the garden calendar code; update the docstring to accurately
describe what the function does.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff8fae33-6345-418e-94e0-732acd804e56

📥 Commits

Reviewing files that changed from the base of the PR and between b65502c and c7e0c79.

📒 Files selected for processing (1)
  • uk_bin_collection/uk_bin_collection/councils/EdinburghCityCouncil.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant