Novel coronavirus charts and numbers

Hi all,

here a small definition that uses Python and GH to query public databases for coronavirus cases and provides that data for further analysis. It’s inspired by this video by Luciano Ambrosini.

The data of some countries actually starts to look quite good.

There’s also a part that uses JSON to query the Italian more-up-to-date repository. It will prove useful for a sample in case your local data is provided in that format.
Finally, this definition purposely does not use any add-ons. However, your charts will look more beautiful with some third-party library, for example Human UI.

Note: any responsibility on decisions taken based on this data or definition is disclaimed. (15.8 KB)


Giulio Piacentino
for Robert McNeel & Associates


If you find it useful and edit this, please feel free to post your improvements here.

Hi Giulio,

Thanks for sharing!

I added a list to easily scroll through to find the index of each country
And I put the max values for each graph to get some reference. (19.8 KB)

Take care everyone!


@piac @Willem what are the lower two graphs representing?

First and second derivative.

It’s the (here daily) increment of the number of the first graph (1st derivative) and the rate by which the increment is modifying (2nd derivative). These show the trends, basically. They suffer of statistical error.

1 Like

The derivative tells you how a function (in this case a sampled distribution) change at any position. If A and B are points, the change from A to B is (A-B) / dt, where dt is the change in time. So in case of the change of a position, the derivative is its velocity. And the derivative of the derivative, or second derivative, is how its velocity changes, ie, its acceleration.


Thanks @piac! Here’s an update that combines combines US counties into state summaries when join_regions is false, and rolls up by country when join_regions is true. Early data in the US was by county, and is now aggregated by state, so the overall time-period graphs for either didn’t make sense. (17.7 KB)

Thanks @piac
Here is a small Gh contribution to make fancy graphs…
I used Log scaling for heights.

Cheers (32.5 KB)


small update !!

It now also works for death cases and recoveries ! Also displays the selection in tiltle ! (30.5 KB)

1 Like

I wonder why these numbers are higher, while the source is the same?

update rate

Last update :

you can highlight your or any country super easily.

You will need Human plugin (37.0 KB)


the c# component isnt working, line 22 error.
pls help


Ok so these (python) components are from Giulio Piacentino… I’m not on the same python level :upside_down_face:

But as I understand it, there is a mistake in the data, where information is missing (empty spot in one list that does not convert to integer). That maybe could be fixed by some python magicians (any idea @piac ?)

While waiting for that, as a python noob, when there are errors, I simply pass them :sweat_smile:
Here is a working version… This should be ok, but I don’t really know what is being thrown by my “try/except” combo. (if anyone could enlighten me, please do !) (39.1 KB)

from io import StringIO as s
import csv
import ghpythonlib.treehelpers as th

f = s(x)
reader = csv.reader(f, delimiter=',')

results = dict()

count = -1
for row in reader:
    count += 1
    if count == 0: continue
    Province_State_Country = row[1] if join_regions else row[0]
    if not Province_State_Country: Province_State_Country = row[1]
    if not join_regions and Province_State_Country != row[1]: Province_State_Country = row[1] + ", " + Province_State_Country
    raw_vals = row[4:]
    if Province_State_Country in results:
        prevs = results[Province_State_Country]
            extra = [(int(c) + prevs[i]) for (i,c) in enumerate(raw_vals)]
        except (ValueError):
        values = extra
            values = [int(c) for c in raw_vals]
    results[Province_State_Country] = values

results = sorted(results.items(), key = lambda kv: kv[0])
a = [n[0] for n in results]
b = th.list_to_tree([n[1] for n in results])

Just updated AMA’s file with the new modified source in the CSSEGISandData repository. (38.3 KB)

1 Like

Guys! is there any way to updated the source files?
thanks in advance!