As a data savvy guy, I was was looking around for a one stop shop for historic timelines of the coronavirus. On top of that, I wanted to see how the data looks like against the generic mathematical model for viral spread, the logistic sigmoid function.
I first built the UI on some existing data APIs, but later I found none that is consistent enough. No one to blame, it is a rapidly evolving situation. So I decided to build my own data engine based on raw data from Johns Hopkins University
What it does
The front end provides a user friendly interface to browse and explore all known locations that have been affected by the virus. The dropdown menu allows you to browse through the various regions in the world. A logistic curve is fitted onto the actual data with a least square optimizer.
How I built it
The server side sits on a Django MVC backend. I've created a data processor to aggregate JHU's raw daily reports into time series correlated with locations. All data is saved and served from a mysql database with schemas defined in the Django model. The backend also has a curve fitting engine which computes logistic curve parameters give a set of input data points.
The front end leverages Materialize CSS as the main UI framework. Of course, all the heavy lifting in logic is done ins JS with the help of JQuery. The charts are plotted in chart.js.
Challenges I ran into
The biggest challenge of this project was to find a clean data source that would display the time series accurately and consistently. Initially, I leveraged my frontend off of existing open source APIs. However, due to the rapid changing nature of the situation, the existing data APIs can not provide a consistent data set over time. So I decided to build by own from JHU's raw data sets. My data processor is very robust and resilient against data format changes, key changes, etc.
Accomplishments that I'm proud of
Building a solid data processor, making the curve fitting algorithm robust against all sort of unclean data.
What I learned
Stay away from unreliable Data APIs. If you do end up building one, make sure you stay consistent from day to day. Use a database to properly manage your data, including avoiding duplicate entries, using unique ID to identify your entry, etc...
What's next for COVID-19 Timeline with Logistic Curve
I plan to run this app off of my website indefinitely