COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Share and discuss your flows and ideas with other users.

Moderator: Martin

User avatar
Desmanto
Posts: 2599
Joined: 21 Jul 2017 17:50

COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by Desmanto » 30 Mar 2020 19:41

COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Disclaimer : I am not responsible for any misusage in any form from this flow. The data provided by this flow is from external sources, can be checked below. Do not use this flow to mislead others into doing anything, or worse, something harmful. Be wise and let's stays informed and help each other with correct information.

Prologue
Since COVID-19 has became pandemic and it gonna stay several months more, I thought it will be useful to create a better flow than my first version here : viewtopic.php?f=3&t=8613
It is still based on the same data from John Hopkins CSSE, but I do much more calculation and add more features those might be helpful to all of us.
As it is a complete upgrade to previous version, I decided to separate it to new thread.

Download
COVID-19 Tracker v2.0
Import the flow and create shortcut to the home screen for quick access.

Source Data
The data query from https://www.arcgis.com/apps/opsdashboar ... 7b48e9ecf6
Coronavirus COVID-19 Global Cases by the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University (JHU)
If you want to view this in full information, you should open the link in browser

The main source of the json file is at
https://services1.arcgis.com/0MSEUqKaxR ... eHint=true
I change the record count to 1000 to cover more query result at once. As more countries get infected, the file is getting bigger. At the moment, It is approximately 80 Kb, and maybe will grow bigger as time passed. But it is still much faster than loading the whole website.
(if you want to find the json file yourself, use Chrome developer tools (F12), at the network tab, reload the tab, use search to find something like "Mainland China". You have a lot of json, use the one that show multiple countries. It takes a while to pick the good one.)


Flow Explanation
The flow has been redesigned with various of choices and branches. At bigger picture, we can split the flow concept into 4 parts
Flow COVID-19 Tracker v2.0.png
Flow COVID-19 Tracker v2.0.png (415.93 KiB) Viewed 1954 times
A. Variable declaration and json file
1. The first script define various choices, link to website, sorting method, action after showing data, url to download json file and the path to store it, and some function (yes, predefined function).
2. Check the json file, if longer than 1 hour, then redownload the json and store it.
3. Do looped calculation to convert the json into 3 lists : cov (store all provinces, linked to country), covc (group cov by country) and glo (total global worldwide cases). There is additional legacy covm (cov map based on country) for easier data access later.

