Workflows#

Workflows are a powerful tool to design and build your projects - letting you control how an annotation task moves through different stages of the project, as well as determining how different stages are structured and interact with one another.

Please note that we are rolling this feature out into open availability in Beta mode. While it’s already powerful and flexible, many features are still in development and will be added progressively.

1. Creating a Workflow project#

Creating Workflow projects using the SDK is only possible using workflow templates. However, templates can only be created using the Encord web-app - please see our tutorial on how to create Workflow templates to learn more.

Once the template has been created, use the ‘template ID’ as the template hash parameter in the create_project() method.

2. Attributes for Workflow projects#

Please note that the attributes outlined below can only be used when working with Workflow projects.

Our SDK currently has three attributes specific to working with Workflow projects:

  • The workflow_graph_node() attribute returns the location of a task within the workflow in the form of a ‘uuid’ and a ‘title’. The ‘title’ corresponds to the name of the current stage in the workflow.

  • The workflows_reopen() attribute returns a label row to the first annotation stage for re-labeling. No data is lost during the call.

  • The workflows_complete() attribute moves a label row to the final annotation stage.

3. Working with Workflow projects#

The example below returns all label rows in a project to the first annotation stage.

from encord import EncordUserClient, Project

user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
    "<your_private_key>"
)
project: Project = user_client.get_project("<workflows_project_hash>")

for label_row in project.list_label_rows_v2():
    label.workflow_reopen()

The example below shows how both attributes can be used to revert tasks in “<review_stage_2>” back ot the first annotation stage of a workflow:

from encord import EncordUserClient, Project

user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
    "<your_private_key>"
)
project: Project = user_client.get_project("<workflows_project_hash>")

for label_row in project.list_label_rows_v2():
    if label_rows.workflow_graph_node.title == "<review_stage_2>":
        label.workflow_reopen()