Convert Figma logo to code with AI

mathdroid logocovid-19-api

COVID-19 global data (from JHU CSSE for now) as-a-service

1,356
283
1,356
71

Top Related Projects

2,459

API for Current cases and more stuff about COVID-19 and Influenza

1,227

JSON time-series of coronavirus cases (confirmed, deaths and recovered) per country - updated daily

29,136

Novel Coronavirus (COVID-19) Cases, provided by JHU CSSE

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!

Quick Overview

The mathdroid/covid-19-api is a GitHub repository that provides a REST API for COVID-19 data. It serves as a wrapper around multiple data sources, offering up-to-date information on COVID-19 cases worldwide. The API is built using Vercel's serverless functions and is designed to be easily integrated into various applications.

Pros

  • Easy to use and integrate with existing applications
  • Provides data from multiple reliable sources
  • Regularly updated to ensure accuracy of information
  • Free to use and open-source

Cons

  • May experience rate limiting or downtime during high traffic periods
  • Depends on external data sources, which could potentially affect data availability
  • Limited historical data compared to some other COVID-19 data APIs
  • Lacks advanced querying capabilities for complex data analysis

Code Examples

  1. Fetching global COVID-19 data:
const response = await fetch('https://covid19.mathdro.id/api');
const data = await response.json();
console.log(data);
  1. Getting data for a specific country:
const country = 'USA';
const response = await fetch(`https://covid19.mathdro.id/api/countries/${country}`);
const data = await response.json();
console.log(data);
  1. Retrieving daily summary data:
const response = await fetch('https://covid19.mathdro.id/api/daily');
const data = await response.json();
console.log(data);

Getting Started

To use the COVID-19 API in your project, follow these steps:

  1. Make sure you have a way to make HTTP requests in your application (e.g., fetch API, axios, etc.).

  2. Use the base URL https://covid19.mathdro.id/api for your requests.

  3. Make a GET request to the desired endpoint. For example, to get global data:

async function getGlobalData() {
  try {
    const response = await fetch('https://covid19.mathdro.id/api');
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Error fetching data:', error);
  }
}

// Usage
getGlobalData().then(data => console.log(data));
  1. Refer to the API documentation in the repository for more endpoints and options.

Competitor Comparisons

2,459

API for Current cases and more stuff about COVID-19 and Influenza

Pros of disease-sh/API

  • More comprehensive data coverage, including historical data and vaccine information
  • Supports multiple data sources, offering greater reliability and cross-verification
  • Provides additional endpoints for country-specific data and global statistics

Cons of disease-sh/API

  • Potentially more complex to use due to its broader scope and feature set
  • May have higher latency due to aggregating data from multiple sources
  • Requires more frequent updates to maintain accuracy across diverse data points

Code Comparison

covid-19-api:

const data = await api.countries({countries: ['USA', 'China']});
console.log(data);

disease-sh/API:

const data = await api.countries(['USA', 'China']);
const historical = await api.historical.countries(['USA', 'China'], 30);
console.log(data, historical);

The code snippets demonstrate that disease-sh/API offers more granular control over data retrieval, including historical data, while covid-19-api provides a simpler interface for basic country data.

1,227

JSON time-series of coronavirus cases (confirmed, deaths and recovered) per country - updated daily

Pros of covid19

  • Simpler data structure with a focus on time series data
  • Includes a visualization tool for data exploration
  • Offers data in both JSON and CSV formats

Cons of covid19

  • Less frequent updates (daily vs. hourly for covid-19-api)
  • Fewer data points and less granular information
  • Limited to global and country-level data, lacking regional breakdowns

Code Comparison

covid19:

fetch("https://pomber.github.io/covid19/timeseries.json")
  .then(response => response.json())
  .then(data => {
    data["Argentina"].forEach(({ date, confirmed, recovered, deaths }) =>
      console.log(`${date} active cases: ${confirmed - recovered - deaths}`)
    )
  })

covid-19-api:

const api = require('covid19-api');
api.getReports()
  .then((result) => {
    console.log(result);
  })
  .catch((error) => {
    console.log(error);
  });

The covid19 repository provides a simple fetch-based approach for accessing time series data, while covid-19-api offers a more structured API with various endpoints for different types of data. covid19 focuses on ease of use for time series analysis, whereas covid-19-api provides more comprehensive and up-to-date information across multiple categories.

