Skip to content

Commit

Permalink
fix(palletjack): handle date issues and other palletjack fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Oct 8, 2024
1 parent 0f9977e commit a34bd45
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"cSpell.words": [
"accesstoken",
"agol",
"api",
"apos",
"astype",
"autolinker",
"buildx",
"Buildx",
Expand Down
4 changes: 2 additions & 2 deletions src/palletjack/src/roadkill/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
),
]
6 changes: 3 additions & 3 deletions src/palletjack/src/roadkill/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit a34bd45

Please sign in to comment.