Skip to content

fix(iapp_itouchvision_com): fetch Buckinghamshire from the council portal - #7323

Open
kanthamohan wants to merge 1 commit into
mampfes:masterfrom
kanthamohan:fix/itouchvision-buckinghamshire-portal
Open

fix(iapp_itouchvision_com): fetch Buckinghamshire from the council portal#7323
kanthamohan wants to merge 1 commit into
mampfes:masterfrom
kanthamohan:fix/itouchvision-buckinghamshire-portal

Conversation

@kanthamohan

Copy link
Copy Markdown
Contributor

Summary

Fixes #7240.

Buckinghamshire (client 152, council 34505) retired its kmbd/collectionDay data in August 2026. The endpoint still answers, but returns {"collectionDay": null} for every Buckinghamshire UPRN, so fetch() failed with TypeError: 'NoneType' object is not iterable. Other councils on the same API (verified against Newport and Hyndburn) are unaffected.

The council now serves the schedule from the "Check your next bin collection date" form on the iTouchVision "My Council Services" portal, which the council website links to.

This adds an optional PORTAL_CUID to the municipality definitions. Municipalities carrying one are fetched through the portal web service; every other council keeps using the collectionDay API by exactly the same code path as before.

Notes on the portal path:

  • The form, web service and web service input identifiers are discovered at runtime from the customer UID the council website links to, rather than hardcoded, so the source keeps working if the council edits the form.
  • The web service is addressed by the id of a draft service request (the form is normally filled in by a citizen). One draft is created per source instance and reused; if the portal ever discards it, the identifiers are rediscovered and the request retried once.
  • The portal renders dates as "Monday 7 September", without a year. The year is resolved by matching the weekday name against the neighbouring years, so collections around New Year land in the right year. Month and weekday names are matched explicitly rather than through strptime, which would depend on the host locale.
  • An unknown UPRN is answered with a plain message instead of a table, and now raises SourceArgumentNotFound carrying that message.
  • No authentication is involved: none of the calls send an Authorization header.

BUCKINGHAMSHIRE and AYLESBURY VALE share the same client, so both were broken and both are fixed here.

The portal only publishes the next collection of each waste type, where the old API returned collectionDay plus followingDay, so Buckinghamshire now yields fewer future dates. That is all the new service exposes; gdsv5/service/getkmbdcalendar returns only a header for this council. This is noted in the source documentation.

Also renames the chiltern: 100080550517 test case to Buckinghamshire: 100080550517 (the municipality argument was already BUCKINGHAMSHIRE), and adds ICON_MAP entries for the two new waste type labels.

Test results

python -m pytest tests/ — 39 passed.

python test_sources.py -s iapp_itouchvision_com -l — all 9 test cases return live data. Buckinghamshire and Aylesbury Vale are fixed; the other seven councils are unchanged:

  found 5 entries for Buckinghamshire: 100080550517
    2026-09-07 : Food waste
    2026-09-07 : General waste
    2026-09-14 : Mixed recycling
    2026-09-14 : Paper and cardboard recycling
    2026-09-14 : Small household electricals, batteries and textiles
  found 4 entries for Aylesbury Vale: 766251559
    2026-09-10 : Food waste
    2026-09-17 : General waste
    2026-09-10 : Mixed recycling
    2026-09-17 : Garden waste

Additionally checked by hand: the discovered form is cached across fetches; a deliberately stale draft request id recovers on the next fetch; an unknown UPRN raises SourceArgumentNotFound; and the date resolver returns the right year across a New Year boundary in both directions and on a leap day.

Type of change

  • New source
  • Bug fix / source fix
  • Documentation update
  • Other

Checklist

  • python -m pytest tests/test_source_components.py -q passes
  • ruff check --fix and ruff format run on changed source files
  • No generated files in diff (README.md, info.md, sources.json, translations/*.json — CI regenerates these post-merge)
  • doc/source/<name>.md created for new sources (n/a — existing doc updated)
  • TEST_CASES use real, publicly accessible addresses (not my own)

…rtal

Buckinghamshire (client 152, council 34505) retired its kmbd/collectionDay
data in August 2026. The endpoint still answers, but returns
{"collectionDay": null} for every Buckinghamshire UPRN, so fetch() failed
with "TypeError: 'NoneType' object is not iterable". The council now serves
the schedule from a form on the iTouchVision "My Council Services" portal.

Add an optional PORTAL_CUID to the municipality definitions. Municipalities
that carry one are fetched through the portal web service instead; all other
councils keep using the collectionDay API unchanged.

The portal path derives the form, web service and input identifiers at
runtime from the customer UID that the council website links to, so it keeps
working if the council edits the form. Those identifiers and the draft
service request the web service is addressed with are cached per source
instance, and rediscovered once if the portal discards the draft.

The portal renders dates as "Monday 7 September", without a year, so the
year is resolved by matching the weekday name across the neighbouring years.
An unknown UPRN is answered with a message instead of a table and now raises
SourceArgumentNotFound rather than crashing.

Both BUCKINGHAMSHIRE and AYLESBURY VALE are affected, as they share the same
client, and both are fixed here.

Fixes mampfes#7240
@tmo72

tmo72 commented Sep 7, 2026

Copy link
Copy Markdown

Still broken for me?

@kanthamohan

Copy link
Copy Markdown
Contributor Author

Can you share a bit more detail please? Was it with this fix? If yes which local authority?

@tmo72

tmo72 commented Sep 7, 2026

Copy link
Copy Markdown

Can you share a bit more detail please? Was it with this fix? If yes which local authority?

Buckinghamshire: Formerly (Chiltern, South Bucks, Wycombe)
Municipality
BUCKINGHAMSHIRE
Error: The source returned an invalid response: "'NoneType' object is not iterable". Please check the provided arguments and try again.
I applied the latest fix which I think was released Sat or Sunday.

@kanthamohan

Copy link
Copy Markdown
Contributor Author

This PR has not yet been accepted and it was only posted yesterday so it would not have made it into a release unless you manually pulled this and applied yourself.

@tmo72

tmo72 commented Sep 7, 2026

Copy link
Copy Markdown

This PR has not yet been accepted and it was only posted yesterday so it would not have made it into a release unless you manually pulled this and applied yourself.

Ah OK - thank you.

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.

Buckinghamshire no longer working [Source Defect]

2 participants