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 enitre 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.

    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.
  • label_branch_name: The value is always main for non-Consensus Projects
  • assignee: The user currently assigned to the task. The value is None if no one is assigned to 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.

    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.
  • 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.

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.


    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.
  • 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.
  • 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.