Collection Objects

class Collection()

Represents collections in Index. Collections are a logical grouping of data items that can be used to create datasets and perform various data curation flows.

uuid

@property
def uuid() -> uuid.UUID

Get the collection unique identifier (UUID).

Returns:

  • uuid.UUID - The collection UUID.

name

@property
def name() -> str

Get the collection name.

Returns:

  • str - The collection name.

description

@property
def description() -> Optional[str]

Get the collection description.

Returns:

  • Optional[str] - The collection description, or None if not available.

created_at

@property
def created_at() -> Optional[datetime]

Get the collection creation timestamp.

Returns:

  • Optional[datetime] - The timestamp when the collection was created, or None if not available.

last_edited_at

@property
def last_edited_at() -> Optional[datetime]

Get the collection last edit timestamp.

Returns:

  • Optional[datetime] - The timestamp when the collection was last edited, or None if not available.

update_collection

def update_collection(name: Optional[str] = None,
                      description: Optional[str] = None) -> None

Update the collection’s name and/or description.

Arguments:

  • name Optional[str] - The new name for the collection.
  • description Optional[str] - The new description for the collection.

list_items

def list_items(page_size: Optional[int] = None) -> "Generator[StorageItem]"

List storage items in the collection.

Arguments:

  • page_size Optional[int] - The number of items to fetch per page.

Returns:

  • Generator[StorageItem] - An iterator containing storage items in the collection.

list_items_include_inaccessible

def list_items_include_inaccessible(
    page_size: Optional[int] = None
) -> "Generator[Union[StorageItem, StorageItemInaccessible]]"

This method is in BETA. For most use cases we recommend using list_items with Collections.
List storage items in the collection, including those that are inaccessible.

Arguments:

  • page_size Optional[int] - The number of items to fetch per page.

Returns:

Generator[Union[StorageItem, StorageItemInaccessible]]: An iterator containing both accessible and inaccessible storage items in the collection.

add_items

def add_items(
        storage_item_uuids: List[Union[UUID,
                                       str]]) -> CollectionBulkItemResponse

Add storage items to the collection.

Arguments:

  • storage_item_uuids List[Union[UUID, str]] - The list of storage item UUIDs or strings to be added.

Returns:

  • CollectionBulkItemResponse - The response after adding items to the collection.

remove_items

def remove_items(
        storage_item_uuids: List[Union[UUID,
                                       str]]) -> CollectionBulkItemResponse

Remove storage items from the collection.

Arguments:

  • storage_item_uuids List[Union[UUID, str]] - The list of storage item UUIDs or strings to be removed.

Returns:

  • CollectionBulkItemResponse - The response after removing items from the collection.

add_preset_items

def add_preset_items(filter_preset: Union[FilterPreset, UUID, str]) -> None

Async operation to add storage items matching a filter preset to the collection.

Arguments:

  • filter_preset Union[FilterPreset, UUID, str] - The filter preset or its UUID/ID used to filter items.

remove_preset_items

def remove_preset_items(filter_preset: Union[FilterPreset, UUID, str]) -> None

Async operation to remove storage items matching a filter preset from the collection.

Arguments:

  • filter_preset Union[FilterPreset, UUID, str] - The filter preset or its UUID/ID used to filter items.