Thailand Covid testing and case data gathered and combined from various sources for others to download or view
Note Share via https://djay.github.io/covidthailand
Thailand COVID-19 case/test/vaccination data gathered and combined from various government sources for others to view or download.
NEW Excess Deaths
Data offered here is offered as is with no guarantees. As much as possible government reports and data feeds have been used effort has gone into making this data collection accurate and timely. This sites only intention is to give an accurate representation of all the available Covid data for Thailand in one place.
Links to all data sources are including in Downloads
Sources: CCSA Daily Briefing, API: Daily reports of COVID-19 infections
see also Trending Down Confirmed Cases, Trending Up Contact Cases, Trending Up Unknown Cases, Trending Up Community Cases, Trending Up Work Cases and Trending Up Proactive Cases
Total number of laboratory tests
. Total number of laboratory tests
is mislabelled and is exactly the same as the PUI number.
Shows Deaths from all causes in comparison to the min, max and mean of Deaths from the 5 years pre-pandemic.
Notes
To install (requires python >=3.9)
python -m venv .venv
.venv/bin/pip install -r requirements.txt
To run the tests (will only get files needed for tests)
bin/pytest
To add a test
git blame covid_data.py
on the scraping function to see the dates that lines were added or changed. in some cases comments indicated important dates where code had to change.To get latest files; change into the root directory of your clone of the repository and then:
wget https://github.com/djay/covidthailand/releases/download/1/inputs.tar.gz && \
tar xzf inputs.tar.gz && \
rm inputs.tar.gz
To build the CSV files needed for plotting from the inputs downloaded above, from the root directory of the repo, run:
USE_CACHE_DATA=True python covid_data.py
To do just plots
USE_CACHE_DATA=True MAX_DAYS=0 bin/python covid_plot.py
When debugging, to scrape just one part first, rearrange the lines in covid_data.py/scrape_and_combine so that the scraping function you want to debug gets called before the others do
You can just use the test framework without a full download if you want to work on scraping.
to work on plots you can download the csv files from the website into the api directory and set env MAX_DAYS=0
To run the full scrape (warning this will take a long time as it downloads all the documents into a local cache)
bin/python covid_plot.py
$ sudo gem update bundler
$ bundle config set --local path vendor/bundle
$ bundler install
$ bundle exec jekyll serve
Made with python/pandas/matplotlib. Dylan Jay gave a talk on how easy it is to extract data from PDFs and powerpoints and plot data at Bangkok’s Monthly ThaiPy Event Video: “How I scraped Thailand’s covid data” (1h mark)
Why do this? Originally to answer the question “Was Thailand doing enough testing?” for myself and because .
!
This work is licensed under a Creative Commons Attribution 4.0 International License.