I have found a cool github repository maintained by Our World in Data that is also reporting the total tests performed per day.
Based on this I have created a node-red flow that allows to compare percentage of confirmed cases (with respect to the tests performed) over time between 2 countries.
E.g. a comparison between the US and Italy.
Observations
- The first chart clearly shows that Italy is on the right track and is currently in a way better situation than the US.
- For the US the % of new cases is hardly decreasing since the last 3 weeks which is concerning.
Remind that in Hubei (China) they only gradually started reopening schools when no confirmed cases were being reported for a period of more than 2 weeks (in other words the top chart was 0% for 2 weeks). Most countries are months away from the 0%.
Here below the flow which you can also copy from janvda/node-red-covid-our-world-in-data:
[{"id":"3a9fb996.bbe926","type":"tab","label":"owid-covid-data","disabled":false,"info":""},{"id":"c3387945.6987c8","type":"inject","z":"3a9fb996.bbe926","name":"Run flow","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":140,"y":100,"wires":[["c010259.2cf98d8","bddf1478.9b09c8"]]},{"id":"c010259.2cf98d8","type":"http request","z":"3a9fb996.bbe926","name":"get owid-covid-data.csv","method":"GET","ret":"txt","paytoqs":false,"url":"https://github.com/owid/covid-19-data/raw/master/public/data/owid-covid-data.csv","tls":"","persist":false,"proxy":"","authType":"","x":390,"y":100,"wires":[["4c5e0107.81dd"]]},{"id":"4c5e0107.81dd","type":"csv","z":"3a9fb996.bbe926","name":"csv2array","sep":",","hdrin":true,"hdrout":false,"multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"x":580,"y":100,"wires":[["99fb2113.37e54","c8dbff0d.cef35"]]},{"id":"c826db11.2bca08","type":"ui_chart","z":"3a9fb996.bbe926","name":"","group":"828b3fe0.ce8ff","order":1,"width":13,"height":6,"label":"%new cases (with respect to new tests)","chartType":"line","legend":"true","xformat":"D/M","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"8","removeOlderPoints":"1000","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#942192","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":840,"y":660,"wires":[[]]},{"id":"99fb2113.37e54","type":"debug","z":"3a9fb996.bbe926","name":"owid-covid-data json","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":800,"y":100,"wires":[]},{"id":"c8dbff0d.cef35","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"covid_data","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":160,"wires":[["bc39bac.e135f48","9b88f1d0.e8c99","185638b4.45eab7"]]},{"id":"f211e551.667b68","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"location1","pt":"msg","to":"location1","tot":"flow"},{"t":"set","p":"location2","pt":"msg","to":"location2","tot":"flow"},{"t":"set","p":"covid_data","pt":"msg","to":"covid_data","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"(\t $location1 := location1;\t $location2 := location2;\t {\t \"location1\" : \t covid_data[location=$location1 and new_tests>0].{\t \"date\" : date,\t \"new_cases\" : new_cases,\t \"new_tests\" : new_tests,\t \"positive_test_percentage\" : $round(\t new_cases / new_tests * 100 ,2),\t \"total_cases\" : total_cases,\t \"total_tests\" : total_tests,\t \"population_in_thousand\": ($location1=\"United Kingdom\" ? 66573:\t total_cases*1000/total_cases_per_million)\t },\t \"location2\": covid_data[location=$location2 and new_tests>0].{ \t \"date\" : date, \t \"new_cases\" : new_cases, \t \"new_tests\" : new_tests, \t \"positive_test_percentage\" : $round(new_cases / new_tests * 100 ,\t 2\t ),\t \"total_cases\" : total_cases,\t \"total_tests\" : total_tests,\t \"population_in_thousand\": ($location2=\"United Kingdom\" ? 66573:\t total_cases*1000/total_cases_per_million)\t }\t }\t)\t/* see https://try.jsonata.org/WEDEzGOBb */","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":460,"wires":[["d6412970.f37978","ce16a18e.14da5"]]},{"id":"d6412970.f37978","type":"debug","z":"3a9fb996.bbe926","name":"covid data for location1 and location2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":850,"y":460,"wires":[]},{"id":"d04b500a.baa45","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\t {\t \"series\": [location1, location2],\t \"data\": [\t [\t payload.location1.{\t \"x\" : $toMillis(date),\t \"y\" : positive_test_percentage \t }\t ],\t [\t payload.location2.{\t \"x\" : $toMillis(date),\t \"y\" : positive_test_percentage \t }\t ]\t ],\t \"labels\": [\"\"]\t}\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":660,"wires":[["c826db11.2bca08","f19b43a3.24f15"]]},{"id":"f19b43a3.24f15","type":"debug","z":"3a9fb996.bbe926","name":"chart1 input","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":750,"y":620,"wires":[]},{"id":"44dcda4e.51f944","type":"ui_chart","z":"3a9fb996.bbe926","name":"","group":"828b3fe0.ce8ff","order":2,"width":13,"height":5,"label":"new tests per thousand (population)","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":["#942192","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":830,"y":700,"wires":[[]]},{"id":"9476a458.94ece8","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\t {\t \"series\": [location1, location2],\t \"data\": [\t [\t payload.location1.{\t \"x\" : $toMillis(date),\t \"y\" : new_tests_per_thousand \t }\t ],\t [\t payload.location2.{\t \"x\" : $toMillis(date),\t \"y\" : new_tests_per_thousand\t }\t ]\t ],\t \"labels\": [\"\"]\t}\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":700,"wires":[["44dcda4e.51f944"]]},{"id":"5819eb08.df1c14","type":"ui_chart","z":"3a9fb996.bbe926","name":"","group":"828b3fe0.ce8ff","order":3,"width":13,"height":"5","label":"new (confirmed) cases per thousand (population)","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":["#942192","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":870,"y":740,"wires":[[]]},{"id":"d308a880.137648","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\t {\t \"series\": [location1,location2],\t \"data\": [\t [\t payload.location1.{\t \"x\" : $toMillis(date),\t \"y\" : new_cases_per_thousand\t }\t ],\t [\t payload.location2.{\t \"x\" : $toMillis(date),\t \"y\" : new_cases_per_thousand\t }\t ]\t ],\t \"labels\": [\"\"]\t}\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":740,"wires":[["5819eb08.df1c14"]]},{"id":"cdd81598.25c3b8","type":"ui_dropdown","z":"3a9fb996.bbe926","name":"location1 dropdown","label":"location1","tooltip":"","place":"Select option","group":"7075490e.7cac28","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":540,"y":260,"wires":[["2203fb23.dd7704"]]},{"id":"bc39bac.e135f48","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"payload[new_tests>0].location ~> $distinct ~> $sort","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":300,"wires":[["2753fa25.e238a6","6af92528.bf095c"]]},{"id":"2203fb23.dd7704","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"location1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":260,"wires":[["8ba29581.5d84f8"]]},{"id":"2753fa25.e238a6","type":"change","z":"3a9fb996.bbe926","name":"set to Belgium","rules":[{"t":"set","p":"payload","pt":"msg","to":"Belgium","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":260,"wires":[["cdd81598.25c3b8"]]},{"id":"6af92528.bf095c","type":"change","z":"3a9fb996.bbe926","name":"set to Italy","rules":[{"t":"set","p":"payload","pt":"msg","to":"Italy","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":320,"wires":[["efd55a63.c3a458"]]},{"id":"efd55a63.c3a458","type":"ui_dropdown","z":"3a9fb996.bbe926","name":"location1 dropdown","label":"location2","tooltip":"","place":"Select option","group":"7075490e.7cac28","order":2,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":540,"y":320,"wires":[["39013f83.273c5"]]},{"id":"39013f83.273c5","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"location2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":320,"wires":[["d35aba75.cd02f8"]]},{"id":"c5ba297f.3149a8","type":"ui_button","z":"3a9fb996.bbe926","name":"","group":"7bc90a44.ed8dd4","order":1,"width":0,"height":0,"passthru":false,"label":"retrieve owid-covid-data","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":60,"wires":[["c010259.2cf98d8"]]},{"id":"d35aba75.cd02f8","type":"switch","z":"3a9fb996.bbe926","name":"flow.location1 not null ?","property":"location1","propertyType":"flow","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":480,"wires":[["f211e551.667b68"]]},{"id":"8ba29581.5d84f8","type":"switch","z":"3a9fb996.bbe926","name":"flow.location2 not null ?","property":"location2","propertyType":"flow","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":440,"wires":[["f211e551.667b68"]]},{"id":"ce16a18e.14da5","type":"change","z":"3a9fb996.bbe926","name":"running average","rules":[{"t":"set","p":"running_average_days","pt":"msg","to":"running_average_days","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"(\t $x := running_average_days;\t{\t \"location1\" : payload.location1 ~> $map( function($v, $i, $a) \t { \t (\t $v_min_x := $a[$i-$x]; /* take care this is circular !*/\t $new_cases := ($v.total_cases - $v_min_x.total_cases)/$x;\t $new_tests := ($v.total_tests - $v_min_x.total_tests)/$x;\t \t {\t \"date\" : ($toMillis($v.date) + $toMillis($v_min_x.date))/2 ~> $fromMillis(),\t \"new_cases_per_thousand\" : $new_cases/$v.population_in_thousand,\t \"new_tests_per_thousand\" : $new_tests/$v.population_in_thousand,\t \"positive_test_percentage\": $new_cases*100/$new_tests ~> $round(2)\t }\t )\t }) ~> $filter (function($v, $i, $a) { $i>=$x}),\t \"location2\": payload.location2 ~> $map( function($v, $i, $a) \t { \t (\t $v_min_x := $a[$i-$x]; /* take care this is circular !*/\t $new_cases := ($v.total_cases - $v_min_x.total_cases)/$x;\t $new_tests := ($v.total_tests - $v_min_x.total_tests)/$x;\t \t {\t \"date\" : ($toMillis($v.date) + $toMillis($v_min_x.date))/2 ~> $fromMillis(),\t \"new_cases_per_thousand\" : $new_cases/$v.population_in_thousand,\t \"new_tests_per_thousand\" : $new_tests/$v.population_in_thousand,\t \"positive_test_percentage\": $new_cases*100/$new_tests ~> $round(2)\t }\t )\t }) ~> $filter (function($v, $i, $a) { $i>=$x})\t \t}\t)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":520,"wires":[["d04b500a.baa45","9476a458.94ece8","d308a880.137648","529b9278.947aac"]]},{"id":"529b9278.947aac","type":"debug","z":"3a9fb996.bbe926","name":"running average","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":760,"y":520,"wires":[]},{"id":"4b0da2ab.fc904c","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"running_average_days","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":40,"wires":[["f211e551.667b68"]]},{"id":"bddf1478.9b09c8","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"7","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":40,"wires":[["a3a09f70.89765"]]},{"id":"15636a9d.bbd545","type":"ui_text_input","z":"3a9fb996.bbe926","name":"","label":"max date in data set","tooltip":"","group":"7bc90a44.ed8dd4","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":1060,"y":160,"wires":[[]]},{"id":"9b88f1d0.e8c99","type":"change","z":"3a9fb996.bbe926","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$max(payload.$toMillis(date))~>$fromMillis()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":160,"wires":[["15636a9d.bbd545"]]},{"id":"79b611ae.ae3ec","type":"ui_text_input","z":"3a9fb996.bbe926","name":"","label":"last time date retrieved","tooltip":"","group":"7bc90a44.ed8dd4","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":1140,"y":220,"wires":[[]]},{"id":"185638b4.45eab7","type":"change","z":"3a9fb996.bbe926","name":"get timestamp","rules":[{"t":"set","p":"payload","pt":"msg","to":"$now()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":220,"wires":[["79b611ae.ae3ec"]]},{"id":"a3a09f70.89765","type":"ui_slider","z":"3a9fb996.bbe926","name":"","label":"running average number of days:","tooltip":"","group":"7075490e.7cac28","order":3,"width":0,"height":0,"passthru":true,"outs":"end","topic":"","min":"1","max":"20","step":1,"x":700,"y":40,"wires":[["4b0da2ab.fc904c"]]},{"id":"828b3fe0.ce8ff","type":"ui_group","z":"","name":"charts","tab":"e3251669.740868","order":2,"disp":false,"width":"13","collapse":false},{"id":"7075490e.7cac28","type":"ui_group","z":"","name":"Filter","tab":"e3251669.740868","order":1,"disp":true,"width":"6","collapse":false},{"id":"7bc90a44.ed8dd4","type":"ui_group","z":"","name":"github","tab":"e3251669.740868","order":3,"disp":true,"width":"6","collapse":false},{"id":"e3251669.740868","type":"ui_tab","z":"","name":"owid-covid-data","icon":"dashboard","order":9,"disabled":false,"hidden":true}]
Any feedback, comments, improvements suggestions are more than welcome.
Jan.