Code Monkey home page Code Monkey logo

coronapi's Introduction

Corona API

Laravel based API for Corona stats.

Scrapes data from https://www.worldometers.info/coronavirus/.

It presents itself as a Chrome browser on MacOS.

It's available here: https://api.protikoroni.si/

Setup

Laravel basic setup with the additional cronjob entry as it fetches data every 10 minutes using the Laravel Scheduler

https://laravel.com/docs/7.x/scheduling

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Make sure you select a proper Cache Driver.

API Endpoints

/

Home endpoint gives info about all coutnries. All data is wrapped in a data object. last_fetched is a UNIX timestamp of when the data was fetched.

{
    "data": [
        {
            "country": "Total",
            "total_cases": 5234140,
            "new_cases": 43644,
            "total_deaths": 335730,
            "new_deaths": 1557,
            "total_recovered": 2112123,
            "active_cases": 2786287,
            "serious_cases": 45499,
            "cases_m_pop": "671"
        },
        {
            "country": "USA",
            "total_cases": 1625039,
            "new_cases": 4137,
            "total_deaths": 96526,
            "new_deaths": 172,
            "total_recovered": 382987,
            "active_cases": 1145526,
            "serious_cases": 17907,
            "cases_m_pop": "4,913"
        },
        ...
    ],
    "last_fetched": 1590159351
}

/{country}

Single 'country' endpoint (all names under country are valid, including Total).

{
    "data": {
        "country": "Slovenia",
        "total_cases": 1468,
        "new_cases": 0,
        "total_deaths": 106,
        "new_deaths": 0,
        "total_recovered": 1340,
        "active_cases": 22,
        "serious_cases": 3,
        "cases_m_pop": "706"
    },
    "last_fetch": 1590159351
}

Credits

This package was built by CNJ Digital.

License

This project is licensed under the MIT License.

coronapi's People

Contributors

martink635 avatar dependabot[bot] avatar

Watchers

 avatar James Cloos avatar

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.