Skip to content

feat(North Northamptonshire): food caddy bin type in calendar scraper#1894

Closed
dweee wants to merge 2 commits into
robbrad:masterfrom
dweee:master
Closed

feat(North Northamptonshire): food caddy bin type in calendar scraper#1894
dweee wants to merge 2 commits into
robbrad:masterfrom
dweee:master

Conversation

@dweee
Copy link
Copy Markdown
Contributor

@dweee dweee commented Mar 23, 2026

Extends the North Northamptonshire calendar parser so food waste / caddy collections are classified as Food caddy instead of falling through to Unknown.

  • NorthNorthamptonshireCouncil: after Garden, match event titles (lowercased) containing food or caddy, and set bin_type to Food caddy, before the existing refuseGeneral branch.

Summary by CodeRabbit

  • Bug Fixes
    • Improved bin-type classification for North Northamptonshire Council to correctly identify food caddy/food collections, ensuring collection schedules show accurate bin types.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8a26b154-8034-4706-b7cd-82a3d7c2d6d2

📥 Commits

Reviewing files that changed from the base of the PR and between cdba826 and aecb104.

📒 Files selected for processing (1)
  • uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py

📝 Walkthrough

Walkthrough

Council parser updated to classify bin titles containing "food" or "caddy" (case-insensitive) as type "Food Caddy" instead of falling through to "Unknown".

Changes

Cohort / File(s) Summary
Food Caddy recognition
uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py
Added conditional logic in CouncilClass.parse_data to detect titles containing "food" or "caddy" and assign bin type "Food Caddy".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • dp247

Poem

🐰 I sniffed the bins and gave a hop,
Found food and caddy — no more stop,
North Northants now sorts with glee,
Compost calls — hooray for me! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly describes the main change: adding food caddy bin type classification to the North Northamptonshire calendar scraper.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py (1)

55-64: Prefer fail-fast over silent "Unknown" classification in parser logic.

Consider raising on unmatched titles instead of defaulting to "Unknown" so upstream format changes are detected immediately.

Suggested refactor
             elif "refuse" in sov:
                 bin_type = "General"
             else:
-                bin_type = "Unknown"
+                raise ValueError(f"Unrecognized bin title format: {output_json[i]['title']}")

Based on learnings: In uk_bin_collection/**/*.py, parsing should prefer explicit failures over silent defaults to catch format drift early.

🤖 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/NorthNorthamptonshireCouncil.py`
around lines 55 - 64, The parser currently falls back to bin_type = "Unknown"
when a schedule title in variable sov doesn't match known patterns; replace that
silent default with a fail-fast exception (e.g., raise ValueError) inside the
same parsing block in NorthNorthamptonshireCouncil (where sov and bin_type are
set) so any unmatched sov values immediately surface; include sov (and any
contextual identifier available) in the exception message to aid debugging and
detect upstream format changes early.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py`:
- Around line 59-60: The branch in NorthNorthamptonshireCouncil that sets
bin_type uses the non-canonical string "Food caddy", causing key-mismatch with
existing mappings; update the assignment in the elif "food" in sov or "caddy" in
sov branch to use the canonical label "Food Caddy" (i.e., set bin_type = "Food
Caddy") so it matches other council parsers and existing icon/color lookups for
the bin_type variable.

---

Nitpick comments:
In
`@uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py`:
- Around line 55-64: The parser currently falls back to bin_type = "Unknown"
when a schedule title in variable sov doesn't match known patterns; replace that
silent default with a fail-fast exception (e.g., raise ValueError) inside the
same parsing block in NorthNorthamptonshireCouncil (where sov and bin_type are
set) so any unmatched sov values immediately surface; include sov (and any
contextual identifier available) in the exception message to aid debugging and
detect upstream format changes early.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: da388ada-43c0-4b5b-84f1-ade972dceb12

📥 Commits

Reviewing files that changed from the base of the PR and between f5adb70 and cdba826.

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

Comment thread uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py Outdated
@robbrad
Copy link
Copy Markdown
Owner

robbrad commented Mar 28, 2026

Merged into the combined March 2026 release PR #1898. Closing to reduce release noise. Thank you for the contribution!

@robbrad robbrad closed this Mar 28, 2026
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.

2 participants