GithubHelp home page GithubHelp logo

freakyfelt / gatsby-source-mathdroid-covid19 Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 0.0 3.18 MB

Provides data from @mathdroid 's API for consumption within Gatsby

JavaScript 0.04% TypeScript 99.96%
gatsby gatsby-source covid-19 covid19 typescript

gatsby-source-mathdroid-covid19's Introduction

gatsby-source-mathdroid-covid19

Provides a Gatsby source plugin for the API made possible by mathdro.id's excellent work.

Getting Started

Add the plugin to your gatsby-config.js file along with a list of countries whose data you want to fetch (if any).

module.exports = {
  ...
  plugins: [
    {
      resolve: 'gatsby-source-mathdroid-covid19',
      options: {
        countries: [{ iso2: 'DE' }], // fetch current stats for DE (Germany)
        
        // dailySummary: true /* enables global stats by day. defaults to false. */
        daily: {
          relativeDays: 14 // fetch 14 days worth of province-level data
        }
      },
    }
  ]
}

From there you will have GraphQL nodes available like the following:

query MyQuery {
  covid19GlobalSummary {
    confirmed
    recovered
    deaths
    image
  }
  allCovid19CountrySummary {
    nodes {
      country
      confirmed
      recovered
    }
  }
  allCovid19ProvinceStateDetail(filter: {iso2: {eq: "US"}}, limit: 5, sort: {order: DESC, fields: [confirmed]}) {
    nodes {
      provinceState
      confirmed
      recovered
      deaths
    }
  }
}

Plugin Options

See the Covid19PluginOptions type in src/nodes/types.ts

Contributing

This plugin is still pretty barebones, so pull requests are more than welcome.

Ways to help

  • Get Jest up and running with some tests
  • Dynamically fetch data from the Gatsby GraphQL queries?
  • Make the Gatsby GraphQL nodes feel more native
  • Nest related data structures in GraphQL

Supporting

Donate to mathdro.id or Johns Hopkins for their hard work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.