GithubHelp home page GithubHelp logo

ykursadkaya / covidbot Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 80 KB

COVID-19 Turkey API and Telegram Bot

Dockerfile 3.10% Python 96.90%
covid-19 turkey sars-cov-2 sarscov2 covid-api covid19-turkey covid-19-turkiye covid-19-turkey

covidbot's Introduction

COVID-19 Turkey API and Telegram Bot

Provides information about COVID-19 in Turkey.

  • Gets data directly from Republic of Turkey Ministry of Health COVID-19 website.
  • Checks the site every n (default is 300 in script) seconds, if anything changes in site sends message in Turkish via Telegram Bot API with provided API token and chat ID.
  • Provides an API for today's data, total data and a timeseries dataset for cases and deaths for days.

Telegram Message Screenshot

Telegram

Setup

Create your Telegram Bot

  1. Create your bot and get your API token

    Bots: An introduction for developers

  2. Add your bot to a group or start a private chat with your bot

  3. Get chat_id from Telegram Bot API

    Getting updates

Run on a Docker container

  1. Clone this repository

    git clone https://github.com/ykursadkaya/covidbot.git
    cd covidbot
  2. Build Docker image

    docker build -t covidbot .
  3. Run container

    docker run -p <external-port>:5000 --name <container-name> -e TELEGRAM_API_TOKEN=<api-token> -e TELEGRAM_CHAT_ID=<chat-id> covidbot

Run directly on your machine

  1. Install Python3

    Python Download Page

  2. Install pip for Python3

    pip installation guide

  3. Clone this repository

    git clone https://github.com/ykursadkaya/covidbot.git
    cd covidbot
  4. Install required Python packages

    pip3 install -r requirements.txt
  5. Run script

    python3 covidbot.py

API Documentation

Basic Data

Today Data

Use to get today's data.

URL: /today/

Method: GET

Auth required: No

Success Response

Code: 200 OK

Content example

{
    "case": "3.148",
    "death": "75",
    "lastUpdated": "2020-04-06",
    "recoveredPatient": "284",
    "test": "21.400"
}

Error Response

Code: 404 NOT FOUND

Total Data

Use to get total data.

URL: /total/

Method: GET

Auth required: No

Success Response

Code: 200 OK

Content example

{
    "case": "30.217",
    "death": "649",
    "icuPatient": "1.415",
    "intubatedPatient": "966",
    "lastUpdated": "2020-04-06",
    "recoveredPatient": "1.326",
    "test": "202.845"
}

Error Response

Code: 404 NOT FOUND

All Data

Use to get today and total data combined.

URL: /all/

Method: GET

Auth required: No

Success Response

Code: 200 OK

Content example

{
    "lastUpdated": "2020-04-06",
    "today": {
        "case": "3.148",
        "death": "75",
        "recoveredPatient": "284",
        "test": "21.400"
    },
    "total": {
        "case": "30.217",
        "death": "649",
        "icuPatient": "1.415",
        "intubatedPatient": "966",
        "recoveredPatient": "1.326",
        "test": "202.845"
    }
}

Error Response

Code: 404 NOT FOUND

All Data

Use to get today and total data combined.

URL: /all/

Method: GET

Auth required: No

Success Response

Code: 200 OK

Content example

{
    "lastUpdated": "2020-04-06",
    "today": {
        "case": "3.148",
        "death": "75",
        "recoveredPatient": "284",
        "test": "21.400"
    },
    "total": {
        "case": "30.217",
        "death": "649",
        "icuPatient": "1.415",
        "intubatedPatient": "966",
        "recoveredPatient": "1.326",
        "test": "202.845"
    }
}

Error Response

Code: 404 NOT FOUND

Datasets

Cases Dataset

Use to get cases timeseries data for days.

URL: /datasets/cases/

Method: GET

Auth required: No

Success Response

Code: 200 OK

Content example

{
    "cases": [
        "1",
        "1",
        "1",
        "5",
        "6",
        "18",
        "47",
        "98",
        "191",
        "359",
        "670",
        "947",
        "1236",
        "1529",
        "1872",
        "2433",
        "3629",
        "5698",
        "7402",
        "9217",
        "10827",
        "13531",
        "15679",
        "18135",
        "20921",
        "23934",
        "27069",
        "30217"
    ],
    "dateLabels": [
        "10",
        "11",
        "12",
        "13",
        "14",
        "15",
        "16",
        "17",
        "18",
        "19",
        "20",
        "21",
        "22",
        "23",
        "24",
        "25",
        "26",
        "27",
        "28",
        "29",
        "30",
        "31",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8"
    ],
    "dates": [
        "10 MARCH 2020",
        "11 MARCH 2020",
        "12 MARCH 2020",
        "13 MARCH 2020",
        "14 MARCH 2020",
        "15 MARCH 2020",
        "16 MARCH 2020",
        "17 MARCH 2020",
        "18 MARCH 2020",
        "19 MARCH 2020",
        "20 MARCH 2020",
        "21 MARCH 2020",
        "22 MARCH 2020",
        "23 MARCH 2020",
        "24 MARCH 2020",
        "25 MARCH 2020",
        "26 MARCH 2020",
        "27 MARCH 2020",
        "28 MARCH 2020",
        "29 MARCH 2020",
        "30 MARCH 2020",
        "31 MARCH 2020",
        "1 APRIL 2020",
        "2 APRIL 2020",
        "3 APRIL 2020",
        "4 APRIL 2020",
        "5 APRIL 2020",
        "6 APRIL 2020",
        "7 APRIL 2020",
        "8 APRIL 2020"
    ],
    "lastUpdated": "2020-04-06"
}

Error Response

Code: 404 NOT FOUND

Deaths Dataset

Use to get deaths timeseries data for days.

URL: /datasets/deaths/

Method: GET

Auth required: No

Success Response

Code: 200 OK

Content example

{
    "dateLabels": [
        "10",
        "11",
        "12",
        "13",
        "14",
        "15",
        "16",
        "17",
        "18",
        "19",
        "20",
        "21",
        "22",
        "23",
        "24",
        "25",
        "26",
        "27",
        "28",
        "29",
        "30",
        "31",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8"
    ],
    "dates": [
        "10 MARCH 2020",
        "11 MARCH 2020",
        "12 MARCH 2020",
        "13 MARCH 2020",
        "14 MARCH 2020",
        "15 MARCH 2020",
        "16 MARCH 2020",
        "17 MARCH 2020",
        "18 MARCH 2020",
        "19 MARCH 2020",
        "20 MARCH 2020",
        "21 MARCH 2020",
        "22 MARCH 2020",
        "23 MARCH 2020",
        "24 MARCH 2020",
        "25 MARCH 2020",
        "26 MARCH 2020",
        "27 MARCH 2020",
        "28 MARCH 2020",
        "29 MARCH 2020",
        "30 MARCH 2020",
        "31 MARCH 2020",
        "1 APRIL 2020",
        "2 APRIL 2020",
        "3 APRIL 2020",
        "4 APRIL 2020",
        "5 APRIL 2020",
        "6 APRIL 2020",
        "7 APRIL 2020",
        "8 APRIL 2020"
    ],
    "deaths": [
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "1",
        "2",
        "4",
        "9",
        "21",
        "30",
        "37",
        "44",
        "59",
        "75",
        "92",
        "108",
        "131",
        "168",
        "214",
        "277",
        "356",
        "425",
        "501",
        "574",
        "649"
    ],
    "lastUpdated": "2020-04-06"
}

Error Response

Code: 404 NOT FOUND

All Dataset

Use to get cases and deaths timeseries data combined for days.

URL: /datasets/all/

Method: GET

Auth required: No

Success Response

Code: 200 OK

Content example

{
    "cases": [
        "1",
        "1",
        "1",
        "5",
        "6",
        "18",
        "47",
        "98",
        "191",
        "359",
        "670",
        "947",
        "1236",
        "1529",
        "1872",
        "2433",
        "3629",
        "5698",
        "7402",
        "9217",
        "10827",
        "13531",
        "15679",
        "18135",
        "20921",
        "23934",
        "27069",
        "30217"
    ],
    "dateLabels": [
        "10",
        "11",
        "12",
        "13",
        "14",
        "15",
        "16",
        "17",
        "18",
        "19",
        "20",
        "21",
        "22",
        "23",
        "24",
        "25",
        "26",
        "27",
        "28",
        "29",
        "30",
        "31",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8"
    ],
    "dates": [
        "10 MARCH 2020",
        "11 MARCH 2020",
        "12 MARCH 2020",
        "13 MARCH 2020",
        "14 MARCH 2020",
        "15 MARCH 2020",
        "16 MARCH 2020",
        "17 MARCH 2020",
        "18 MARCH 2020",
        "19 MARCH 2020",
        "20 MARCH 2020",
        "21 MARCH 2020",
        "22 MARCH 2020",
        "23 MARCH 2020",
        "24 MARCH 2020",
        "25 MARCH 2020",
        "26 MARCH 2020",
        "27 MARCH 2020",
        "28 MARCH 2020",
        "29 MARCH 2020",
        "30 MARCH 2020",
        "31 MARCH 2020",
        "1 APRIL 2020",
        "2 APRIL 2020",
        "3 APRIL 2020",
        "4 APRIL 2020",
        "5 APRIL 2020",
        "6 APRIL 2020",
        "7 APRIL 2020",
        "8 APRIL 2020"
    ],
    "deaths": [
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "1",
        "2",
        "4",
        "9",
        "21",
        "30",
        "37",
        "44",
        "59",
        "75",
        "92",
        "108",
        "131",
        "168",
        "214",
        "277",
        "356",
        "425",
        "501",
        "574",
        "649"
    ],
    "lastUpdated": "2020-04-06"
}

Error Response

Code: 404 NOT FOUND

covidbot's People

Contributors

ykursadkaya avatar

Watchers

 avatar  avatar  avatar

covidbot's Issues

Need to rewrite entire script

Now instead of embedding data inside of the HTML page, they retrieve data from an API.

All the data provided from this API is in JSON format, but the values are all strings.

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.