Skip to content

Commit

Permalink
Revert "v4.5.0: 🤓 Use the total of second doses (#13)"
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziomiano committed Feb 25, 2021
2 parents 2ec627e + 7772fa9 commit ebedaf9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions app/data/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
REGIONS, PROVINCES, DATE_KEY, CHART_DATE_FMT, STATE_KEY,
NEW_POSITIVE_MA_KEY, VAX_AGE_KEY, M_SEX_KEY, F_SEX_KEY, VAX_DATE_KEY,
VAX_DATE_FMT, VAX_AREA_KEY, VAX_TYPE_KEY, ITALY_POPULATION, OD_TO_PC_MAP,
POP_KEY, VAX_TOT_ADMINS_KEY
POP_KEY
)

COLUMNS_TO_DROP = [STATE_KEY]
Expand Down Expand Up @@ -439,14 +439,14 @@ def build_provincial_series(df):
def augment_vax_df(df):
"""Clean 'fascia_anagrafica key, add 'total' and 'id' to df"""
df[VAX_AGE_KEY] = df[VAX_AGE_KEY].apply(lambda x: x.strip())
df[VAX_TOT_ADMINS_KEY] = df[M_SEX_KEY] + df[F_SEX_KEY]
df['totale'] = df[M_SEX_KEY] + df[F_SEX_KEY]
df['_id'] = (
df[VAX_DATE_KEY].apply(
lambda x: x.strftime(VAX_DATE_FMT)) +
df[VAX_AREA_KEY] +
df[VAX_AGE_KEY] +
df[VAX_TYPE_KEY]
).apply(lambda x: hash(x))
)
return df


Expand All @@ -464,15 +464,14 @@ def augment_summary_vax_df(df):
for col in reg_df:
if isinstance(reg_df[col].values[-1], str):
reg_df[col].ffill(inplace=True)
else:
reg_df.fillna(0, inplace=True)
else:
reg_df.fillna(0, inplace=True)
out_df = out_df.append(reg_df)
out_df.reset_index(inplace=True)
out_df['_id'] = (
out_df[VAX_DATE_KEY].apply(
lambda x: x.strftime(VAX_DATE_FMT)) + out_df[VAX_AREA_KEY]
)
out_df['_id'] = out_df['_id'].apply(lambda x: hash(x))
out_df[POP_KEY] = out_df[VAX_AREA_KEY].apply(
lambda x: ITALY_POPULATION[OD_TO_PC_MAP[x]])
return out_df

0 comments on commit ebedaf9

Please sign in to comment.