Corona Virus Houdini Graph Tools

If you want to skip all the bla bla part and go to the gimme the stuff part, click HERE.
 
In this crazy time of uncertainty and tragedy caused by Covid-19, the real and only question to answer is really this : when is this going to end ?

I am not an epidemiologist or a data analyst , so please take all that follows with a grain of salt and keeping in mind I'm just a geek in search for answers and I worked on this little project for a couple of days, killing some of the time I've plenty of in these days.
 
We know that Corona virus (any virus maybe ?) grows exponentially. But what does this really mean ? I found a few answers watching these videos that I strongly recommend, this time not only to learn something new, but also to help giving some sense to immense amount of data concerning this pandemic.

How To Tell If We're Beating COVID-19

Exponential Growth and Epidemics

The first of the two videos is plotting the data in a way that you don't generally find online on Covid-19 statistics web sites: not only it plots data in a logarithmic scale, but it doesn't plot it against time.
Long story short, if I am not mistaken, to convert a regular value-time graph into a new-total (not sure how this type of graphs is names, please let me know if you do), this is how you do it:

X axis = log10 (total value X)
Y axis = log10 (total value today - total value yesterday)

Watching the video it seems like the data plotted this way show clearly when the virus is about to start switching from an exponential growth ... to a Sigmoid or Logistic Curve

More about Exponential Growth vs Logistic Curve here :
 
Days ago a friend of mine sent me a link to this github archive:

JSON time-series of coronavirus cases (confirmed, deaths and recovered) per country - updated daily since 2020-1-22.

Click on the actual data set below to take a look.


So I decided to create a tool to plot these curves in Houdini, grabbing the data directly from the net.

Disclaimer :
I am not responsible for the data contained in the above mentioned repository. I am just reading it and visualizing it using Houdini. It is very likely that at some point, hopefully soon (and hopefully for a good reason), this repository will stop being updated.

The code to download the data from the github and store it in points is really short. See for yourself.


Once you run this code in a Python SOP, you get ALL the data from the repository stored on attributes in points.

To be more precise, I created one point for each Json item. Each point stores the data in the following attributes:

i@__rona__confirmed
s@__rona__country
s@__rona__date
i@__rona_deaths
i@__rona_recovered


I wrapped this python script into an HDA named ...

Rona Import Data


This guy needs no parameters. All it does is download the latest data on the github repo. All you need to do is drop the node.
Now we can play with the data.

Rona Filter


Self explanatory.
The parameter "Country (Regex)" accepts a regular expression string.
Example:

.* means 'don't filter anything', it's like don't using this node at all |:)
Italy will keep only data about Italy
(Italy|US|Spain) will keep data from Italy and US


Use this node immediately after a Rona Import SOP. Or don't use it at all if you want to keep all countries.


Rona Plot


This is where the fun starts.
And ends too, pretty much, really.
This node plots all the data incoming in the input (curves only, no axis, text etc).

The output of this node are polylines with prim attributes:
prim attr s@__rona_country ( a string indicating the country )
prim attr s@__rona_data (can be "deaths", "recovered" or "confirmed")
prim attr i@__rona_graph (can be 0 for time-value graph, and 1 for trend graph)
prim attr i@__rona_graph_scale (graph Y scale)
 
Parameters:
Data : you can choose between
  • Deaths - total number of deaths accumulated per day
  • Recovered - total number of recovered accumulated per day
  • Confirmed - total number of confirmed cases accumulated per day
Graph: you can choose between
  • Time-Linear - the good old time-value we're used to
  • Trend-Log - the graph I mentioned earlier. Will show if things are going better or not really.
  • Scale : sometimes the y values are huge. Sadly. We need to scale the Y axis to fit it in the screen.
Filter - Strength : daily values are pretty erratic. Use some filter to smooth the curves and let the meaning emerge.
Filter - Filter Quality : the higher this value, the more the smoothed curve will stay close to the original curve. 

Use this node immediately after a Rona Import SOP, or a Rona Filter SOP.

Rona Decorators

This node takes care of adding axis, text, etc to the curves. Cause without metrics nothing makes sense.

NOTE :
I lied. The TREND graph actually doesn't really need metrics, since the meaningful part is the shape of the curve.
And since I didn't really know what units to write in there.
And I have been a little lazy, I admit.

ANOTHER NOTE:
You can merge together many curves upstream before feeding this node, just make sure the curves are coming from the same graph typs (linear or log) and they all have the same scale.


Parameters:

 

Plots Examples

These are all contained in the example hip file (link at the end of this article).
 
Filters Italy, Spain and France and plot the deceased data over time.


Filters the 5 countries with the largest number of deceased and plots the data over time.


Filters the 8 countries with the largest number of deceased, plots the data and creates a grid layout.

Trend plot.

If you're interested you can download the OTLs and an example Hip file from HERE.

Leave comments , opinions and suggestions.
Thank you for reading.
 

No comments:

Post a Comment

Featured Post

Corona Virus Houdini Graph Tools

If you want to skip all the bla bla part and go to the gimme the stuff part, click HERE .   In this crazy time of uncertainty and trag...

Most Popular