Skip to content

Add support for collection items in copy/move actions#32

Open
GoldenAnpu wants to merge 3 commits into
masterfrom
add-collection-items-support
Open

Add support for collection items in copy/move actions#32
GoldenAnpu wants to merge 3 commits into
masterfrom
add-collection-items-support

Conversation

@GoldenAnpu

@GoldenAnpu GoldenAnpu commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description

Adds collection as a supported items type for copy / move actions: an entities collection is resolved into a flat list of images and transferred into the destination dataset without preserving source structure.

Changes

  • resolve_collection_items() — resolves each collection item via api.entities_collection.get_info_by_id() + get_items() into a flat list of image items. Supports both default and aiSearch collection types. Falls back to the collection's own project_id when source.project.id is not set in the state.
  • copy_collection_items_to_dataset() / move_collection_items_to_dataset() — dedicated processing path: all images land in the destination dataset without preserving source structure. Move keeps the existing safety net: source items are not deleted unless every item was transferred.
  • disambiguate_collection_names() — a collection can contain same-named images from different datasets; every image involved in a name conflict gets _<src dataset ID> appended before the extension (e.g. img.png from datasets 100 and 200 → img_100.png / img_200.png), so the origin of each copy stays visible. Residual collisions are resolved via generate_free_name. Without this, skip/replace modes silently dropped duplicates (and cancelled source deletion on move), while rename mode could fail the whole upload batch.
  • rename_filtered_collection() — auto-created filter collections (named like Filtered entities 2026-07-03T14-31-57-501Z) are renamed to Data Commander (Task <ID>) when the task processes them, so it is clear which task handled the collection. Collections with custom names are left untouched; a rename failure does not fail the task.
  • Conflicts with pre-existing destination images are still handled by options.conflictResolutionMode.
  • Images listed both explicitly and via a collection are transferred once.

State example

{
  "state": {
    "action": "copy",
    "options": {"conflictResolutionMode": "rename", "cloneAnnotations": true, "preserveSrcDate": false},
    "items": [{"id": 2863, "type": "collection"}],
    "source": {"team": {"id": 10}, "workspace": {"id": 9}, "project": {"id": 7548}},
    "destination": {"team": {"id": 10}, "workspace": {"id": 9}, "project": {"id": 7549}, "dataset": {"id": 45188}}
  }
}

Notes

  • Name disambiguation logic covered by standalone checks: two datasets, triple duplicate, name without extension, suffix collision with an existing name.

Resolve entities collection IDs from modal.state.items into a flat list
of images and process them via a dedicated path. Same-named images from
different datasets get the source dataset ID appended to the name.
@GoldenAnpu GoldenAnpu force-pushed the add-collection-items-support branch from 738b987 to d5d3a83 Compare July 3, 2026 14:51
Collections named like "Filtered entities <timestamp>" are renamed to
"Data Commander (Task <ID>)" when the task processes them, so the
origin of the collection stays visible. Custom-named collections are
left untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant