diff --git a/app/data/processing/predictive_models/v1.py b/app/data/processing/predictive_models/v1.py index 6ee2c01..efc540e 100644 --- a/app/data/processing/predictive_models/v1.py +++ b/app/data/processing/predictive_models/v1.py @@ -56,16 +56,16 @@ def process_data(df_hobolink: pd.DataFrame, df_usgs: pd.DataFrame) -> pd.DataFra df_hobolink.groupby("time") .agg( { - "pressure": np.mean, - "par": np.mean, - "rain": np.sum, - "rh": np.mean, - "dew_point": np.mean, - "wind_speed": np.mean, - "gust_speed": np.mean, - "wind_dir": np.mean, + "pressure": "mean", + "par": "mean", + "rain": "sum", + "rh": "mean", + "dew_point": "mean", + "wind_speed": "mean", + "gust_speed": "mean", + "wind_dir": "mean", # 'water_temp': np.mean, - "air_temp": np.mean, + "air_temp": "mean", } ) .reset_index() diff --git a/app/data/processing/predictive_models/v2.py b/app/data/processing/predictive_models/v2.py index 5054aeb..ab87133 100644 --- a/app/data/processing/predictive_models/v2.py +++ b/app/data/processing/predictive_models/v2.py @@ -62,14 +62,14 @@ def process_data(df_hobolink: pd.DataFrame, df_usgs: pd.DataFrame) -> pd.DataFra df_usgs.groupby("time") .agg( { - "log_stream_flow": np.mean, + "log_stream_flow": "mean", } ) .reset_index() ) df_hobolink = ( df_hobolink.groupby("time") - .agg({"rain": np.sum, "log_air_temp": np.mean, "days_since_sig_rain": np.min}) + .agg({"rain": "sum", "log_air_temp": "mean", "days_since_sig_rain": "min"}) .reset_index() ) diff --git a/app/data/processing/predictive_models/v3.py b/app/data/processing/predictive_models/v3.py index 21f1cbc..6facdc7 100644 --- a/app/data/processing/predictive_models/v3.py +++ b/app/data/processing/predictive_models/v3.py @@ -43,16 +43,16 @@ def process_data(df_hobolink: pd.DataFrame, df_usgs: pd.DataFrame) -> pd.DataFra df_hobolink.groupby("time") .agg( { - "pressure": np.mean, - "par": np.mean, - "rain": np.sum, - "rh": np.mean, - "dew_point": np.mean, - "wind_speed": np.mean, - "gust_speed": np.mean, - "wind_dir": np.mean, + "pressure": "mean", + "par": "mean", + "rain": "sum", + "rh": "mean", + "dew_point": "mean", + "wind_speed": "mean", + "gust_speed": "mean", + "wind_dir": "mean", # 'water_temp': np.mean, - "air_temp": np.mean, + "air_temp": "mean", } ) .reset_index() diff --git a/app/main.py b/app/main.py index 36f1269..73e4677 100644 --- a/app/main.py +++ b/app/main.py @@ -285,11 +285,11 @@ def update_db_command(async_: bool = False, tweet_status: bool = False): from app.data.celery import update_db_task if async_: - res = update_db_task.delay(tweet_status=tweet_status) + res = update_db_task.s(tweet_status=tweet_status).delay() click.echo(f"Started update database task ({res.id!r}).") else: click.echo("Updating the database...") - update_db_task.run(tweet_status=tweet_status) + update_db_task.s(tweet_status=tweet_status).run() click.echo("Updated the database successfully.") @app.cli.command("gen-mock-data") diff --git a/pytest.ini b/pytest.ini index 2df2815..f39fde7 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,4 @@ [pytest] -mocked-sessions = app.data.database.db.session addopts = --cov=app testpaths = tests