carlaiau / flatten-the-curve

COVID-19: By the numbers. Presenting country comparisons and adjustable cumulative graphs. Archived Project
https://5ef17a0632b0000008f04a5f--happy-mahavira-dd5860.netlify.app/
17 stars 4 forks source link
covid covid-19 gatsbyjs graphql jamstack new-zealand react

Flatten the Curve

This is a work in progress GatsbyJS application for using time-series data from

This site was initially aimed at motivating non technical or non scientific users to start taking the COVID-19 threat seriously, especially if they're in a country that currently has a low case load.

The ability to compare your own countries current case level and see how another country's infection has spread from a similar level seems to "click" for a lot of people, and therefore motivate change.

Since the inital launch the site has had over 10,000 visits. I am now seeing that 40% of the traffic is repeat meaning the initial goals of the project may switch into providing data hungry people better ways of viewing data, and a comprehensive area where we collate multiple segmented datasets into one.

I understand that the comparisons/projections are not the best way of looking at the outbreaks and could lead to incorrect outcomes, so I am actively working on getting data reformulated into culmulative confirmed / death so they can be used on the log graphs that are commonly seen.

Because the site is statically generated we have zero infrastructure costs, and netlify provide all COVID related projects with free hosting too! This is just a conversion of our time into potentially saved lifes by avoiding healthcare system overload.

Availability

I am working full time on this 2 days a week

What I'm Working On

Nice To Haves

Get Involved / Support

Open to all collaboration. I specifically need:

How To

If you want to play with the "stack" it is pretty simple assuming that you have node and npm installed.

Processing the data

The node data processing script may be useful for someone.

cd processing
npm install 
sh run.sh

Countries that show multiple provinces in the John Hopkins data are merged together and country population data is appended from /processing/data/population_world_bank.csv

This will create countries.json and cumulative.json files in client/data the formats are:

Countries.json

[
{
    "country_name": "Spain",
    "time_series": [
      ...,
      {
        "date": "2020-03-18T11:00:00.000Z",
        "confirmed": 17963,
        "deaths": 830,
        "recovered": 1107,
        "confirmed_per_mil": 384.45117064557473,
        "deaths_per_mil": 17.763985505529533,
        "recovered_per_mil": 23.692448138097824
      },
      {
        "date": "2020-03-19T11:00:00.000Z",
        "confirmed": 20410,
        "deaths": 1043,
        "recovered": 1588,
        "confirmed_per_mil": 436.82282429862386,
        "deaths_per_mil": 22.32269503887627,
        "recovered_per_mil": 33.98699877443482
      },
      {
        "date": "2020-03-20T11:00:00.000Z",
        "confirmed": 25374,
        "deaths": 1375,
        "recovered": 2125,
        "confirmed_per_mil": 543.0642990569957,
        "deaths_per_mil": 29.428289241088084,
        "recovered_per_mil": 45.48008337259067
      },
      {
        "date": "2020-03-21T11:00:00.000Z",
        "confirmed": 28768,
        "deaths": 1772,
        "recovered": 2575,
        "confirmed_per_mil": 615.7040181000887,
        "deaths_per_mil": 37.925038934696786,
        "recovered_per_mil": 55.111159851492225
      }
    ],
    "highest_confirmed": 28768,
    "highest_deaths": 1772,
    "highest_recovered": 2575,
    "population": 46723749
  },
]

Cumulative.json

[
  {
    "highest_confirmed": 28768,
    "population": 46723749,
    "country_name": "Spain",
    "confirmed": [
      ...,
      {
        "num_day": 18,
        "date": "2020-03-19T11:00:00.000Z",
        "confirmed": 20410
      },
      {
        "num_day": 19,
        "date": "2020-03-20T11:00:00.000Z",
        "confirmed": 25374
      },
      {
        "num_day": 20,
        "date": "2020-03-21T11:00:00.000Z",
        "confirmed": 28768
      }
    ],
    "deaths": [
      ...,
      {
        "num_day": 13,
        "date": "2020-03-19T11:00:00.000Z",
        "deaths": 1043
      },
      {
        "num_day": 14,
        "date": "2020-03-20T11:00:00.000Z",
        "deaths": 1375
      },
      {
        "num_day": 15,
        "date": "2020-03-21T11:00:00.000Z",
        "deaths": 1772
      }
   ]
}

Client

Built in gatsby, pretty hacky react.

To run local development:

cd client
npm install
npm run develop

Gatsby will automatically load the countries data into GraphQL based on the above two files