The calculation is very similar to previous thread, but I added more percentage for comparison. {cov}, {covc} and {glo} will contains
0. Country : the country/region name. for covc, it is "WorldWide"
1. Province : province/state. For covc, it is the country name
2. Last Update : The last update data from the specific province. In covc, the last update is taken by the last one in that country. In glo, last data from all country
3. Latitude : For location calculation and map access later. For country, only the first region coordinate is taken, so it might be not accurate.
4. Longitude : For location calculation and map access later. For country, only the first region coordinate is taken, so it might be not accurate.
5. Confirmed : Total confirmed cases from the lab test
6. Recovered : Total recovered cases
7. Deaths : Total Deaths cases
8. Active : Total Active cases (ongoing, haven't finished yet)
9. Diagnosed : Number of death + recovered, means the case has been finished, not ongoing
10. Recovery : Recovery rate, Number of recovered divided by total Confirmed cases, in percentage
11. Mortality : Death Rate, number of death divided by total Confirmed cases, in percentage
12. Fatality : Sometimes called Case Fatality Rate. Different from Mortality, this is number of death divided by total Diagnosed (finished cases), in percentage.
13. Treatment : Number of active cases divided by confirmed cases, in percentage

Note : Some number doesn't added up properly, because some countries didn't report the recovered or active cases properly. (Example, Active + Diagnosed should added up equal to Confirmed, but that doesn't happen).

B. Main menu
input dialog wil show main menu of the flow.
1. Summary branches : show all summary only, summary with countries or provinces
2. 3, 5, 10, 20 Most : Show the top/bottom most countries defined by sorting method. This is for statistical purpose only. Countries with less than 100 confirmed cases are removed, so they don't skew the stat. Beware of this, as it can be misleading (I put warning there). Example : 5 Most - with sorting Confirmed, will show you the top 5 most confirmed cases.
3. Choose Country/province : is to choose per country/province and show only the data from those selected, including their total. When you choose single country only, and it has multiple provinces in the data, then the provinces data will be shown. This is useful for countries which report their province data. (Example : China, US, Autstralia, Canada, etc)
4. Search Country/province : provide a quick search and then lead to choose again
5. Watchlist branches : allow you to choose watchlist, copy, rename, and delete. This is for quicker access to your country or region. This use glovar as storage. To add watchlist, use the action after showing data (in the 3rd part). I have provided some example watchlist in the glovar.
6. Speak - Indonesian : Again, I include this for my own country. You can modify this to your country language or just english.
7. Link DB : provice a quick link to several websites. I include 3 english site and 3 for Indonesian sites. You can add your own in the linkdb map
8. Export csv : this is to export the {cov} as csv. Import it to excel and you can pivot the data or do more calculation
9. Refresh data : Force refresh data. By default I limit it to 1 hour, to prevent too many request to the server. But if you need the latest data right now (example, before exporting), then choose refresh data.

C. Sorting Method.
After choosing any menu you want, you need to choose the sorting menu. By default it is alphabetically (first). You can choose other. It should be self explanatory. Highest Confirmed means sort the data from the country/province which has the highest confirmed cases on top. This is useful especially when you filter several country, or when you select country with multiple provinces. Sorting by confirmed or mortality can show the "red zone" to avoid.

Even though you select only one choice or selecting summary total, you still have to select one of this menu. Although it is useless, as you only have 1 data to sort.

D. Action
After showing the data, you can choose Action to do more action to it. There are
1. Copy to Clipboard : Obviously, you can copy the data and use it somewhere.
2. Share to Whatsapp : I use Whatsapp, so I set up for it. You can use telegram or other too, just change the start activity
3. Add to Country/Province Watchlist : Depends on what you choose, you can add the shown data to the watchlist. So next time you simply choose the watchlist and it will show the latest data from the watchlist. Example, I save my own Southeast Asia, to compare my countries to our neighbour countries. Adding watchlist to the existing, will added up the element list. Adding new with the same name will rename it to _2.
4. Open Map Location : It will prompt another input dialog to choose one country/province only, then open it in google map
5. Calculate Distances : Calculate all shown data distances to current location.
6. Search in Google news ; Prompt another input dialog, choose one country/province, then search in google news. This is one of the fastest way to get the latest news on the selected data.


Footprint
This flow use 2 footprints on your phone.
1 glovar with the name : global_covid19, which is a map-list object. You can create it by executing the script provided.
1 json file to save the json file data : /storage/emulated/0/Automagic/Resources/covid-19.json Please create the folder /Resources/ if you don't have it yet. Or you can change it to other folder.
Both these can be changed in the first script element.


How to Read the data
For each data shown, I always compare the individual data to the summed data of the selected country/province, and then compared it again to the global data.
Example : I choose watchlist : EU, which consist of 27 countries (sorry if I miss your country)
Watchlist EU - Highest Confirmed.png
Watchlist EU - Highest Confirmed.png (211.25 KiB) Viewed 1954 times
- For the total, it shows the total confirmed of all those 27 countries. It still show the percentage, compared to the global confirmed cases. This way, even though you show the data partially, people still can see the global number.
- The recovery, mortality, fatality and treatment percentage also compared to global statistic.
- For each individual data, the similar abbreviation
C : Confirmed
R : Recovered
D : Deaths
A : Active
Di : Diagnosed
The percentage for these 5 are compared to group Confirmed case (in this example, EU watchlist), not global number. When you want to know Italy 100000 cases is how many percent compared to all EU 27 countries, this is the percentage to use.

Re : Recovery Rate
M : Mortality
F : Fatality
T : Treatment
The percentage for these 4 are the individual percentage to its own. So when you mention mortaility, this is the percentage to use.


Bug
If you encounter any miscalculation, please report here immediately. I don't want to mislead other with wrong data. Although we know some countries doesn't report accurate data. But at least we based our data on the reliable source.

So far, some errors found :
1. Active and Diagnosed data doesn't added up to Confirmed. Because some countries doesn't report Recovered or Active data properly
2. Some province in China has minus data, I don't know why. Until today still haven't fixed. This lead to some negative percentage for those region.


Analysis Usage
You can use this flow to get a better overview of all statistic. Example, in China, although it has 80000+ cases currently, about 80% of the cases (67000+) are from Hubei alone. The death cases also mostly comes from Hubei, up to 96%. All other provinces there have a much lower cases. Some provinces even have full recovery rate with no death at all. This show that the death cases mostly come from the massive outbreak and hospital limit. This is why we must really do our best to flatten the curve.

From Italy, you can see the mortality rate is about 11% (at current moment), while Germany only at less than 1%. Some opinions in the news stated that Germany has more hospital beds per 1000 people than Italy. And Italy has more older people currently. I don't know the exact reason, but this data can provide a basis for further study. The active treatment is still high, 70-80%, so can't make conclusion direclty. For comparison, China only has less than 4% Treatment percentage.

In my Country, we have one of the highest mortality rate, usually in 3rd to 5th place on the 10 Most - Mortality, around 8-9%. While global mortality rate is only at about 4-5%. Many people here believe our countries' confirmed cases should be much higher, because it doesn't matched up with the global percentage. It maybe because we can't make the test fast enough to cover all the suspected cases, or some may have been infected but afraid to report to official/hospital. This can be a big problem.

Please use the data wisely and only for beneficial purpose only.

Epilogue
I upgraded this flow so I can have better overview of the COVID-19 condition. So I don't get mislead by misinformation or hoax. With better data, I can also discuss better with my friends/families/coworkers.

Hopefully everyone stay safe. Keep Social distancing, avoid mass gathering, frequently wash our hands. Let's do our best to flatten the curve.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Desmanto
Posts: 2599
Joined: 21 Jul 2017 17:50

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by Desmanto » 30 Mar 2020 19:42

I reserved 2nd post for updates, bug report or other information.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Yam
Posts: 51
Joined: 23 Nov 2019 09:07

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by Yam » 31 Mar 2020 08:23

I love you 2x
Every life altering decision you have made, has lead to you reading this.

gilanxcheetz
Posts: 16
Joined: 08 Nov 2018 15:10
Contact:

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by gilanxcheetz » 06 Apr 2020 18:52

awesome !!!! :D
let me learn Automagic from this flow
From: Redmi 5 Plus (Vince)

Wibbly
Posts: 358
Joined: 17 Mar 2014 09:02

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by Wibbly » 07 Apr 2020 11:06

For those who like data have a look here https://ourworldindata.org/coronavirus-data

Includes normalization like 'per head of population' etc etc.

No flow to read the data, but it's exportable.

mays
Posts: 2
Joined: 17 Feb 2019 12:52

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by mays » 10 Apr 2020 07:03

Hello,
thanks for the Flow. I would like to test it, but I allways get an Error.
I Copied the text from the json file List (link) and created an file in this directory, but it is not working.
Screenshot_20200410_085734.jpg
Screenshot_20200410_085734.jpg (68.73 KiB) Viewed 1688 times

User avatar
Desmanto
Posts: 2599
Joined: 21 Jul 2017 17:50

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by Desmanto » 11 Apr 2020 18:04

@Wibbly : The link is provided in the flow too. Since some may prefer to get daily data or other statistics. I don't retrieve daily data version, since it will keep bigger and bigger, making the flow very slow. So better leave that for the link only.

Mine focus more on the percentage per country, to see how well each country report or work on it.

@mays : Try to create the file manually, blank one is ok. Where is your Automagic folder in the internal storage? (the place it store flows.xml). Try to change the path to that instead.

From time to time, the server might be in maintenance mode. So if you got small json with 0 data in all, that might be maintenance time. So far, I only encounter it maybe thrice, so maybe once or twice per month.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

mays
Posts: 2
Joined: 17 Feb 2019 12:52

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by mays » 13 Apr 2020 10:17

@mays : Try to create the file manually, blank one is ok. Where is your Automagic folder in the internal storage? (the place it store flows.xml). Try to change the path to that instead.

From time to time, the server might be in maintenance mode. So if you got small json with 0 data in all, that might be maintenance time. So far, I only encounter it maybe thrice, so maybe once or twice per month.
Now it's working!

Thanks

mays

Micky Micky
Posts: 112
Joined: 16 Oct 2019 17:38

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by Micky Micky » 23 May 2020 10:03

Hello,

Thanks for this. I only wanted cases & deaths for the UK but it helped.

In the url do you know how to specify just one country? I search your response for OBJECTID 385 which is the UK and then extract the data. Although the long way round it is fast enough.

Impressive flow BTW. I wouldn't want to try reverse-engineering it!

Many thanks

Micky
Crude but it works.

User avatar
Desmanto
Posts: 2599
Joined: 21 Jul 2017 17:50

Re: COVID-19 Tracker v2.0 (based on John Hopkins CSSE)

Post by Desmanto » 23 May 2020 20:47

@Micky : the url query is a SQL statement. You can change the first argument
where=Confirmed%20%3E%200&
to
where=Country_Region%3D%27United%20Kingdom%27&

This will give you
https://services1.arcgis.com/0MSEUqKaxR ... eHint=true

I also made another flow specific to my country. Our government have another website with another json file, with provinces data (which are not provided by John Hopkins). It is faster to retrieve, since the json file is smaller.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply