/covidphtesttracker

Primary LanguageGoMIT LicenseMIT

What this is

Source code for bot powering Telegram Channel.

Data sourced from https://doh.gov.ph/covid19tracker.

Inspired by the good work being done over at PH Coronavirus Updates.

What it does

  1. Download Read me from data drop
  2. Parse links from read me
  3. Download Testing Aggregates csv from links
  4. Collate daily_output_unique_individuals and daily_output_positive_individuals grouped by provided date from csv
  5. Send message to telegram

Requirements

  1. go 1.0+
  2. config.json file
  • Sample:

    {
      "telegram":{
          "chat_id":"",
          "bot_id":"",
          "url": "https://api.telegram.org"
      },
      "gdrive":{
          "api_key":"",
          "url": "https://www.googleapis.com/drive/v2/files",
          "test_substring": "Testing Aggregates.csv",
          "link_substring": "bit.ly/",
          "readme_substring": "READ ME FIRST",
          "daily_url": "http://bit.ly/DataDropPH"
      }
    }
  • Instructions here for setting up a telegram bot.

  • Instructions here for enabling Google Drive API

Building

  1. go get -d
  2. go build

Running

./covidphtesttracker \
-d 2021-02-12 \
-l https://drive.google.com/drive/folders/1x-zy7hTT19cJ9Hin1B0WYrJksrTI6EU4 \
-c config.json

Flags

  1. -c: Path to config.json file
  2. -d: Date to check