Workflows

Workflow

Workflow class in Projects.

get_stage

Parameters

  • name: Name of the stage.

  • uuid: Unique identifier for the stage.

  • type_: The type of stage.

    def get_stage(
        self,
        *,
        name: Optional[str] = None,
        uuid: Optional[UUID | str] = None,
        type_: Optional[Type[WorkflowStageT]] = None,
    )

Returns

Returns Workflow stages from non-Consensus and Consensus Projects.

WorkflowStages

Move your tasks through a Workflow Project using the WorkflowStage class. However, tasks CANNOT "teleport" through your Workflow. Tasks must move through the Workflow in logical order.

All tasks return iterators. This means you can retrieve the entire set of data from tasks without any manual handling.

def get_tasks(self, stage_uuid: UUID, params: TasksQueryParams, type_: Type[T]) -> Iterable[T]:

These are the stages currently supported:

  • AnnotationStage
  • ReviewStage
  • ConsensusAnnotationStage
  • ConsensusReviewStage
  • FinalStage (Complete and Archive)

AnnotationStage

An Annotate stage in a non-Consensus Project.

This stage is used Consensus and non-Consensus Projects.

get_tasks

Parameters

  • assignee: User assigned to a task.

  • data_hash: Unique ID for the data unit.

  • dataset_hash: Unique ID for the dataset that the data unit belongs to.

  • data_title: Name of the data unit.

  • status: Status of the data unit.

    def get_tasks(
        self,
        *,
        assignee: Union[List[str], str, None] = None,
        data_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        dataset_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        data_title: Optional[str] = None,
        status: Union[AnnotationTaskStatus, List[AnnotationTaskStatus], None] = None,

    )

Returns

Returns tasks in the stage with the following information:

  • uuid: Unique identifier for the task.
  • created_at: Time and date the task was created.
  • updated_at: Time and date the task was last edited.
  • data_hash: Unique identifier for the data unit.
  • data_title: Name/title of the data unit.
  • label_branch_name: The value is always main for non-Consensus Annotation nodes
  • assignee: The user currently assigned to the task. The value is None if no one is assigned to the task.
  • status" The status of the task.

ReviewStage

The Review stage for non-Consensus Projects.

This stage is used Consensus and non-Consensus Projects.

get_tasks

Parameters

  • assignee: User assigned to a task.

  • data_hash: Unique ID for the data unit.

  • dataset_hash: Unique ID for the dataset that the data unit belongs to.

  • data_title: Name of the data unit.

  • status: The status of the data unit.

    def get_tasks(
        self,
        *,
        assignee: Union[List[str], str, None] = None,
        data_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        dataset_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        data_title: Optional[str] = None,
        status: Union[ReviewTaskStatus, List[ReviewTaskStatus], None] = None,

    )

Returns

Returns tasks in the stage with the following information:

  • uuid: Unique identifier for the task.
  • created_at: Time and date the task was created.
  • updated_at: Time and date the task was last edited.
  • assignee: The user currently assigned to the task. The value is None if no one is assigned to the task.
  • data_hash: Unique identifier for the data unit.
  • data_title: Name/title of the data unit.
  • status: The status of the task.

get_label_reviews

Retrieves label reviews for the Review task.

Parameters

  • status (Union[ReviewTaskStatus, List[ReviewTaskStatus], None]): Status of the task.

Returns

An iterable of ReviewTask instances with the following information:

  • uuid: Unique identifier for label review.
  • status: Current status of the label review.
  • label_type: Type of the label.
  • label_id: Unique identifier of the label.

ConsensusAnnotationStage

The Annotate stage in a Consensus Project.

get_tasks

  • assignee: User assigned to a task.

  • data_hash: Unique ID for the data unit.

  • dataset_hash: Unique ID for the dataset that the data unit belongs to.

  • data_title: Name of the data unit.


    def get_tasks(
        self,
        *,
        assignee: Union[List[str], str, None] = None,
        data_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        dataset_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        data_title: Optional[str] = None,
 
    )

Returns

Returns tasks in the stage with the following information:

  • uuid: Unique identifier for the task.
  • created_at: Time and date the task was created.
  • updated_at: Time and date the task was last edited.
  • data_hash: Unique identifier for the data unit.
  • data_title: Name/title of the data unit.
  • subtasks: A list of subtasks that follow the task format for AnotationTask.

ConsensusReviewStage

The Review stage for Consensus Projects.

get_tasks

  • assignee: User assigned to a task.

  • data_hash: Unique ID for the data unit.

  • dataset_hash: Unique ID for the dataset that the data unit belongs to.

  • data_title: Name of the data unit.

  • status: The status of the data unit.


    def get_tasks(
        self,
        *,
        assignee: Union[List[str], str, None] = None,
        data_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        dataset_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        data_title: Optional[str] = None,
        status: Union[ConsensusReviewTaskStatus, List[ConsensusReviewTaskStatus], None] = None,

    )

Returns

Returns tasks in the stage with the following information:

  • uuid: Unique identifier for the task.
  • created_at: Time and date the task was created.
  • updated_at: Time and date the task was last edited.
  • assignee: The user currently assigned to the task. The value is None if no one is assigned to the task.
  • data_hash: Unique identifier for the data unit.
  • data_title: Name/title of the data unit.
  • status" The status of the task.
  • options: List of ConsensusReviewOptions. ConsensusReviewOptions are the labels avaialble for each subtask. ConsensusReviewOptions include the following information: annotator, label_branch_name, label_hash.

