Covid Thailand Trends
Thailand Covid testing and case data gathered and combined from various sources for others to download or view
Project maintained by djay
Hosted on GitHub Pages — Theme by mattgraham
Thailand COVID-19 Data
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.
- Updated daily 8-9am summary info, 1-3pm from full briefing. Testing data is updated every 1-3 weeks.
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
Cases by Where Tested
Cases by Risk Group
Provinces with Cases Trending Up
To see cases for every province go to The Researcher Covid Tracker
Cases by Health District
Cases by Age
Unofficial Estimated Infections based on Deaths/IFR
- Due to the Asymptomatic nature of Covid all countries have more infections than can be confirmed via testing.
- Research has been done to work out how many real infections there are in many countries to work out an estimated global Infection Fatality Rate of the virus for each age group. A simple estimate based on reported deaths using a per province IFR back-dated 11 days (median reported time till death for Thailand) gives an estimate of infections, however there are many assumptions, that if wrong, could make this estimate higher e.g. uncounted covid deaths.
- This doesn’t mean there is not enough testing being done in Thailand. Positive rate is another indication of testing effectiveness.
- More detailed models with predictions that take into account factors like Google mobility data to predict infections based on adherence to social distancing measures.
- IHME Policy Briefing PDFs provide a lot of detail on the current situation in a country and what factors are that drive their predictions.
- Sources: CCSA Daily Briefing, Covid IFR Analysis, Thailand population by Age
Active Cases Since April 1st
- Break down of active case status only available from 2020-04-24 onwards.
- Other Active Cases + ICU + Ventilator + Field hospitals = Hospitalised, which is everyone who is
confirmed (for 14days at least)
- see Thailand Active Cases 2020-2021
- Source: CCSA Daily Briefing
COVID-19 Deaths by Health District
COVID-19 Deaths Age Range
PCR Tests in Thailand by day
PCR Tests by Health District
Positive Rate by Health District
- Shows if all health districts are testing similarly
Vaccinations by Priority Groups
Shows Deaths from all causes in comparison to the min, max and mean of Deaths from the 5 years pre-pandemic.
- Note: there are many possible factors alter deaths up or down other than uncounted Covid Deaths
How to contribute
- As the different sources of the data has increased so has the code needed fetch, extract and
display this data. All the code is fairly simple python however. It is a fun way to learn scraping
data and/or pandas and matplotlib.
- Find a github issue and have a go. Many are marked as suitable for beginners
- making new plots
- improve existing plots
- adding tests so it’s faster to make future fixes
- improving scrapers that miss past data, e.g. vaccination reports
- Spotting breaking updates and submitting a pull request to revise the scraper
- If unsure if you are on the right track, submit a draft pull request and request a review
- Spotted a problem or got an idea how to improve? Submit an issue and then have a go making it happen.
- Got Questions? Start a discussion or comment on an issue
Running just plots (or latest files)
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 && \
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
Running full code (warning will take a long time)
You can just use the test framework without a full download if you want to work on scraping.
- to download only the files that interest you first, you can comment out or rearrange the lines in covid_data.scrape_and_combine
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)
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.
Other sources of visualisations/Data for Thailand
- 2021-08-16 - Move ATK to tests plot and remove from types plot
- 2021-08-16 - Plots of more age ranges for deaths, excess deaths and cases
- 2021-08-15 - Dashboard parsing for provinces and ages with downloads
- 2021-08-02 - Add ATK cases parsing from dashboard and put in case_types plot
- 2021-07-30 - Add plots for excess deaths
- 2021-07-18 - Add data on vaccines by manufacturer from vaccine slides
- 2021-07-17 - Add estimate of death ages
- 2021-07-13 - Remove import vaccines due to coldchain data being restricted
- 2021-07-10 - Switch province plots to per 100,000
- 2021-07-10 - Put actuals on main case plots
- 2021-06-29 - Use coldchain data to plot deliveries and province vac data
- 2021-06-22 - Add trending provinces for contact cases
- 2021-06-12 - Add vaccination daily and improve cumulative vaccinations
- 2021-06-05 - update vaccination reports to parse summary timeline data only (missing source)
- 2021-06-30 - death reasons and hospitalisation critical plots
- 2021-05-21 - Estimate of infections from deaths
- 2021-05-18 - Include prisons as separate province/health district (because briefings do)
- 2021-05-15 - improve highest positive rate plot to show top 5 only
- 2021-05-10 - parse unofficial RB tweet to get cases and deaths earlier
- 2021-05-07 - add trending up and down provinces for cases
- 2021-05-06 - add top 5 fully vaccinated provinces
- 2021-05-05 - added recovered to active cases
- 2021-05-04 - plots of deaths and vaccinations
- 2021-04-28 - rolling averages on area graphs to make them easier to read
- 2021-04-25 - Add graph of cases by risk and active cases (inc severe)
- 2021-04-25 - Scrape hospitalisation stats from briefing reports
- 2021-04-23 - Fixed mistake in testing data where private tests was added again
- 2021-04-22 - data for sym/asymptomatic and pui private vs pui public
- 2021-04-20 - Added case age plot
- 2021-04-18 - Added clearer positive rate by district plot and made overall positive rate clearer
- 2021-04-15 - Quicker province case type breakdowns from daily briefing reports
- 2021-04-13 - get quicker PUI count from https://ddc.moph.go.th/viralpneumonia/index.php
- 2021-04-12 - Put in “unknown area” for tests and cases by district so totals are correct
- 2021-04-05 - add tweets with province/type break down to get more up to date stats