Using the coronavirus dashboard API
During the course of this COVID-19 pandemic statistics and data have shown their huge importance in society. Members of the public have become armchair statisticians, passing comment on the latest rates and using phrases such as "flatten the curve".
The coronavirus dashboard
The government has also become much better at publishing statistics, and the go-to place to find out what is happening in your area is Public Health England's coronavirus dashboard. This is updated daily with data on testing, cases, hospital admissions and deaths. It will soon incorporate data about vaccinations undertaken.
About the dashboard's API
As part of this, an Application Programming Interface (API) has been developed so that people can automatically download the latest data programmatically, possibly incorporating the latest data into a web page or app. Building an API for such important information is best practice, especially at this time. Packages have been developed for R, Python and javascript so that developers don't need to build their own package from scratch.
I have used the R package, ukcovid19, to develop an R Shiny app to compare local areas case rates with the national rate.
Some comments on the API
There is a lot of information about how to use the API. The R, Python and javascript packages also incorporate functions that would be a faff to implement yourself, such as ensuring that all the requested data is returned in one go.
There are also elements of the API which could be improved, for example not all data is available for all geographical areas but it is not clear which data is available for which area types, unless you iterate through all possible combinations. In addition, there is now a 'download data' tab which contains more data for manual download than is available in the API (for example, data by Middle Layer Super Output Area, a geography containing between 5,000 and 7,500 people).
However, overall I am still impressed that this data is available by API, and impressed at the openness of the team building the API to comments and suggestions on Twitter.
Get the code
As ever, my code is available on Github and I always welcome comments or suggestions for improvements.