Coder Social home page Coder Social logo

taqahar / coronavirus-tg-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from koffisani/coronavirus-tg-api

0.0 0.0 0.0 115 KB

API for tracking the global coronavirus (COVID-19, SARS-CoV-2) ๐Ÿฆ  outbreak in Togo. It's written in python using the FastAPI framework ๐Ÿ”ฅ. Supports government source!

Home Page: https://coronavirus-tg-api.herokuapp.com/

License: GNU General Public License v3.0

Python 83.43% Makefile 2.04% Dockerfile 3.23% Shell 11.30%

coronavirus-tg-api's Introduction

Coronavirus Tg API

Provides up-to-date data about Coronavirus outbreak in Togo. Includes numbers about confirmed cases, deaths and recovered. Support unique government source.

Travis build License GitHub stars GitHub forks GitHub last commit GitHub pull requests GitHub issues Code style: black Tweet

Available data-sources:

Currently 1 data-source is available to retrieve the data:

API Reference

All endpoints are located at coronavirus-tg-api.herokuapp.com/v1/ and are accessible via https.

You can open the URL in your browser to further inspect the response. Or you can make this curl call in your terminal to see the prettified response:

curl https://coronavirus-tracker-api.herokuapp.com/v1/cases | json_pp

Swagger/OpenAPI

Consume our API through our super awesome and interactive SwaggerUI (on mobile, use the mobile friendly ReDocs instead for the best experience).

The OpenAPI json definition can be downloaded at https://coronavirus-tg-api.herokuapp.com/openapi.json

Technologies used for the project

  • Python3.8 / FastApi / Unicorn / => Language & Framework
  • Docker & Docker Compose => Dockerization
  • Heroku => Hosting
  • Travis => Build,Test, deploy, โ€ฆ (Github Actions soon)
  • Telegram API => Bot to receive Travis job result instead of email notification

API Endpoints

Cases Endpoint

Getting total of confirmed cases, deaths, recovered and the last updated date.

GET /v1/cases

Sample response

{
  "confirmed": 99,
  "recovered": 62,
  "deaths": 6,
  "last_updated": "2020-04-27 11:12:00"
}

Sources Endpoint

Getting the data-sources that are currently available to Coronavirus Tg API to retrieve the data of the pandemic. Currently,the government website and the tracker api project.

GET /v1/sources

Sample response

{
  "government_website": "https://covid19.gouv.tg",
  "tracker_api_project": "https://github.com/egbakou/coronavirus-tg-api"
}

Confirmed cases Endpoint

Getting confirmed cases data.

GET /v1/cases/confirmed

Sample response

{
  "confirmed": 99,
  "last_updated": "2020-04-27 11:12:00"
}

Recovered cases Endpoint

Getting recovered cases data.

GET /v1/cases/recovered

Sample response

{
  "recovered": 62,
  "last_updated": "2020-04-27 11:12:00"
}

Deaths data Endpoint

Getting number of deaths.

GET /v1/cases/deaths

Sample response

{
  "deaths": 6,
  "last_updated": "2020-04-27 11:12:00"
}

Response definitions

Response Item Description Type
{cases} total of confirmed cases, deaths, recovered and the last updated date. Object
{cases}/confirmed The up-to-date total number of confirmed cases Integer
{cases}/deaths The up-to-date total number of deaths Integer
{cases}/recovered The up-to-date total number of recovered Integer
{sources} Data-sources used to provide data Object

We strongly recommend using the endpoint /v1/cases instead of using the endpoints returning each case.

Wrappers

No wrapper at the moment.

Prerequisites

You will need the following things properly installed on your computer.

Installation

  • git clone https://github.com/egbakou/coronavirus-tg-api.git
  • cd coronavirus-tg-api
  1. Make sure you have python3.8 installed and on your PATH.
  2. Install the pipenv dependency manager
  3. Create virtual environment and install all dependencies $ pipenv sync --dev
  4. Activate/enter the virtual environment $ pipenv shell

And don't despair if don't get the python setup working on the first try. No one did. Guido got pretty close... once. But that's another story. Good luck.

Running / Development

For a live reloading on code changes.

  • pipenv run dev

Without live reloading.

  • pipenv run start

Visit your app at http://localhost:8000.

Alternatively run our API with Docker.

Running Tests

pytest

pipenv run test

Linting

pylint

pipenv run lint

Formatting

black

pipenv run fmt

Update requirements files

invoke generate-reqs

Pipfile.lock will be automatically updated during pipenv install.

Docker

Our Docker image is based on tiangolo/uvicorn-gunicorn-fastapi/.

invoke docker --build

Run with docker run or docker-compose

Alternate Docker images

If a full gunicorn deployment is unnecessary or impractical on your hardware consider using our single instance Uvicorn based Dockerfile.

Invoke

Additional developer commands can be run by calling them with the python invoke task runner.

invoke --list

Deploying

Created by: Kodjo Laurent Egbakou

Contribution

Feel free to create issues and PRs :)

coronavirus-tg-api's People

Contributors

egbakou avatar koffisani 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.