Friday, 6 April 2018

Alexa, Open South Gloucestershire Bin Day


Another month, another Alexa skill that I've released to the wild. This was the skill that I teased back in Janurary on Twitter as the "useful" skill. The skill started off life with my main goal of retrieving information on my next bin collection as I kept forgetting what was being picked up each week (recycling, garden waste, non-recyclables). The skills available on the store were either for specific councils (not mine), or required me to set up the information my self. The problem with the latter is I'd be getting the wrong information if it ever changed without me knowing. I wanted to get the data straight from the source.

Luckily, my local council is South Gloucestershire and they are helpful enough to have the information available on their site (like most councils). Even better though their site seems to follow modern practices separating their services from their presentation layer, which meant I could use the same private APIs to retrieve the bin information. This meant that I could ask the council directly for this information and I developed this part of the skill quite early on. So why has it taken until now to release it?

Well, not content with just doing my council, I wanted to investigate if I could support other councils as well. I found a delightful API called api.postcodes.io, which allowed me to query the council that a given postcode was under. This was perfect for me to determine which council I had to query for the bin information for a given user. However, this is where my plans fell apart.

I started by looking at the number of councils available in England alone on Wikipedia. Turns out, there's a lot! So I decided to focus on the councils that served the most people and therefore my skill would be helpful to the most people. Unfortunately not all council websites are created equally and retrieving bin information are not designed as nicely as South Gloucestershire. Most of them are ASP based with server side rendering, which would mean that I would have to parse the website source code to get the information I needed. The result of this was fragile logic which could break if the website ever changed. In addition, the time it was taking me to get a single council up and running was taking ages with no guarantee it wouldn't suddenly break.

I'm surprised (and not surprised) with how different each council's website is structured, despite providing very similar information. I wish our government would have a common approach across councils as this make my life easier. Better yet would be a centralised service that provided common council information as this could save costs in the long run if there was just one set of services they'd have to maintain.

But back to the point of this post. If like me your local council (and number 50 on the list) is South Gloucestershire, you can grab my new skill from the Amazon store. If you do enable it, please don't forget to leave a review :)

No comments:

Post a comment

Got an opinion? Who hasn't? Post it here...