Skip to content

fix: Update Chelmsford Council to handle PDF instead of old ICS - #2332

Open
ethanjohn99 wants to merge 1 commit into
robbrad:masterfrom
ethanjohn99:chelmsford-2327
Open

ethanjohn99 wants to merge 1 commit into
robbrad:masterfrom
ethanjohn99:chelmsford-2327

Conversation

@ethanjohn99

@ethanjohn99 ethanjohn99 commented Nov 5, 2026 •

Copy link
Copy Markdown

Chelmsford Council have updated the website and no longer provide the expected ICS.
This has been updated to ingest the PDF provided and build the collection data off the back of the PDF.

Summary by CodeRabbit

  • New Features
    • Added support for Chelmsford collection calendars provided as PDFs, including collection dates up to 60 days ahead.
  • Bug Fixes
    • Improved error handling for missing calendars, invalid PDF downloads, and calendars without recognizable collection details.
  • Documentation
    • Updated Chelmsford setup instructions to use the council’s collection-day search and request a matching address.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

Chelmsford calendar parsing now supports PDF calendars when no ICS link is available. The parser maps PDF markers to collection dates and bin types. The council instructions now use the collection-day search page.

Changes: Chelmsford PDF calendar support

Layer / File(s) Summary
Parse PDF calendar markers
uk_bin_collection/uk_bin_collection/councils/ChelmsfordCityCouncil.py, uk_bin_collection/tests/test_chelmsford_city_council.py
The parser identifies month grids and maps black and brown markers to dated collections and bin types. Tests cover marker mapping, grid assignment, and parsing errors.
Select and filter calendar source
uk_bin_collection/uk_bin_collection/councils/ChelmsfordCityCouncil.py, uk_bin_collection/tests/test_chelmsford_city_council.py, wiki/Councils.md
When no ICS link exists, parse_data downloads a linked PDF, checks its signature, and includes collections from today through 60 days ahead, inclusive. Tests cover download and error cases. The council instructions use the collection-day search URL and no longer describe the WebDriver option.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant parse_data
  participant CalendarPage
  participant PDFDownload
  participant _parse_calendar_pdf
  parse_data->>CalendarPage: Find calendar PDF link
  parse_data->>PDFDownload: Download linked PDF
  PDFDownload-->>parse_data: Return PDF response
  parse_data->>_parse_calendar_pdf: Parse PDF calendar
  _parse_calendar_pdf-->>parse_data: Return dated collections
Loading

Possibly related issues

  • robbrad/UKBinCollectionData#2327 reports that Chelmsford replaced ICS files with PDF schedules. This change adds PDF schedule parsing.

Suggested reviewers: robbrad

Merge Risk: Low · up to 76676

The PDF fallback has bounded parsing and redirect edge cases, and the updated instructions will be overwritten unless their source data is updated. These issues warrant correction or explicit follow-up; no broad failure is established.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

robbrad commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Thanks @ethanjohn99. Chelmsford moving from ICS to a PDF is a real change (see #2327), and it's good to have a start on it plus a test file. I went through this while putting the November release together, and couldn't include it as it stands. What I'd need to see changed:

  1. Please revert the wiki/Councils.md edit. That file is auto-generated from input.json and overwritten on the next run, so hand edits there are lost. Change the wiki_note/wiki_name in input.json instead.
  2. PDF parsing is keyed on hardcoded RGB colours with no real sample to check it against. If you can add a short, redacted extract of the council's PDF as a test fixture (or describe how to find the colour per bin type), the parser can be tested offline and will be easier to keep working when the council tweaks the layout.
  3. Address matching is by substring, so "1" can match "11" or "21". Please match only at the start of the address, as a whole word, and raise (listing the candidates) when zero or more than one address matches.
  4. input.json. The entry still carries web_driver if it's no longer needed, and needs the new URL and a wiki_note for the new inputs. Please use a council office or library as the test address (that file is public).

Happy to re-review once those are in.


Generated by Claude Code

This branch has not been deployed

No deployments
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