canadacovidmetrics.canadacovidmetrics
Module Contents
Functions
|
Check date format is compatible with API call |
|
Check province/location format is compatible with API call |
|
Query total cumulative cases with ability to specify location and date range of returned data. |
|
Query total cumulative deaths with ability to specify location and date range of returned data. |
|
Query total cumulative recovered cases with ability to specify location and date range of returned data. |
|
Query total cumulative vaccine completion with ability to specify location and date range of returned data. |
Attributes
- canadacovidmetrics.canadacovidmetrics.today
- canadacovidmetrics.canadacovidmetrics.date_format_check(datestr)
Check date format is compatible with API call :param datestr: Date string to be checked :type datestr: str
- Return type
None
Examples
>>> date_format_check('2021-03-30')
- canadacovidmetrics.canadacovidmetrics.loc_format_check(locstr)
Check province/location format is compatible with API call
- Parameters
locstr (str) – Location string to be checked
- Return type
None
Examples
>>> loc_format_check('2021-03-30')
- canadacovidmetrics.canadacovidmetrics.get_cases(loc='prov', date=None, after='2020-01-01', before=today, datetype=True)
Query total cumulative cases with ability to specify location and date range of returned data. :param loc: Specify geographic filter and aggregation of returned data.
Valid loc arguments are: ‘canada’, ‘prov’ and two-letter province codes (e.g. ‘ON’, ‘BC’, etc.)
- Parameters
date (str) – If not None, return data from the specified date YYYY-MM-DD. Superceeds ‘after’ and ‘before’ parameters.
after (str) – Return data on and after the specified date YYYY-MM-DD.
before (str) – Return data on and before the specified date YYYY-MM-DD.
datetype (boolean) – Return date column as a string (False) or as a datetime (True). Default is True.
- Returns
JSON response from queried api.
- Return type
dict
Examples
>>> get_cases(loc='BC')
- canadacovidmetrics.canadacovidmetrics.get_deaths(loc='prov', date=None, after='2020-01-01', before=today, datetype=True)
Query total cumulative deaths with ability to specify location and date range of returned data. :param loc: Specify geographic filter and aggregation of returned data.
Valid loc arguments are: ‘canada’, ‘prov’ and two-letter province codes (e.g. ‘ON’, ‘BC’, etc.)
- Parameters
date (str) – If not None, return data from the specified date YYYY-MM-DD. Superceeds ‘after’ and ‘before’ parameters.
after (str) – Return data on and after the specified date YYYY-MM-DD.
before (str) – Return data on and before the specified date YYYY-MM-DD.
datetype (boolean) – Return date column as a string (False) or as a datetime (True). Default is True.
- Returns
Pandas dataframe containing content of API response.
- Return type
df
Examples
>>> get_deaths(loc='BC')
- canadacovidmetrics.canadacovidmetrics.get_recoveries(loc='prov', date=None, after='2020-01-01', before=today, datetype=True)
Query total cumulative recovered cases with ability to specify location and date range of returned data. :param loc: Specify geographic filter and aggregation of returned data.
Valid loc arguments are: ‘canada’, ‘prov’ and two-letter province codes (e.g. ‘ON’, ‘BC’, etc.)
- Parameters
date (str) – If not None, return data from the specified date YYYY-MM-DD. Superceeds ‘after’ and ‘before’ parameters.
after (str) – Return data on and after the specified date YYYY-MM-DD.
before (str) – Return data on and before the specified date YYYY-MM-DD.
datetype (boolean) – Return date column as a string (False) or as a datetime (True). Default is True.
- Returns
Pandas dataframe containing content of API response.
- Return type
df
Examples
>>> get_recoveries(loc='BC')
- canadacovidmetrics.canadacovidmetrics.get_vaccinations(loc='prov', date=None, after='2021-01-01', before=today, datetype=True)
Query total cumulative vaccine completion with ability to specify location and date range of returned data.
- Parameters
loc (str) – Specify geographic filter and aggregation of returned data. Valid loc arguments are: ‘canada’, ‘prov’ and two-letter province codes (e.g. ‘ON’, ‘BC’, etc.)
date (str) – If not None, return data from the specified date YYYY-MM-DD. Superceeds ‘after’ and ‘before’ parameters.
after (str) – Return data on and after the specified date YYYY-MM-DD. Default is 2021-01-01.
before (str) – Return data on and before the specified date YYYY-MM-DD. Default is the date of query.
datetype (boolean) – Return date column as a string (False) or as a datetime (True). Default is True.
- Returns
Pandas dataframe containing content of API response.
- Return type
df
Examples
>>> get_vaccinations(loc='BC')