async def statistics_covid(conn, size, sort, offset):
  """Statistics on cases by country

  List the number of cases by country, the cases will be splitted in three state 'infected', 'treated' or 'dead'

  :param size: The number of countries to fetch.
  :type size: int
  :param sort: Sort order:  * 'asc' - Ascending, from the least affected country to the most affected country.  * 'desc' - Descending, from the most affected country to the least affected country.
  :type sort: str
  :param offset: An offset to allow pagination.
  :type offset: int

  :rtype: List[{ country: str, total: int, treated: int, infected: int, dead: int}]
  """
  query = "SELECT COUNT(*) as count,country, health FROM detected_cases GROUP BY country,health"
  proxy = await conn.execute(query)
  records = await proxy.fetchall()

  # format the response
  country_hash = {}
  for record in records:
    count = record[0]
    country = record[1]
    health = record[2]

    value = country_hash.get(country, {'country': country, 'total': 0, 'infected': 0, 'treated': 0, 'dead': 0})
    value[health] = count
    value['total'] += count
    country_hash[country] = value
  response = list(country_hash.values())
  if sort == 'asc':
    return sorted(response, key=lambda value: value['total'])[offset:(offset+size)]
  else:
    return sorted(response, key=lambda value: -value['total'])[offset:(offset+size)]