Provides up-to-date data about Coronavirus outbreak in Togo. Includes numbers about confirmed cases, deaths and recovered. Support unique government source.
Currently 1 data-source is available to retrieve the data:
- Togolese Government dedicated website for the covid19 - https://covid19.gouv.tg
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-tg-api.herokuapp.com/v1/cases | json_pp
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
- 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
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"
}
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"
}
Getting confirmed cases data.
GET /v1/cases/confirmed
Sample response
{
"confirmed": 99,
"last_updated": "2020-04-27 11:12:00"
}
Getting recovered cases data.
GET /v1/cases/recovered
Sample response
{
"recovered": 62,
"last_updated": "2020-04-27 11:12:00"
}
Getting number of deaths.
GET /v1/cases/deaths
Sample response
{
"deaths": 6,
"last_updated": "2020-04-27 11:12:00"
}
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.
No wrapper at the moment.
You will need the following things properly installed on your computer.
git clone https://github.com/egbakou/coronavirus-tg-api.git
cd coronavirus-tg-api
- Make sure you have
python3.8
installed and on yourPATH
. - Install the
pipenv
dependency manager- with pipx
$ pipx install pipenv
- with Homebrew/Linuxbrew
$ brew install pipenv
- with pip/pip3 directly
$ pip install --user pipenv
- with pipx
- Create virtual environment and install all dependencies
$ pipenv sync --dev
- 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.
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.
pipenv run test
pipenv run lint
pipenv run fmt
invoke generate-reqs
Pipfile.lock will be automatically updated during pipenv install
.
Our Docker image is based on tiangolo/uvicorn-gunicorn-fastapi/.
invoke docker --build
Run with docker run
or docker-compose
If a full gunicorn
deployment is unnecessary or impractical on your hardware consider using our single instance Uvicorn
based Dockerfile.
Additional developer commands can be run by calling them with the python invoke
task runner.
invoke --list
- LinkedIn: Kodjo Laurent Egbakou
- Twitter: @lioncoding
Feel free to create issues and PRs :)