cowidev.cmd.vax.track

cowidev.cmd.vax.track.countries

cowidev.cmd.vax.track.countries.countries_missing(path_population: str | None = None, path_locations: str | None = None, ascending: bool = False, as_dict: bool = False)[source]

Get countries currently not present in our dataset.

Parameters:
  • path_population (str, optional) – Path to UN population csv file. Default value works if repo structure is left unmodified.

  • path_locations (str, optional) – Path to locations csv file. Default value works if repo structure is left unmodified.

  • ascending (bool, optional) – Set to True to sort results in ascending order. By default sorts in ascedning order.

  • as_dict (bool, optional) – Set to True for the return value to be shaped as a dictionary. Otherwise returns a DataFrame.

cowidev.cmd.vax.track.countries.country_updates_summary(path_vaccinations: str | None = None, path_locations: str | None = None, path_automation_state: str | None = None, as_dict: bool = False, sortby_counts: bool = False, sortby_updatefreq: bool = False, who: bool = False, vaccines: bool = False, metric_counts: bool = False)[source]

Check last updated countries.

It loads the content from locations.csv, vaccinations.csv and automation_state.csv to present results on the update frequency and timeline of all countries. By default, the countries are sorted from least to most recently updated. You can also sort them from least to most frequently updated ones by using argument sortby_counts.

In Jupyter is recommended to ass the following lines to enable the DataFrame to be fully shown:

`python import pandas as pd pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', None) pd.set_option('display.max_colwidth', None) `

Parameters:
  • path_vaccinations (str, optional) – Path to vaccinations csv file. Default value works if repo structure is left unmodified.

  • path_locations (str, optional) – Path to locations csv file. Default value works if repo structure is left unmodified.

  • path_automation_state (str, optional) – Path to automation state csv file. Default value works if repo structure is left unmodified.

  • as_dict (bool, optional) – Set to True for the return value to be shaped as a dictionary. Otherwise returns a DataFrame.

  • sortby_counts (bool, optional) – Set to True to sort resuls from least to most updated countries.

  • who (bool, optional) – Display WHO columns

  • metric_counts (bool, optional) – Set to True to display how many rows with a non-null value for each metric appear.

Returns:

List or DataFrame, where each row (or element) contains five fields:
  • ’last_observation_date’: Last update date.

  • ’location’: Country name.

  • ’source_website’: Source used to retrieve last added data.

  • ’automated’: True if country process is automated.

  • ’counts’: Number of times the country has been updated.

Return type:

Union[pd.DataFrame, dict]

cowidev.cmd.vax.track.countries.get_who_data()[source]

cowidev.cmd.vax.track.track

cowidev.cmd.vax.track.track.export_to_csv(df, filename)[source]

cowidev.cmd.vax.track.vaccines

class cowidev.cmd.vax.track.vaccines.TrackVaccinesClient[source]

Bases: object

Client to interact with https://covid19.trackvaccines.org.

_parse_vaccines_all(soup: BeautifulSoup, original_names: bool = False)[source]
_parse_vaccines_location(soup: BeautifulSoup, original_names: bool = False)[source]
_valid_url(url: str)[source]
property all_vaccines_url
get_country_url(location: str)[source]
vaccines_approved(location: str | None = None, original_names: bool = False) list[source]

Get list of approved vaccines in a country (or all if None specified).

Parameters:
  • location (str, optional) – Country name. If None, retrieves all approved vaccines. Defaults to None.

  • original_names (bool, optional) – Set to True to keep vaccine from web. Defaults to False.

Returns:

Approved vaccines

Return type:

list

cowidev.cmd.vax.track.vaccines.map_vaccine(vaccine)[source]
cowidev.cmd.vax.track.vaccines.vaccines_approved(path_locations: str | None = None, verbose: bool = False) DataFrame[source]

Get approved vaccines for tracked countries.

This may take between 2-3 minutes.

Parameters:

path_locations (str, optional) – Path to locations csv file. Default value works if repo structure is left unmodified.

Returns:

Dataframe with location and vaccines approved.

Return type:

pd.DataFrame

cowidev.cmd.vax.track.vaccines.vaccines_comparison_with_who()[source]
cowidev.cmd.vax.track.vaccines.vaccines_missing(aggregated: bool = False, verbose: bool = False)[source]

Get missing vaccines.

  • Columns “_unapproved” mean vaccines not approved but currently being administered.

  • Columns “_untracked” mean vaccines approved but not tracked.

Note: Unapproved might mean that trackvaccines.org are not counting a vaccine that was actually approved.

Parameters:

aggregated (bool, optional) – Set to True to get list of untracked/unapproved global vaccines. Defaults to False.

Returns:

Unapproved/untracked vaccines

Return type:

Union[pd.DataFrame, dict]

cowidev.cmd.vax.track.vaccines.vaccines_tracked(path_locations: str | None = None, location: str | None = None, as_list: bool = False) DataFrame[source]

Get tracked vaccines for tracked countries.

Parameters:
  • path_locations (str, optional) – Path to locations csv file. Default value works if repo structure is left unmodified.

  • location (str, optional) – Country name. Defaults to None.

  • as_list (bool, optional) – Set to True to return a (flattened) list.

Returns:

Dataframe with location and vaccines tracked.

Return type:

pd.DataFrame