Skip to content

bilalajanjua/corona-graphql-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

corona-graphql-api

Get Latest Reports about coronavirus (COVID-19) using GraphQL API

corona-graphql-api

Get the updated statistics of Coronavirus or COVID-19 by using GraphQL API.

  • Worldwide Coronavirus Reports
  • Updated Daily
  • Get Statistics about total and new cases, deaths, recovered, active and critical coronavirus counts.
  • Know whether the cases, deaths, recovered etc. are increasing are decresing based on previous reports.
  • Get historical data of any country about Coronavirus.
  • Use the power of GraphQL and make your own dashboard to analyze the reports.

Note: The GraphQL API is developed using NovelCOVID API

GraphQL Endpoint

You can use the hosted GraphQL API from here: https://corona-graphql.herokuapp.com/.

Usage

Following are the examples your queries you can use while making request to GraphQL API:

Get Worldwide Statistics

query {
  all {
    cases
    deaths
    recovered
    active
    affectedCountries
    updated
    todayCases
    todayDeaths
    casesPerOneMillion
  }
}

Get Reports of All Countries

# Get reports of all countries without sorting

query {
  countries {
    country
    countryInfo {
      lat
      long
      flag
      iso3
    }
    cases
    todayCases
    deaths
    todayDeaths
    recovered
    active
    critical
    casesPerOneMillion
    deathsPerOneMillion
    analysis {
      cases
      recovered
    }
    updated
  }
}

Sorting: You can use cases, todayCases, deaths, todayDeaths, recovered, active, critical, casesPerOneMillion and deathsPerOneMillion as sorting string.

query {
  countries(sort: "deaths") {
    country
    countryInfo {
      lat
      long
      flag
      iso3
    }
    cases
    todayCases
    deaths
    todayDeaths
    recovered
    active
    critical
    casesPerOneMillion
    deathsPerOneMillion
    analysis {
      cases
      recovered
    }
    updated
  }
}

Get Historical Data of All Countries

query {
  historical {
    country
    province
    timeline {
      cases
      deaths
    }
  }
}

Get Sum of Cases, Deaths & Recovered Counts of All Countries Historical Data

query {
  worldwideHistoricalData {
    cases {
      date
      count
    }
    deaths {
      date
      count
    }
    recovered {
      date
      count
    }
  }
}

Get Report of a Country

# Change the name with your desired country.

query {
  country(name: "Italy") {
    deaths
    cases
    todayCases
    analysis {
      cases,
      todayCases,
    	recovered
    }
  }
}

Get Historical Data of a Country

query {
  historicalByCountry(name: "pakistan") {
    country
    province
    timeline {
      cases
      deaths
    }
  }
}

Get Reports of U.S. States

query {
  states {
    state
    cases
    todayCases
    deaths
    todayDeaths
    active
  }
}

Get Reports from Johns Hopkins CSSE Data Repository

query {
  jhucsse {
    country
    province
    updatedAt
    stats {
      confirmed
      deaths
      recovered
    }
    coordinates {
      longitude
      latitude
    }
  }
}

Documentation

GraphQL Playground is enabled so you can access that from here. The docs from playground will help you know more about the queries arguments and their return types.

Sources

  1. NovelCOVID API based on the data of Worldometer.

License

MIT