pulling covid deaths from covid19_open_data using bq

122 views Asked by At

I am trying to get COVID19 deaths history per country using Google's SDK. I installed bq (BigQuery) on Ubuntu, but I don't know how to proceed. The online API gives some examples but they seem irrelevant. I expect something like bq extract bigquery-public-data.covid19_open_data but can't find instructions. I feel clueless here, thanks for your help.

1

There are 1 answers

0
Yuval Harpaz On

Eventually, I managed to get the data I wanted with the online API (link above in the question). I used the code below. However, the data was noisy and spiky for Sweden and other countries, similarly to Johns Hopkins data, so I have to keep looking for a more reliable source of data. it seems that WHO has better data

WITH
  country_pop AS (
  SELECT
    country_code AS iso_3166_1_alpha_3,
    year_2018 AS population_2018
  FROM
    `bigquery-public-data.world_bank_global_population.population_by_country`)
SELECT
  date,
  new_deceased,
  new_intensive_care_patients,
  new_confirmed,
  new_tested
FROM
  `bigquery-public-data.covid19_open_data.covid19_open_data`
JOIN
  country_pop
USING
  (iso_3166_1_alpha_3)
WHERE
  country_name = 'Sweden'
  AND aggregation_level = 0
ORDER BY
  date ASC