Ejemplo n.º 1
0
def generate_reports_countries(
    *, workers, kernel_name, wwwroot, force, disable_pbar, debug
):
    d = oscovida.fetch_deaths()
    c = oscovida.fetch_cases()

    countries = d.index
    countries2 = c.index
    assert (countries2 == countries).all()

    #  TODO: The get_x_list methods should be part of Reporter class
    countries = get_country_list()

    cre = ReportExecutor(
        Reporter=CountryReport,
        kernel_name=kernel_name,
        wwwroot=wwwroot,
        expiry_hours=2,
        attempts=3,
        workers=workers,
        force=force,
        disable_pbar=disable_pbar,
        debug=debug,
    )

    if debug:
        countries = countries[:10]

    cre.create_html_reports(countries)

    cre.create_markdown_index_page()
Ejemplo n.º 2
0
def get_country_list():
    d, c = fetch_deaths(), fetch_cases()

    countries = d.index
    countries2 = c.index
    assert (countries2 == countries).all()

    # Here we should identify regions in countries, and process those.
    # Instead, as a quick hack to get started, we'll just take one country
    # and the current "get_country" method will sum over all regions of one country if only
    # the country name is given.

    return sorted(countries.drop_duplicates())
Ejemplo n.º 3
0
 def check_country_is_known(country):
     d = oscovida.fetch_deaths()
     assert (
         country in d.index
     ), f"{country} is unknown. Known countries are {sorted(d.index)}"