Closed jamesmacwhite closed 1 week ago
Oooooh, I love this! You're doing the work of a saint for Gedling!
Thanks! The street name search for Refuse Collection Days from Gedling is weird to be honest. It appears to do partial matching on the "Location" and "No's" values columns in the database table. For example, a search of simply "1" would return results, because in some cases specific numbers are used in collection row data, but you'll get loads of results. The other issue which I haven't handled is paginated responses. Really wide queries will return results with pagination, I may look at trying to handle this for the front end built, but for now, I have set validation rules under the API for the search term to be a minimum of a few things, just to try and avoid that for now.
The reason for the API was to build an alternative search front end, but I just ended up opening up the API if anyone wants to use it outside of the original website. The irony of the origin search is doesn't directly state the collection weekday or schedule name, the only place it exists is on the email subscribe URL, parsing out the final URL part e.g. monday-g1
.
Name of Council
Gedling Borough Council
Issue Information
The current implementation of the Gedling Borough Council parser for stage one does not factor in street name searches which return multiple results.
Example street name values which do this are
Oxclose Lane
,Westdale Lane
,Breck Hill Road
.These examples will return multiple rows in the refuse/recycling/garden waste collection table, so targeting the ID of the "Download Calendar" link with a fixed ID will not work reliably in this scenario, as it will only pick the first row, which might not be the right schedule for these areas.
Instead, querying the tables by their ID and then DOM parsing the tbody tr rows as an array and mapping the cell data as values works.
If it is useful, I have built an API deployed as a Cloudflare Worker, which is at: https://api.gbcbincalendars.co.uk, it queries https://apps.gedling.gov.uk/refuse/search.aspx but returns the data in JSON and will handle multiple rows as a JSON array. It takes a single query parameter of
streetName
.Example queries:
I built this for a front end search that provides the specific collection name as part of gbcbincalendars.co.uk, but it's an open API with CORS headers set, given its technically just a proxy for Gedling's geriatric refuse search.
Feel free to use it in this project, the intention is to have reliable JSON data for the bin collection data for Gedling.
Verification