FinalStage

Final stage for a task in Consensus and non-Consensus Projects.

get_tasks

Parameters

  • data_hash: Unique ID for the data unit.

  • dataset_hash: Unique ID for the dataset that the data unit belongs to.

  • data_title: Name of the data unit.


    def get_tasks(
        self,
        data_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        dataset_hash: Union[List[UUID], UUID, List[str], str, None] = None,
        data_title: Optional[str] = None,
    )

Returns

Returns tasks in the stage with the following information:

  • uuid: Unique identifier for the task.
  • created_at: Time and date the task was created.
  • updated_at: Time and date the task was last edited.
  • data_hash: Unique identifier for the data unit.
  • data_title: Name/title of the data unit.

WorkflowTasks

AnnotationTask

Tasks in non-Consensus Annotate stage.

Parameters

  • assignee: User assigned to a task.

  • data_hash: Unique ID for the data unit.

  • data_title: Name of the data unit.

  • label_branch_name: Name of the label branch

Allowed actions:

  • submit: Submits a task for review.
  • assign: Assigns a task to a user.
  • release: Releases a task from the current user.

    data_hash: UUID
    data_title: str
    label_branch_name: str
    assignee: Optional[str]

    def submit(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionSubmit(task_uuid=self.uuid))

    def assign(self, assignee: str) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionAssign(task_uuid=self.uuid, assignee=assignee))

    def release(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionRelease(task_uuid=self.uuid))

Returns

Returns nothing.

ReviewTask

Tasks in non-Consensus Review stages.

Parameters

  • assignee: Optional[str]
  • data_hash: UUID
  • data_title: str

Allowed actions:

  • approve: Approves a task
  • reject: Rejects a task.
  • assign: Assigns a task to a user.
  • release: Releases a task from the current user.

    assignee: Optional[str]
    data_hash: UUID
    data_title: str

    def approve(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionApprove(task_uuid=self.uuid))

    def reject(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionReject(task_uuid=self.uuid))

    def assign(self, assignee: str) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionAssign(task_uuid=self.uuid, assignee=assignee))

    def release(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionRelease(task_uuid=self.uuid))

Returns

Returns nothing.

ConsensusAnnotationTask

Tasks in the Annotate stage of a Consensus Project.

Parameters

  • data_hash: Unique ID for the data unit.

  • data_title: Name of the data unit.

  • subtasks: List[AnnotationTask] = Field(default_factory=list): Tasks from individual annotators in a Consensus Project.


    data_hash: UUID
    data_title: str
    subtasks: List[AnnotationTask] = Field(default_factory=list)

Returns

Returns nothing.

ConsensusReviewTask

Tasks in the Review stage of a Consensus Project.

Parameters

  • assignee: User assigned to a task.

  • data_hash: Unique ID for the data unit.

  • data_title: Name of the data unit.

  • options: Specify the labels for the task.

Allowed actions:

  • approve: Approves a task
  • reject: Rejects a task.
  • assign: Assigns a task to a user.
  • release: Releases a task from the current user.

    assignee: Optional[str]
    data_hash: UUID
    data_title: str
    options: List[ConsensusReviewOption]

    def approve(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionApprove(task_uuid=self.uuid))

    def reject(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionReject(task_uuid=self.uuid))

    def assign(self, assignee: str) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionAssign(task_uuid=self.uuid, assignee=assignee))

    def release(self) -> None:
        workflow_client, stage_uuid = self._get_client_data()
        workflow_client.action(stage_uuid, _ActionRelease(task_uuid=self.uuid))

Returns

Returns nothing.

FinalStageTask

Tasks in a FinalStage can only be queried. No actions can be taken on the task.

Parameters

  • dataset_hash: Unique ID for the dataset that the data unit belongs to.

  • data_title: Name of the data unit.

Returns

Returns nothing.

TaskStatus

AnnotationTaskStatus

The following statuses are available for ANNOTATE tasks:

  • NEW: Tasks that are unassigned.
  • ASSIGNED: Tasks that are assigned to a user.
  • RELEASED: Tasks that were released from an assigned user.
  • REOPENED: Tasks that were reopened.
  • SKIPPED: Tasks that were skipped by annotators.
  • COMPLETED: Tasks that are in the Complete stage. Used for Annotation sub-tasks in Consensus Annotation tasks.

ℹ️

Note

Consensus Annotation tasks consist of 1 or more Annotation sub-tasks.

ReviewTaskStatus

The following statuses are available for REVIEW tasks:

  • NEW: Tasks that are unassigned.
  • ASSIGNED: Tasks that are assigned to a user.
  • RELEASED: Tasks that were released from an assigned user.
  • REOPENED: Tasks that were reopened.

ConsensusReviewTaskStatus

The following statuses are available for CONSENSUS REVIEW tasks:

  • NEW: Tasks that are unassigned.
  • ASSIGNED: Tasks that are assigned to a user.
  • RELEASED: Tasks that were released from an assigned user.
  • REOPENED: Tasks that were reopened.