Skip to content

Latest commit

 

History

History
243 lines (181 loc) · 6.41 KB

README.md

File metadata and controls

243 lines (181 loc) · 6.41 KB

Novel coronavirus (2019-nCoV) Outbreak Tracking Dashboard

The case data visualized is collected from various sources, including WHO, U.S. CDC, ECDC, China CDC (CCDC), NHC, and DXY.

DXY is a Chinese website that aggregates NHC and local CCDC situation reports in near real-time, providing more current regional case estimates than the national level reporting organizations are capable of, and is thus used for all the mainland China cases reported in our dashboard (confirmed, suspected, recovered, deaths).

U.S. cases (confirmed, suspected, recovered, deaths) are taken from the U.S. CDC, and all other country (suspected and confirmed) case data is taken from the corresponding regional health departments.

The dashboard is intended to provide the public with an understanding of the outbreak situation as it unfolds, with transparent data sources.

Public Dashboard

How to use:

Get Vizion Elasticsearch Credentials

Go to: Vizion.ai

  1. Create a free account.
  2. Select Elasticsearch from the Marketplace and follow through the onboarding process
  3. Generate a stack with a relevant name
  4. Copy and save the Credentials in a safe space!

Download Application:

In a Bash terminal run the following command:

git clone https://github.com/themarcusaurelius/coronaVirus.git

Install Dependencies:

CD into the directory and run the command:

npm install

Open The Directory In A Code Editor

Create a file called 'config.js' in the root directory and add the following code substituting the 'API_ENDPOINT' with the Elasticsearh API Endpoint that was generated when you created your stack. Save.

const config = {
    Elasticsearch: {
        API_ENDPOINT: 'YOUR_ELASTICSEARCH_API_ENDPOINT_GOES_HERE'
    }
}

module.exports = config

Start The Node.js Server

Open a terminal in the code editor and run the following command in the root directory:

npm run server

Create Mapping Types For Data

Go to: Kibana

  1. Enter the Username and Password that was generated when you created your stack
  2. Click on the DevTools tab.

Create the 1st index:

PUT corona-virus

Create the 1st index mappings:

PUT corona-virus/_mappings/_doc 
{
  "properties" : {
    "Confirmed" : {
      "type" : "long"
    },
    "Country_Region" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "Deaths" : {
      "type" : "long"
    },
    "Last_Update" : {
      "type" : "date"
    },
    "Latitude" : {
      "type" : "float"
    },
    "Location" : {
      "type" : "geo_point"
    },
    "Longitude" : {
      "type" : "float"
    },
    "OBJECTID" : {
      "type" : "long"
    },
    "Province_State" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "Recovered" : {
      "type" : "long"
    }
  }
}

Create the 2nd index:

PUT corona-virus-totals

Create the 2nd index mappings:

PUT corona-virus-totals/_mappings/_doc 
{
  "properties": {
    "Last_Update": {
      "type": "date"
    },
    "Mainland_China" : {
      "type" : "long"
    },
    "OBJECTID" : {
      "type" : "long"
    },
    "Other_Locations" : {
      "type" : "long"
    },
    "Report_Date" : {
      "type" : "date",
      "ignore_malformed" : true
    },
    "Report_Date_String" : {
      "type" : "date",
      "format" : "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
    },
    "Total_Confirmed" : {
      "type" : "long"
    },
    "Total_Recovered" : {
      "type" : "long"
    }
  }
}

Upload Dashboard and Visuals to Kibana

  1. Click on the Management tab and then click on Saved Objects
  2. Import the kibana.json file located in the root directory of your project folder.

Seed The Elasticsearch Database

Make Sure The Server Is Still Running

There are two different data sources included in this application. The first one is overall daily totals of confirmed cases. This one is updated daily once. To seed all Totals data up to the current day, open a broswer and go to the following link:

localhost:5002/api/data/virus-totals

Hit enter and the data will be sent up to Elasticsearch:

In your terminal you will see the following messages if everything was indexed into Elasticsearch successfully:

Now, It is time to run the recurring data ingestion. In the broswer, as before, enter the following"

http://localhost:5002/api/data/virus

This will run a revolving check every two minutes for new data and will ingest it into Elasticsearch automatically as long as the server is running. You can watch in the terminal in real-time every two minutes for the data check.

Note: This one will take a few minutes to begin populating data into Elasticsearch.

View The Dashboard In Kibana

Back in Kibana, go to the Dashboards tab and click on the Corona-Virus dashboard to open it. You may need to change the Time Range To a longer period to include all the data that has been collected to get an accurate overall view of the ongoing outbreak situation, as well as the Refresh Interval to 5 seconds to always have an up-to-date-dashboard.

Nearly everything is clickable and the dashboard will dynamically adjust based on what you jave clicked on so play around with the data and see what you can discover!