GitHub: https://github.com/covid19datahub/node

Import Data from the Hub

Download the data from the here.

Libraries axios (for online data fetching) and csv-parse (for csv parsing). Install them by

npm i -g axios csv-parse

Once installed, fetch the data:

const axios = require('axios');
const parse = require('csv-parse/lib/sync')

const dataCOVID19 = async () => {
    // download
    let resp = await axios.get('https://storage.covid19datahub.io/data-1.csv')
    let data = unescape(resp.data)
    // parse
    return parse(data, {
        columns: true,
        skip_empty_lines: true
    })
}
// call
let dataPromise = dataCOVID19();
// set callback for data
dataPromise.then((results) => {
    for(r in results) {
        let result = results[r] 
        console.log(result)
    }
})

Terms of Use

We have invested a lot of time and effort in creating COVID-19 Data Hub, please:

License: GPL-3.

Comments