Assigning & Querying Tasks

The SDK offers multiple ways to query/search through your project tasks and programmatically assign them to various users.

Search by Task Name

Use list_tasks to search for tasks by name and get their corresponding task_id. Often, users will have Task names readily accessible, and can use list_tasks to get the corresponding task_id, which may be needed in other SDK functions.
Please see a detailed reference for list_tasks here.
project = redbrick.get_project(org_id, project_id, api_key)
tasks = project.export.list_tasks() # fetches all tasks
specific_task = project.list_tasks(task_name="...") # fetches specific task by name

Assign Tasks to a User

Use assign_task when you already have the task_id you want to assign to a particular user. If you don’t have the task_id, you can query all the Tasks using list_tasks or query tasks assigned to a particular user/unassigned tasks using list_tasks(user_id="...").

Assign to a Specific User

project = redbrick.get_project(org_id, project_id, api_key)
# Assign tasks in Label stage to a specific user
project.labeling.assign_tasks(task_ids=["..."], email="...")
# Assign tasks in Review stage to specific user["..."], email="...")

Retrieve Queued Tasks

Use list_tasks in conjunction with a specific user_id when you want to retrieve the Tasks assigned to a particular user. This can be useful in preparation for using assign_tasks to programmatically assigning unassigned tasks, or put_tasks to programmatically label/review tasks assigned to you.

Retrieve Tasks Assigned to Specific User

project = redbrick.get_project(org_id, project_id, api_key)
# Get Tasks assigned to [email protected] in Label Stage
project.export.list_tasks(labeling.(stage_name="Label", user_id="[email protected]")
# Get Tasks assigned to [email protected] in Review_1 Stage
project.export.list_tasks(stage_name="Review_1", user_id="[email protected]")

Retrieve Unassigned Tasks

You can also fetch all unassigned Tasks in a particular stage. This information may be useful when choosing which Tasks to assign to users.
project = redbrick.get_project(org_id, project_id, api_key)
# Get unassigned tasks in Label labeling stage
project.export.list_tasks(redbrick.TaskFilters.UNASSIGNED, stage_name="Label")
# Get unassigned tasks in Review_1 review stage
project.export.list_tasks(redbrick.TaskFilters.UNASSIGNED, stage_name="Review_1")

Retrieve Tasks Assigned to You

With the correct configuration of list_tasks(), you can perform functions as specific as retrieving a list of Tasks from a specific Stage to your specific API key. Please see the code snippet below for an example:
project = redbrick.get_project(org_id, project_id, api_key)
# Get tasks assigned to your API key in Label stage
Several of our old methods were deprecated with the release of v.2.1.12.
We highly recommend reading carefully through our SDK Format Reference or reaching out to our Support Team with any questions or concerns.
We're always happy to give pointers!