Coronavirus local new cases Chart

I wanted to track how many new positive tests were recorded daily for people living in my local town, so with some help from @janvda (thanks!), I've created a flow to display the data obtained from coronavirus.gov.uk limited to upper tier Local Authorities (such as Sheffield, Doncaster, Rotherham etc).
A full list of those locations can be seen https://coronavirus.data.gov.uk/#local-authorities

The location is changed in the 'Parse data' change node. It is currently set to London, just change it to whichever upper tier Local Authority you want, but ensure that it's spelled/capitalised exactly as per the website list.
The data is generally updated daily by the Government between 3pm & 4pm, and also previous days data may also be amended.
It's a bit rough & ready, but feel free to further develop it, if you find it useful.

// Sorry - it only holds UK data.

[{"id":"5a81d56f.1408ac","type":"inject","z":"a4801683.1c0448","name":"Run flow","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":100,"y":1490,"wires":[["6769369c.c727d8"]]},{"id":"6769369c.c727d8","type":"http request","z":"a4801683.1c0448","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"https://coronavirus.data.gov.uk/downloads/csv/coronavirus-cases_latest.csv","tls":"","persist":false,"proxy":"","authType":"","x":250,"y":1490,"wires":[["a0c3e735.8118a8"]]},{"id":"a0c3e735.8118a8","type":"csv","z":"a4801683.1c0448","name":"csv2array","sep":",","hdrin":true,"hdrout":false,"multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"x":400,"y":1490,"wires":[["86f34f8b.1002e"]]},{"id":"f26d54ac.167168","type":"ui_chart","z":"a4801683.1c0448","name":"","group":"61d2dced.3db8f4","order":8,"width":"13","height":"8","label":"Daily Positive tests","chartType":"line","legend":"false","xformat":"D/M","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"8","removeOlderPoints":"1000","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#ff0000","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":890,"y":1490,"wires":[[]]},{"id":"7352b95.7fb5b48","type":"function","z":"a4801683.1c0448","name":"Format chart","func":"msg.payload = [{\n  \"series\": [\"New cases\"],\n  \"data\": [msg.payload],\n  \"labels\": [\"\"]\n}];\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":1490,"wires":[["f26d54ac.167168"]]},{"id":"86f34f8b.1002e","type":"change","z":"a4801683.1c0448","name":"Parse data","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[`Area name`='London'].{     \"x\" : $toMillis(`Specimen date`),     \"y\" : `Daily lab-confirmed cases` }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":1490,"wires":[["7352b95.7fb5b48"]]},{"id":"61d2dced.3db8f4","type":"ui_group","z":0,"name":"flowtest","tab":"3c94630c.13381c","order":1,"disp":true,"width":22,"collapse":false},{"id":"3c94630c.13381c","type":"ui_tab","z":0,"name":"Test","icon":"dashboard","order":9}]
3 Likes

Just note the usual caveats relating to the source data. e.g. the lack of testing and some deliberate choices as to when testing is not done.

Also, Sheffield for example shows a surprisingly high number but that is actually because we have one of the largest hospital testing labs in the country - not because we have a large number of cases - which we don't.

Numbers always come with a story that you need to understand before you can make sense of them.

2 Likes

Wasn't it Ronald Reagan who said you can never trust statistics? Oh wait, sorry, he actually said "never trust anyone who says we're from the government and we are here to help". Same thing really. :stuck_out_tongue_closed_eyes:

1 Like

I think it was Churchill who said: "I only believe in statistics that I doctored myself" (can't remember the exact wording) :face_with_monocle: :laughing:

1 Like

See also https://en.wikipedia.org/wiki/Lies,_damned_lies,_and_statistics

3 Likes

For those following along, this is a very interesting analysis of the UK numbers and that not only shows how high they probably really are but puts them into context with "normal" seasonal deaths.

From the economics editor of the Financial Times

Well fortunately this flow doesn't process death rates, just the number of positive test results in a defined area, which I would hope would be more accurate.
But as you say Julian, numbers always come with a story...

I think at some stage, they changed the data format for tests, instead of using the date that the result was determined, they claim that they use the date that the test was made... if I understand it correctly.

Sadly, this clearly isn't the case with plenty of reports now coming out about how hospitals and 111 are declining to test and sending people home for whatever reason. While this is still a complex issue, I can't help but feel that a review of all of this will result in people loosing jobs if not worse. The whole thing is a debacle that is resulting in unnecessary deaths.

2 Likes

This topic was automatically closed after 60 days. New replies are no longer allowed.