Subsets#

SAClient.get_subsets(project)#

Get Subsets

Parameters:

project (str) – project name (e.g., “project1”)

Returns:

subsets’ metadata

Return type:

list of dicts

SAClient.add_items_to_subset(project, subset, items)#

Associates selected items with a given subset. Non-existing subset will be automatically created.

Parameters:
  • project (str) – project name (e.g., “project1”)

  • subset (str) – a name of an existing/new subset to associate items with. New subsets will be automatically created.

  • items (list of dicts) – list of items metadata. Required keys are ‘name’ and ‘path’ if the ‘id’ key is not provided in the dict.

Returns:

dictionary with succeeded, skipped and failed items lists.

Return type:

dict

Request Example:

client = SAClient()

# option 1
queried_items = client.query(
    project="Image Project",
    query="instance(error = true)"
 )

client.add_items_to_subset(
    project="Medical Annotations",
    subset="Brain Study - Disapproved",
    items=queried_items
)
# option 2
items_list = [
    {
        'name': 'image_1.jpeg',
        'path': 'Image Project'
    },
    {
        'name': 'image_2.jpeg',
        'path': 'Image Project/Subfolder A'
    }
]

client.add_items_to_subset(
    project="Image Project",
    subset="Subset Name",
    items=items_list

)

Response Example:

{
    "succeeded": [
        {
            'name': 'image_1.jpeg',
            'path': 'Image Project'
        },
        {
            'name': 'image_2.jpeg',
            'path': 'Image Project/Subfolder A'
        }
    ],
    "failed": [],
    "skipped": []
}