From 69ce33cdb4abdc8d6ba719eca6862b33e58c9408 Mon Sep 17 00:00:00 2001 From: stdavis Date: Mon, 7 Oct 2024 13:29:06 -0600 Subject: [PATCH] fix(palletjack): handle date issues and other palletjack fixes --- .vscode/settings.json | 2 ++ src/palletjack/src/roadkill/config.py | 4 ++-- src/palletjack/src/roadkill/main.py | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 16e92f22..f6e22801 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,10 @@ { "cSpell.words": [ "accesstoken", + "agol", "api", "apos", + "astype", "autolinker", "buildx", "Buildx", diff --git a/src/palletjack/src/roadkill/config.py b/src/palletjack/src/roadkill/config.py index 0c6252eb..2e64f152 100644 --- a/src/palletjack/src/roadkill/config.py +++ b/src/palletjack/src/roadkill/config.py @@ -29,13 +29,13 @@ "report_id", "animal_location", ["report_id", "species_id", "user_id"], - ["submit_date"], + ["submit_date", "discovery_date"], ), ( "agol_routes", "route_id", "geog", ["route_id", "user_id"], - ["start_time", "end_time"], + ["start_time", "end_time", "submit_date"], ), ] diff --git a/src/palletjack/src/roadkill/main.py b/src/palletjack/src/roadkill/main.py index 25c9a96c..5e974b2f 100644 --- a/src/palletjack/src/roadkill/main.py +++ b/src/palletjack/src/roadkill/main.py @@ -138,7 +138,7 @@ def _get_new_and_deleted_records(database_records, agol_records): new_records = database_records[ ~database_records.index.isin(agol_records.index) ].copy() - new_records["OBJECTID"] = range(-1, -len(new_records) - 1, -1) + new_records["OBJECTID"] = range(1, len(new_records) + 1) deleted_records = agol_records[ ~agol_records.index.isin(database_records.index) @@ -249,13 +249,13 @@ def process(): prepared_df["repeat_submission"] = prepared_df[ "repeat_submission" ].astype("int") - updater = load.ServiceUpdater(gis, item.id) + updater = load.ServiceUpdater(gis, item.id, working_dir=tempdir_path) updates = updater.add(prepared_df) module_logger.info("Added %s records", updates) if len(deleted_ids) > 0: module_logger.info("Deleting records...") - updater = load.ServiceUpdater(gis, item.id) + updater = load.ServiceUpdater(gis, item.id, working_dir=tempdir_path) deleted = updater.remove(deleted_ids) module_logger.info("Deleted %s records", deleted)