Ejemplo n.º 1
0
def japan_hospitalizations(params):
    data_df = load_utils.default_read_function(params)
    data_df['deaths_cumulative'] = data_df['deaths_cumulative'].replace(
        to_replace='-', value=0).astype('int32')
    data_df = region_utils.join_region_codes(data_df, params)
    data_df = region_utils.aggregate_and_append(data_df, params)
    return data_df
Ejemplo n.º 2
0
def default_load_function(params):
    df = load_utils.default_read_function(params)
    df = region_utils.join_region_codes(df, params)
    load_params = params['load']
    if 'regions' in load_params:
        if 'aggregate_by' in load_params['regions']:
            df = region_utils.aggregate_and_append(df, params)
    df = load_utils.compute_cumulative_from_new(df, params)
    return df
Ejemplo n.º 3
0
def scotland_hospitalizations(data_path, params):
    df = pd.read_excel(data_path, 'Table 2 - Hospital Care', skiprows=4)
    df = df.rename(columns={
        df.columns[1]: 'icu_current',
        df.columns[4]: 'hospitalized_current',
    })
    df = date_utils.parse_date(df, params)
    df = region_utils.join_region_codes(df, params)
    return df
Ejemplo n.º 4
0
def scotland_hospitalizations(params):
    data_path = path_utils.most_recent_data(params)['path']
    df = pd.read_excel(data_path, 'Table 2 - Hospital Care', skiprows=4)
    df = df.rename(columns={
        df.columns[1]: "icu_current",
        df.columns[4]: "hospitalized_current",
    })
    df = date_utils.parse_date(df, params)
    df = region_utils.join_region_codes(df, params)
    return df
Ejemplo n.º 5
0
def default_load_function(data_path, params):
    df = load_utils.default_read_function(data_path, params)
    df = region_utils.join_region_codes(df, params)
    duplicates = df[df[['region_code', 'date']].duplicated(keep=False)]
    if duplicates.shape[0] != 0:
        logging.warning(
            'Dropping the following duplicate data for %s data source:\n%s',
            params['config_key'], duplicates[['region_code', 'date']])
        df = df.drop_duplicates(subset=['region_code', 'date'], keep='first')
    load_params = params['load']
    if 'regions' in load_params:
        if 'aggregate_by' in load_params['regions']:
            df = region_utils.aggregate_and_append(df, params)
    df = load_utils.compute_cumulative_from_new(df, params)
    return df