Skip to content

Commit

Permalink
Merge pull request #48 from seung-lab/return_update_id_map
Browse files Browse the repository at this point in the history
fix: return updated id mapping not list of new ids
  • Loading branch information
dlbrittain authored Oct 24, 2023
2 parents f1a92aa + d2cdc3a commit fc32726
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions annotationengine/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,13 @@ def put(self, aligned_volume_name: str, table_name: str, **kwargs):
annotations = data.get("annotations")

new_ids = []

updated_ids_mapping = {}
for annotation in annotations:
try:
updated_id = db.annotation.update_annotation(table_name, annotation)
((old_id, new_id),) = updated_id.items()
new_ids.append(new_id)
update_id_map = db.annotation.update_annotation(table_name, annotation)
((old_id, new_id),) = update_id_map.items()
new_ids.append(new_id) # send a list of new ids to the supervoxel lookup
updated_ids_mapping[old_id] = new_id # return a mapping of old to new ids
except UpdateAnnotationError as update_error:
abort(409, str(update_error))
except ValidationError as validation_error:
Expand All @@ -372,7 +373,7 @@ def put(self, aligned_volume_name: str, table_name: str, **kwargs):
trigger_supervoxel_lookup(aligned_volume_name, table_name, new_ids)
except Exception as e:
logging.error(f"Lookup SVID workflow failed: {e}")
return new_ids, 200
return updated_ids_mapping, 200

@auth_requires_permission(
"edit", table_arg="aligned_volume_name", resource_namespace="aligned_volume"
Expand Down

0 comments on commit fc32726

Please sign in to comment.