Weeknotes: Week 40, 2020

04 Oct 2020 13:04 GMT

I had a busy week, despite taking two days off. It was exciting but also a bit stressful.

Coronavirus restrictions map

On Wednesday, we launched our new interactive map of coronavirus restrictions. This was the project I mentioned I was working on last week.

The map shows a schematic representation of the coronavirus restrictions that apply in different parts of the UK. You can click on an area to see a summary of the local and national restrictions in force, and find a link to official guidance.

A screenshot of the interactive map showing coronavirus restrictions. The screenshot shows the map zoomed in on North Wales and the North West of England, with information about Denbighshire displayed in a popup.

The launch went really well. Jenny's tweet introducing the map got a big response and was shared by a number of MPs and journalists. I think the map has been successful largely because it is a collaboration between people with different specialisms.

Jenny and Dan are policy specialists; they classify the restrictions in each area using a simple taxonomy and enter them in a data file. Carl is our mapping specialist; he creates custom boundaries for the areas under restrictions and combines it with the data that Jenny and Dan produce. I take the boundary layer that Carl produces and map it with JavaScript and Leaflet.

This division of responsibilities makes it easier to update the map, which is going to be important as we respond to changes in the coming weeks.

The response to the map was interesting. We got a lot of positive feedback and also a few feature requests. People asked for things like a postcode lookup, layers showing the boundaries for other geographies, and an API for the data.

Those are all potentially worthwhile features to add, but there are reasons that we are unlikely to add many of them. A product like this is journalistic in nature: it's time-bound and contingent on events. Publishing the map already involves a commitment to maintain its current feature set and adding features only adds to that burden.

The Library has a well-earned reputation for the quality of its research, but what is less obvious from the outside is how efficient it is. The researchers who publish the briefing material that you see online also spend a good part of their time answering deadlined requests for information and analysis from Members, and are often working on internal projects for the wider organisation as well.

When we publish an online tool like this, we know that we will need to maintain it alongside everything else we are doing, so we have to decide where best to focus our limited resources. For example, Matthew Somerville already maintains a terrific postcode lookup tool for coronavirus restrictions, and there is no point us reproducing his work. What was missing when we started was a map.

There is also the question of what tools we have readily available. Can we take an idea forward quickly, given the immediately available resources? Anything that involves arranging new digital infrastructure takes time, and that constrains our options on projects where timeliness matters.

The unexpected level of interest in this project has raised questions about whether we have all the tools we need to do this kind of work effectively in future. I think we may need to make some long-term changes to our digital capability so that we have more options next time we tackle a similar problem.

So just because we haven't done a particular thing in this case does not mean we wouldn't ever do it. It depends on the time and resources available, and where we think we can add the most value.

Weeknotes: Week 43, 2020

23 Oct 2020 17:57 GMT

I have been on leave intermittently during the last few weeks. This was my first full week back at work and so my first full weeknotes after a short break. Not everything covered here happened this week, but I would rather write about the most interesting things that happen than stick rigidly to a format.

Coronavirus restrictions map

Work on the coronavirus restrictions map has continued since it launched. The initial response was quite surprising. The map received over 100,000 unique visits in the first few days and settled down to an average of around 2,000 a day this week.

With this many people using the map we (that is me, Carl, Dan and Jenny) have felt a big responsibility to keep it as up to date and accurate as possible. It hasn't been easy, given the frequency with which new announcements have been made and the increasing complexity of the restrictions in place across the UK. I had to build more flexibility into the structure of the application so that different systems of restrictions can apply in different parts of the UK.

One unexpected piece of work was rebuilding the entire application from scratch using a different framework about a week after it launched. The map was originally built using Leaflet. However, Mapbox very kindly offered to waive the cost of our map tiles, as they were running a promotion for non-commercial maps providing public information on Covid. In return they asked if we would consider switching from using Leaflet to Mapbox GL JS as this would use their resources more efficiently. It seemed only fair to honour that request.

If you are not familiar with Mapbox GL, it's like a more powerful version of Leaflet. Mapbox GL JS is the JavaScript library for Mapbox GL, but there are also native SDKs for various operating systems. Mapbox GL gives you much more control over how your map looks and behaves than Leaflet, but you need to tell it in more detail what you want it to do. To help with this, it provides some neat declarative APIs which you can use to set the properties of different elements on the map based on the data they represent. I've used Mapbox GL JS once before, on MSOA Names, but I learned a lot more about it on this project.

One other important feature of the map that I haven't written about before is the icon set we are using for the restriction categories. The icons come from a rather wonderful open source icon set called Remix Icon. This is a general purpose collection of icons for application development. You can see a few examples of the icons in the latest national restrictions for Wales.

A screenshot of the interactive map showing coronavirus restrictions. The screenshot shows the map zoomed in on Wales to illustrate the icons used to represent the restrictions in the pop-up information box that is shown when a user clicks the map.

We've had to be quite creative in using the icons to represent different types of restrictions rather than the typical user-interface elements for which they were designed. But the collection has been comprehensive enough to meet all our needs so far.

I will never stop being grateful to the designers and coders who publish wonderful open source resources like this.

Parliamentary data

As I mentioned previously, one of my big focusses right now is developing the Library's capability for working with Parliamentary data. Noel, Elise and I have been developing a set of R packages and scripts for working with different parliamentary data sources so that we can easily download, combine and analyse the data we need for Parliamentary research.

In an ideal world this work would not have been necessary. But the pause in the development of the data platform means we need to move ahead with using the currently available sources until the project to integrate procedural data is back on track. It's coming, but it won't happen overnight.

This week Noel finished initial development work on a new R package for retrieving data from the Members Names Information Service (MNIS) called clmnis. MNIS is the system that manages Member data in Parliament. The neat thing about Noel's package is that it has exactly the same interface as the Member functions in our R and Python packages for getting Member data for the data platform. The idea is that the packages should be interchangeable so that we can switch back to using the data platform in future.

Noel and I went through some of the code together on Tuesday and I spent Wednesday working on unit tests for the package. It's still in beta for now, but we are working to make it production ready as soon as possible. I think Noel has done an amazing job. We are aiming to get colleagues to start testing it next week. And then after that we will start work on a package for the Commons and Lords votes APIs.