Gopher Rodeo

Lisdex

Context

The UK for a while was in the grip of a crisis in the amount of stock available for various ADHD medications, such as Lisdexamfetamine (Elvanse). The only pharmacy chain that had an option to view the stock availability in your area was Boots, but you could only view the 7 or so stores nearest to your location.

I decided to reverse-engineer their API, and then create a method to query all the available Boots stores, along with all of the doses of Lisdexamfetamine that are available. I then wanted to plot these onto an interactive map.

Method

I managed to reverse-engineer the API fairly easily. It is very fragile, in that it expects exactly the inputs it expects and there can be absolutely no variations, but I was able to get the data I needed. The next step was publishing this as an interactive map.

This lead me down a rabbit hole of trying to find how to create interactive maps with clickable elements. I managed to find MapLibre GL JS, which had the functionality I needed. I then stumbled around trying to find how to display tiles. After intially looking at Ordnance Survey, and then discounting it because their maps exclude the island of Ireland and the UK's crown dependencies, I found that I could use OpenStreetMap's raster tiles by creating a style definition like the below:

const osm_style = {
    "version": 8,
        "sources": {
        "osm": {
                "type": "raster",
                "tiles": ["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"],
                "tileSize": 256,
        "attribution": "© OpenStreetMap Contributors",
        "maxzoom": 19
        }
    },
    "layers": [
        {
        "id": "osm",
        "type": "raster",
        "source": "osm" // This must match the source key above
        }
    ]
};

This is fine as it is not for commercial use. Each icon on the map is represented in a GeoJSON file that is generated each night.

Status

You can find the tracker here: Lisdex

As I was getting ready to announce the availability of the tracker someone else released a much more feature-packed version, which is available at pharmacystockchecker.com.

This did lead me to look at GeoJSON and how to create raster tiles, raster tile servers, etc. I am still thinking about creating a very simple CGI script that is a raster tile cache and proxy. Complete raster tile sets can be a few terrabytes in size so it might not be that useful, though!