29,136

Novel Coronavirus (COVID-19) Cases, provided by JHU CSSE

Pros of COVID-19

  • Comprehensive dataset: Provides detailed global COVID-19 data, including cases, deaths, and recoveries
  • Regular updates: Data is updated daily, ensuring up-to-date information
  • Official source: Maintained by Johns Hopkins University, a trusted authority in COVID-19 tracking

Cons of COVID-19

  • Raw data format: Requires processing to be used in applications
  • Limited API functionality: Does not provide a ready-to-use API for developers
  • Higher complexity: May be challenging for beginners to work with directly

Code Comparison

COVID-19 (CSV data format):

Province/State,Country/Region,Last Update,Confirmed,Deaths,Recovered
Hubei,Mainland China,2020-03-11T10:53:02,67773,3046,49134
,Italy,2020-03-11T21:33:02,12462,827,1045

covid-19-api (JSON API response):

{
  "confirmed": {"value": 126000, "detail": "https://covid19.mathdro.id/api/confirmed"},
  "recovered": {"value": 68000, "detail": "https://covid19.mathdro.id/api/recovered"},
  "deaths": {"value": 4600, "detail": "https://covid19.mathdro.id/api/deaths"},
  "lastUpdate": "2020-03-12T09:53:03.000Z"
}

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!

Pros of coronavirus-tracker-api

  • Supports multiple data sources (JHU, CSSeGIS, and NYT)
  • Provides more detailed location data, including latitude and longitude
  • Offers a CLI tool for easy local testing and development

Cons of coronavirus-tracker-api

  • Less frequent updates compared to covid-19-api
  • More complex setup and configuration required
  • Larger codebase, potentially harder to maintain

Code Comparison

covid-19-api:

const getData = async (url) => {
  const response = await fetch(url);
  return response.json();
};

coronavirus-tracker-api:

def get(self, url, params=None, headers=None):
    """Wrapper for requests.get()."""
    return requests.get(url, params=params, headers=headers, timeout=self.timeout)

Both repositories provide APIs for tracking COVID-19 data, but they differ in implementation and features. covid-19-api is built with JavaScript and focuses on simplicity, while coronavirus-tracker-api is written in Python and offers more comprehensive data sources and location information. The code comparison shows how each project handles HTTP requests, with covid-19-api using the Fetch API and coronavirus-tracker-api utilizing the requests library.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)

COVID-19 API

No longer maintaining the official deployment. Please fork this repo and use it for your own purpose.

last_cron_date og_cron_status daily_cron_status

Serving data from John Hopkins University CSSE as a JSON API

Deploy with ZEIT Now

Routes

  • /: contains opengraph image for sharing

  • /api: global summary

  • /api/og: generate a summary open graph image

  • /api/confirmed: global cases per region sorted by confirmed cases

  • /api/recovered: global cases per region sorted by recovered cases

  • /api/deaths: global cases per region sorted by death toll

  • /api/daily: global cases per day

  • /api/daily/[date]: detail of updates in a [date] (e.g. /api/daily/2-14-2020)

  • /api/countries: all countries and their ISO codes

  • /api/countries/[country]: a [country] summary (e.g. /api/countries/Indonesia or /api/countries/USA or /api/countries/CN)

  • /api/countries/[country]/confirmed: a [country] cases per region sorted by confirmed cases

  • /api/countries/[country]/recovered: a [country] cases per region sorted by recovered cases

  • /api/countries/[country]/deaths: a [country] cases per region sorted by death toll

  • /api/countries/[country]/og: generate a summary open graph image for a [country]

Usage

  1. Clone

    git clone --depth=1 https://github.com/mathdroid/covid-19-api
    
  2. Install deps (yarn, npm install)

  3. Install and register to ZEIT Now if you haven't. This project is exclusively made for the platform.

  4. now dev to run a local dev deployment, now to publish.

Showcase

License

MIT License 2020, mathdroid.

Transitively from the Johns Hopkins Site, the data may not be used for commercial purposes.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Odi

💻 📖

Yahya Fadhlulloh Al-Fatih

💻

spiritbro1

💻

Imperial Owl

💻

This project follows the all-contributors specification. Contributions of any kind welcome!