Skip to content

Project Workflow module

Client presentation methods for project workflow.

Source code in kili/presentation/client/project_workflow.py
class ProjectWorkflowClientMethods(BaseClientMethods):
    """Client presentation methods for project workflow."""

    @typechecked
    def update_project_workflow(
        self,
        project_id: str,
        enforce_step_separation: Optional[bool] = None,
        create_steps: Optional[list[WorkflowStepCreate]] = None,
        update_steps: Optional[list[WorkflowStepUpdate]] = None,
        delete_steps: Optional[list[str | WorkflowStepDesignation]] = None,
    ) -> dict[str, Any]:
        """Update properties of a project workflow.

        Args:
            project_id: Id of the project.
            enforce_step_separation: Prevents the same user from being assigned to
                multiple steps in the workflow for a same asset,
                ensuring independent review and labeling processes
            create_steps: List of steps to create in the project workflow. In the multi-group
                workflow, each step gives the `step_group_id` of the group to create it in, and
                consensus can only be set on the labeling step of the first group.
            update_steps: List of steps to update in the project workflow, each given by its `id`,
                or by its `name` with `group_name` when several groups use that name.
            delete_steps: List of steps to delete from the project workflow, each given by its ID,
                by its name, or as `{"name": ..., "group_name": ...}` when several groups use
                that name.

        Returns:
            A dict with the changed properties which indicates if the mutation was successful,
                else an error message.
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).update_project_workflow(
            project_id=ProjectId(project_id),
            enforce_step_separation=enforce_step_separation,
            create_steps=create_steps,
            update_steps=update_steps,
            delete_steps=delete_steps,
        )

    @typechecked
    def get_steps(
        self,
        project_id: str,
        fields: ListOrTuple[str] = (
            "steps.type",
            "steps.name",
            "steps.id",
            "steps.stepGroupId",
            "steps.assignees.email",
            "steps.assignees.id",
        ),
    ) -> list[dict[str, Any]]:
        """Get steps in a project workflow.

        Args:
            project_id: Id of the project.
            fields: All the fields to request among the possible fields for the project.
                See the documentation for all possible fields.

        Returns:
            A dict with the steps of the project workflow.
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).get_steps(
            project_id=ProjectId(project_id), fields=fields
        )

    @typechecked
    def add_reviewers_to_step(
        self,
        project_id: str,
        step_name: Optional[str] = None,
        emails: Optional[list[str]] = None,
        group_name: Optional[str] = None,
        step_id: Optional[str] = None,
    ) -> list[str]:
        """Add reviewers to a specific step.

        Args:
            project_id: Id of the project.
            step_name: Name of the step. Exclusive with `step_id`.
            emails: List of emails to add.
            group_name: Name of the group containing the step named `step_name`, in the multi-group
                workflow.
                Required when several groups have a step with the same name.
            step_id: Id of the step. Exclusive with `step_name` and `group_name`.

        Returns:
            A list with the added emails.
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).add_reviewers_to_step(
            project_id=project_id,
            step_name=step_name,
            emails=_required(emails, "emails"),
            group_name=group_name,
            step_id=step_id,
        )

    @typechecked
    def remove_reviewers_from_step(
        self,
        project_id: str,
        step_name: Optional[str] = None,
        emails: Optional[list[str]] = None,
        group_name: Optional[str] = None,
        step_id: Optional[str] = None,
    ) -> list[str]:
        """Remove reviewers from a specific step.

        Args:
            project_id: Id of the project.
            step_name: Name of the step. Exclusive with `step_id`.
            emails: List of emails to remove.
            group_name: Name of the group containing the step named `step_name`, in the multi-group
                workflow.
                Required when several groups have a step with the same name.
            step_id: Id of the step. Exclusive with `step_name` and `group_name`.

        Returns:
            A list with the removed emails.
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).remove_reviewers_from_step(
            project_id=project_id,
            step_name=step_name,
            emails=_required(emails, "emails"),
            group_name=group_name,
            step_id=step_id,
        )

    @typechecked
    def add_labelers_to_step(
        self,
        project_id: str,
        step_name: Optional[str] = None,
        emails: Optional[list[str]] = None,
        group_name: Optional[str] = None,
        step_id: Optional[str] = None,
    ) -> list[str]:
        """Add labelers to a specific labeling step.

        Only the multi-group workflow supports assigning labelers to a step, and the target step
        must be a labeling step.

        Args:
            project_id: Id of the project.
            step_name: Name of the labeling step. Exclusive with `step_id`.
            emails: List of emails to add.
            group_name: Name of the group containing the step named `step_name`, in the multi-group
                workflow.
                Required when several groups have a step with the same name.
            step_id: Id of the step. Exclusive with `step_name` and `group_name`.

        Returns:
            A list with the added emails.
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).add_labelers_to_step(
            project_id=project_id,
            step_name=step_name,
            emails=_required(emails, "emails"),
            group_name=group_name,
            step_id=step_id,
        )

    @typechecked
    def remove_labelers_from_step(
        self,
        project_id: str,
        step_name: Optional[str] = None,
        emails: Optional[list[str]] = None,
        group_name: Optional[str] = None,
        step_id: Optional[str] = None,
    ) -> list[str]:
        """Remove labelers from a specific labeling step.

        Only the multi-group workflow supports removing labelers from a step, and the target step
        must be a labeling step. Removing a labeler also clears their asset-step assignments and
        step queue for that step.

        Args:
            project_id: Id of the project.
            step_name: Name of the labeling step. Exclusive with `step_id`.
            emails: List of emails to remove.
            group_name: Name of the group containing the step named `step_name`, in the multi-group
                workflow.
                Required when several groups have a step with the same name.
            step_id: Id of the step. Exclusive with `step_name` and `group_name`.

        Returns:
            A list with the removed emails.
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).remove_labelers_from_step(
            project_id=project_id,
            step_name=step_name,
            emails=_required(emails, "emails"),
            group_name=group_name,
            step_id=step_id,
        )

    @typechecked
    def copy_workflow_from_project(
        self,
        destination_project_id: str,
        source_project_id: str,
    ) -> dict[str, Any]:
        """Copy the workflow from a source project to a destination project.

        Copies all workflow steps with their configurations (consensus, coverage,
        sendBackStepId) from the source project. Assignees are not copied.

        The destination project must have no labels. Existing workflow steps in the
        destination project will be deleted and replaced by the source workflow.

        Args:
            destination_project_id: Id of the destination project to copy the workflow to.
            source_project_id: Id of the source project to copy the workflow from.

        Returns:
            A dict with the workflow data which indicates if the mutation was successful,
                else an error message.

        Raises:
            ValueError: If the source project has no workflow steps, or if the
                destination project already has labels.

        Examples:
            >>> kili.copy_workflow_from_project(
            ...     destination_project_id="destination_project_id",
            ...     source_project_id="source_project_id",
            ... )
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).copy_workflow_from_project(
            source_project_id=ProjectId(source_project_id),
            destination_project_id=ProjectId(destination_project_id),
        )

    @typechecked
    def add_review_step(
        self,
        project_id: str,
        step_name: str,
        assignees: list[str],
        step_coverage: int | None = None,
        use_honeypot: bool | None = None,
        send_back_to_step: str | None = None,
        group_name: str | None = None,
    ) -> dict[str, Any]:
        """Add a review step to a project workflow, at the end of its group.

        Args:
            project_id: Id of the project.
            step_name: Name of the new review step.
            assignees: List of user emails to assign as reviewers.
            step_coverage: Percentage of assets to be reviewed in this step (0-100).
            use_honeypot: Whether to use honeypot on this step.
            send_back_to_step: Name of the step to send assets back to, in the same group.
            group_name: Name of the group to add the step to, in the multi-group workflow.
                Required when the project has several groups.

        Returns:
            A dict with the created step data (id, name).
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).add_review_step(
            project_id=project_id,
            step_name=step_name,
            assignees=assignees,
            step_coverage=step_coverage,
            use_honeypot=use_honeypot,
            send_back_to_step=send_back_to_step,
            group_name=group_name,
        )

    @typechecked
    def update_labeling_step_properties(
        self,
        project_id: str,
        step_name: str | None = None,
        consensus_coverage: int | None = None,
        number_of_expected_labels_for_consensus: int | None = None,
        use_honeypot: bool | None = None,
        group_name: str | None = None,
        step_id: str | None = None,
    ) -> dict[str, Any]:
        """Update properties of a labeling step.

        Args:
            project_id: Id of the project.
            step_name: Name of the labeling step to update. Exclusive with `step_id`.
            consensus_coverage: Percentage of assets to be labeled for consensus (0-100).
                In the multi-group workflow, consensus can only be set on the labeling step of
                the first group.
            number_of_expected_labels_for_consensus: Number of expected labels for consensus.
            use_honeypot: Whether to use honeypot on this step.
            group_name: Name of the group containing the step named `step_name`, in the multi-group
                workflow.
                Required when several groups have a step with the same name.
            step_id: Id of the step to update. Exclusive with `step_name` and `group_name`.

        Returns:
            A dict with the updated step data (id, name).
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).update_labeling_step_properties(
            project_id=project_id,
            step_name=step_name,
            consensus_coverage=consensus_coverage,
            number_of_expected_labels_for_consensus=number_of_expected_labels_for_consensus,
            use_honeypot=use_honeypot,
            group_name=group_name,
            step_id=step_id,
        )

    @typechecked
    def update_review_step_properties(
        self,
        project_id: str,
        step_name: str | None = None,
        assignees: list[str] | None = None,
        step_coverage: int | None = None,
        send_back_to_step: str | None = None,
        use_honeypot: bool | None = None,
        group_name: str | None = None,
        step_id: str | None = None,
    ) -> dict[str, Any]:
        """Update properties of a review step.

        Args:
            project_id: Id of the project.
            step_name: Name of the review step to update. Exclusive with `step_id`.
            assignees: List of emails to assign to the step.
            step_coverage: Percentage of assets to be reviewed in this step (0-100).
            send_back_to_step: Id of the step to send assets back to when rejected.
            use_honeypot: Whether to use honeypot on this step.
            group_name: Name of the group containing the step named `step_name`, in the multi-group
                workflow.
                Required when several groups have a step with the same name.
            step_id: Id of the step to update. Exclusive with `step_name` and `group_name`.

        Returns:
            A dict with the updated step data (id, name).
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).update_review_step_properties(
            project_id=project_id,
            step_name=step_name,
            assignees=assignees,
            step_coverage=step_coverage,
            send_back_to_step=send_back_to_step,
            use_honeypot=use_honeypot,
            group_name=group_name,
            step_id=step_id,
        )

    @typechecked
    def delete_last_step(
        self,
        project_id: str,
    ) -> dict[str, Any]:
        """Delete the last review step from a project workflow.

        Args:
            project_id: Id of the project.

        Returns:
            A dict with the remaining steps.
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).delete_last_step(
            project_id=project_id,
        )

    @typechecked
    def rename_step(
        self,
        project_id: str,
        step_name: str | None = None,
        new_name: str | None = None,
        group_name: str | None = None,
        step_id: str | None = None,
    ) -> dict[str, Any]:
        """Rename a step in a project workflow.

        Args:
            project_id: Id of the project.
            step_name: Name of the step. Exclusive with `step_id`.
            new_name: New name for the step.
            group_name: Name of the group containing the step named `step_name`, in the multi-group
                workflow.
                Required when several groups have a step with the same name.
            step_id: Id of the step. Exclusive with `step_name` and `group_name`.

        Returns:
            A dict with the renamed step data (id, name).
        """
        return ProjectWorkflowUseCases(self.kili_api_gateway).rename_step(
            project_id=project_id,
            step_name=step_name,
            new_name=_required(new_name, "new_name"),
            group_name=group_name,
            step_id=step_id,
        )

add_labelers_to_step(self, project_id, step_name=None, emails=None, group_name=None, step_id=None)

Add labelers to a specific labeling step.

Only the multi-group workflow supports assigning labelers to a step, and the target step must be a labeling step.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name Optional[str]

Name of the labeling step. Exclusive with step_id.

None
emails Optional[list[str]]

List of emails to add.

None
group_name Optional[str]

Name of the group containing the step named step_name, in the multi-group workflow. Required when several groups have a step with the same name.

None
step_id Optional[str]

Id of the step. Exclusive with step_name and group_name.

None

Returns:

Type Description
list

A list with the added emails.

Source code in kili/presentation/client/project_workflow.py
def add_labelers_to_step(
    self,
    project_id: str,
    step_name: Optional[str] = None,
    emails: Optional[list[str]] = None,
    group_name: Optional[str] = None,
    step_id: Optional[str] = None,
) -> list[str]:
    """Add labelers to a specific labeling step.

    Only the multi-group workflow supports assigning labelers to a step, and the target step
    must be a labeling step.

    Args:
        project_id: Id of the project.
        step_name: Name of the labeling step. Exclusive with `step_id`.
        emails: List of emails to add.
        group_name: Name of the group containing the step named `step_name`, in the multi-group
            workflow.
            Required when several groups have a step with the same name.
        step_id: Id of the step. Exclusive with `step_name` and `group_name`.

    Returns:
        A list with the added emails.
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).add_labelers_to_step(
        project_id=project_id,
        step_name=step_name,
        emails=_required(emails, "emails"),
        group_name=group_name,
        step_id=step_id,
    )

add_review_step(self, project_id, step_name, assignees, step_coverage=None, use_honeypot=None, send_back_to_step=None, group_name=None)

Add a review step to a project workflow, at the end of its group.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name str

Name of the new review step.

required
assignees list

List of user emails to assign as reviewers.

required
step_coverage int | None

Percentage of assets to be reviewed in this step (0-100).

None
use_honeypot bool | None

Whether to use honeypot on this step.

None
send_back_to_step str | None

Name of the step to send assets back to, in the same group.

None
group_name str | None

Name of the group to add the step to, in the multi-group workflow. Required when the project has several groups.

None

Returns:

Type Description
dict

A dict with the created step data (id, name).

Source code in kili/presentation/client/project_workflow.py
def add_review_step(
    self,
    project_id: str,
    step_name: str,
    assignees: list[str],
    step_coverage: int | None = None,
    use_honeypot: bool | None = None,
    send_back_to_step: str | None = None,
    group_name: str | None = None,
) -> dict[str, Any]:
    """Add a review step to a project workflow, at the end of its group.

    Args:
        project_id: Id of the project.
        step_name: Name of the new review step.
        assignees: List of user emails to assign as reviewers.
        step_coverage: Percentage of assets to be reviewed in this step (0-100).
        use_honeypot: Whether to use honeypot on this step.
        send_back_to_step: Name of the step to send assets back to, in the same group.
        group_name: Name of the group to add the step to, in the multi-group workflow.
            Required when the project has several groups.

    Returns:
        A dict with the created step data (id, name).
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).add_review_step(
        project_id=project_id,
        step_name=step_name,
        assignees=assignees,
        step_coverage=step_coverage,
        use_honeypot=use_honeypot,
        send_back_to_step=send_back_to_step,
        group_name=group_name,
    )

add_reviewers_to_step(self, project_id, step_name=None, emails=None, group_name=None, step_id=None)

Add reviewers to a specific step.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name Optional[str]

Name of the step. Exclusive with step_id.

None
emails Optional[list[str]]

List of emails to add.

None
group_name Optional[str]

Name of the group containing the step named step_name, in the multi-group workflow. Required when several groups have a step with the same name.

None
step_id Optional[str]

Id of the step. Exclusive with step_name and group_name.

None

Returns:

Type Description
list

A list with the added emails.

Source code in kili/presentation/client/project_workflow.py
def add_reviewers_to_step(
    self,
    project_id: str,
    step_name: Optional[str] = None,
    emails: Optional[list[str]] = None,
    group_name: Optional[str] = None,
    step_id: Optional[str] = None,
) -> list[str]:
    """Add reviewers to a specific step.

    Args:
        project_id: Id of the project.
        step_name: Name of the step. Exclusive with `step_id`.
        emails: List of emails to add.
        group_name: Name of the group containing the step named `step_name`, in the multi-group
            workflow.
            Required when several groups have a step with the same name.
        step_id: Id of the step. Exclusive with `step_name` and `group_name`.

    Returns:
        A list with the added emails.
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).add_reviewers_to_step(
        project_id=project_id,
        step_name=step_name,
        emails=_required(emails, "emails"),
        group_name=group_name,
        step_id=step_id,
    )

copy_workflow_from_project(self, destination_project_id, source_project_id)

Copy the workflow from a source project to a destination project.

Copies all workflow steps with their configurations (consensus, coverage, sendBackStepId) from the source project. Assignees are not copied.

The destination project must have no labels. Existing workflow steps in the destination project will be deleted and replaced by the source workflow.

Parameters:

Name Type Description Default
destination_project_id str

Id of the destination project to copy the workflow to.

required
source_project_id str

Id of the source project to copy the workflow from.

required

Returns:

Type Description
dict

A dict with the workflow data which indicates if the mutation was successful, else an error message.

Exceptions:

Type Description
ValueError

If the source project has no workflow steps, or if the destination project already has labels.

Examples:

>>> kili.copy_workflow_from_project(
...     destination_project_id="destination_project_id",
...     source_project_id="source_project_id",
... )
Source code in kili/presentation/client/project_workflow.py
def copy_workflow_from_project(
    self,
    destination_project_id: str,
    source_project_id: str,
) -> dict[str, Any]:
    """Copy the workflow from a source project to a destination project.

    Copies all workflow steps with their configurations (consensus, coverage,
    sendBackStepId) from the source project. Assignees are not copied.

    The destination project must have no labels. Existing workflow steps in the
    destination project will be deleted and replaced by the source workflow.

    Args:
        destination_project_id: Id of the destination project to copy the workflow to.
        source_project_id: Id of the source project to copy the workflow from.

    Returns:
        A dict with the workflow data which indicates if the mutation was successful,
            else an error message.

    Raises:
        ValueError: If the source project has no workflow steps, or if the
            destination project already has labels.

    Examples:
        >>> kili.copy_workflow_from_project(
        ...     destination_project_id="destination_project_id",
        ...     source_project_id="source_project_id",
        ... )
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).copy_workflow_from_project(
        source_project_id=ProjectId(source_project_id),
        destination_project_id=ProjectId(destination_project_id),
    )

delete_last_step(self, project_id)

Delete the last review step from a project workflow.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required

Returns:

Type Description
dict

A dict with the remaining steps.

Source code in kili/presentation/client/project_workflow.py
def delete_last_step(
    self,
    project_id: str,
) -> dict[str, Any]:
    """Delete the last review step from a project workflow.

    Args:
        project_id: Id of the project.

    Returns:
        A dict with the remaining steps.
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).delete_last_step(
        project_id=project_id,
    )

get_steps(self, project_id, fields=('steps.type', 'steps.name', 'steps.id', 'steps.stepGroupId', 'steps.assignees.email', 'steps.assignees.id'))

Get steps in a project workflow.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
fields Union[list[str], tuple[str, ...]]

All the fields to request among the possible fields for the project. See the documentation for all possible fields.

('steps.type', 'steps.name', 'steps.id', 'steps.stepGroupId', 'steps.assignees.email', 'steps.assignees.id')

Returns:

Type Description
list

A dict with the steps of the project workflow.

Source code in kili/presentation/client/project_workflow.py
def get_steps(
    self,
    project_id: str,
    fields: ListOrTuple[str] = (
        "steps.type",
        "steps.name",
        "steps.id",
        "steps.stepGroupId",
        "steps.assignees.email",
        "steps.assignees.id",
    ),
) -> list[dict[str, Any]]:
    """Get steps in a project workflow.

    Args:
        project_id: Id of the project.
        fields: All the fields to request among the possible fields for the project.
            See the documentation for all possible fields.

    Returns:
        A dict with the steps of the project workflow.
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).get_steps(
        project_id=ProjectId(project_id), fields=fields
    )

remove_labelers_from_step(self, project_id, step_name=None, emails=None, group_name=None, step_id=None)

Remove labelers from a specific labeling step.

Only the multi-group workflow supports removing labelers from a step, and the target step must be a labeling step. Removing a labeler also clears their asset-step assignments and step queue for that step.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name Optional[str]

Name of the labeling step. Exclusive with step_id.

None
emails Optional[list[str]]

List of emails to remove.

None
group_name Optional[str]

Name of the group containing the step named step_name, in the multi-group workflow. Required when several groups have a step with the same name.

None
step_id Optional[str]

Id of the step. Exclusive with step_name and group_name.

None

Returns:

Type Description
list

A list with the removed emails.

Source code in kili/presentation/client/project_workflow.py
def remove_labelers_from_step(
    self,
    project_id: str,
    step_name: Optional[str] = None,
    emails: Optional[list[str]] = None,
    group_name: Optional[str] = None,
    step_id: Optional[str] = None,
) -> list[str]:
    """Remove labelers from a specific labeling step.

    Only the multi-group workflow supports removing labelers from a step, and the target step
    must be a labeling step. Removing a labeler also clears their asset-step assignments and
    step queue for that step.

    Args:
        project_id: Id of the project.
        step_name: Name of the labeling step. Exclusive with `step_id`.
        emails: List of emails to remove.
        group_name: Name of the group containing the step named `step_name`, in the multi-group
            workflow.
            Required when several groups have a step with the same name.
        step_id: Id of the step. Exclusive with `step_name` and `group_name`.

    Returns:
        A list with the removed emails.
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).remove_labelers_from_step(
        project_id=project_id,
        step_name=step_name,
        emails=_required(emails, "emails"),
        group_name=group_name,
        step_id=step_id,
    )

remove_reviewers_from_step(self, project_id, step_name=None, emails=None, group_name=None, step_id=None)

Remove reviewers from a specific step.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name Optional[str]

Name of the step. Exclusive with step_id.

None
emails Optional[list[str]]

List of emails to remove.

None
group_name Optional[str]

Name of the group containing the step named step_name, in the multi-group workflow. Required when several groups have a step with the same name.

None
step_id Optional[str]

Id of the step. Exclusive with step_name and group_name.

None

Returns:

Type Description
list

A list with the removed emails.

Source code in kili/presentation/client/project_workflow.py
def remove_reviewers_from_step(
    self,
    project_id: str,
    step_name: Optional[str] = None,
    emails: Optional[list[str]] = None,
    group_name: Optional[str] = None,
    step_id: Optional[str] = None,
) -> list[str]:
    """Remove reviewers from a specific step.

    Args:
        project_id: Id of the project.
        step_name: Name of the step. Exclusive with `step_id`.
        emails: List of emails to remove.
        group_name: Name of the group containing the step named `step_name`, in the multi-group
            workflow.
            Required when several groups have a step with the same name.
        step_id: Id of the step. Exclusive with `step_name` and `group_name`.

    Returns:
        A list with the removed emails.
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).remove_reviewers_from_step(
        project_id=project_id,
        step_name=step_name,
        emails=_required(emails, "emails"),
        group_name=group_name,
        step_id=step_id,
    )

rename_step(self, project_id, step_name=None, new_name=None, group_name=None, step_id=None)

Rename a step in a project workflow.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name str | None

Name of the step. Exclusive with step_id.

None
new_name str | None

New name for the step.

None
group_name str | None

Name of the group containing the step named step_name, in the multi-group workflow. Required when several groups have a step with the same name.

None
step_id str | None

Id of the step. Exclusive with step_name and group_name.

None

Returns:

Type Description
dict

A dict with the renamed step data (id, name).

Source code in kili/presentation/client/project_workflow.py
def rename_step(
    self,
    project_id: str,
    step_name: str | None = None,
    new_name: str | None = None,
    group_name: str | None = None,
    step_id: str | None = None,
) -> dict[str, Any]:
    """Rename a step in a project workflow.

    Args:
        project_id: Id of the project.
        step_name: Name of the step. Exclusive with `step_id`.
        new_name: New name for the step.
        group_name: Name of the group containing the step named `step_name`, in the multi-group
            workflow.
            Required when several groups have a step with the same name.
        step_id: Id of the step. Exclusive with `step_name` and `group_name`.

    Returns:
        A dict with the renamed step data (id, name).
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).rename_step(
        project_id=project_id,
        step_name=step_name,
        new_name=_required(new_name, "new_name"),
        group_name=group_name,
        step_id=step_id,
    )

update_labeling_step_properties(self, project_id, step_name=None, consensus_coverage=None, number_of_expected_labels_for_consensus=None, use_honeypot=None, group_name=None, step_id=None)

Update properties of a labeling step.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name str | None

Name of the labeling step to update. Exclusive with step_id.

None
consensus_coverage int | None

Percentage of assets to be labeled for consensus (0-100). In the multi-group workflow, consensus can only be set on the labeling step of the first group.

None
number_of_expected_labels_for_consensus int | None

Number of expected labels for consensus.

None
use_honeypot bool | None

Whether to use honeypot on this step.

None
group_name str | None

Name of the group containing the step named step_name, in the multi-group workflow. Required when several groups have a step with the same name.

None
step_id str | None

Id of the step to update. Exclusive with step_name and group_name.

None

Returns:

Type Description
dict

A dict with the updated step data (id, name).

Source code in kili/presentation/client/project_workflow.py
def update_labeling_step_properties(
    self,
    project_id: str,
    step_name: str | None = None,
    consensus_coverage: int | None = None,
    number_of_expected_labels_for_consensus: int | None = None,
    use_honeypot: bool | None = None,
    group_name: str | None = None,
    step_id: str | None = None,
) -> dict[str, Any]:
    """Update properties of a labeling step.

    Args:
        project_id: Id of the project.
        step_name: Name of the labeling step to update. Exclusive with `step_id`.
        consensus_coverage: Percentage of assets to be labeled for consensus (0-100).
            In the multi-group workflow, consensus can only be set on the labeling step of
            the first group.
        number_of_expected_labels_for_consensus: Number of expected labels for consensus.
        use_honeypot: Whether to use honeypot on this step.
        group_name: Name of the group containing the step named `step_name`, in the multi-group
            workflow.
            Required when several groups have a step with the same name.
        step_id: Id of the step to update. Exclusive with `step_name` and `group_name`.

    Returns:
        A dict with the updated step data (id, name).
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).update_labeling_step_properties(
        project_id=project_id,
        step_name=step_name,
        consensus_coverage=consensus_coverage,
        number_of_expected_labels_for_consensus=number_of_expected_labels_for_consensus,
        use_honeypot=use_honeypot,
        group_name=group_name,
        step_id=step_id,
    )

update_project_workflow(self, project_id, enforce_step_separation=None, create_steps=None, update_steps=None, delete_steps=None)

Update properties of a project workflow.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
enforce_step_separation Optional[bool]

Prevents the same user from being assigned to multiple steps in the workflow for a same asset, ensuring independent review and labeling processes

None
create_steps Optional[list[kili.domain.project.WorkflowStepCreate]]

List of steps to create in the project workflow. In the multi-group workflow, each step gives the step_group_id of the group to create it in, and consensus can only be set on the labeling step of the first group.

None
update_steps Optional[list[kili.domain.project.WorkflowStepUpdate]]

List of steps to update in the project workflow, each given by its id, or by its name with group_name when several groups use that name.

None
delete_steps Optional[list[str | kili.domain.project.WorkflowStepDesignation]]

List of steps to delete from the project workflow, each given by its ID, by its name, or as {"name": ..., "group_name": ...} when several groups use that name.

None

Returns:

Type Description
dict

A dict with the changed properties which indicates if the mutation was successful, else an error message.

Source code in kili/presentation/client/project_workflow.py
def update_project_workflow(
    self,
    project_id: str,
    enforce_step_separation: Optional[bool] = None,
    create_steps: Optional[list[WorkflowStepCreate]] = None,
    update_steps: Optional[list[WorkflowStepUpdate]] = None,
    delete_steps: Optional[list[str | WorkflowStepDesignation]] = None,
) -> dict[str, Any]:
    """Update properties of a project workflow.

    Args:
        project_id: Id of the project.
        enforce_step_separation: Prevents the same user from being assigned to
            multiple steps in the workflow for a same asset,
            ensuring independent review and labeling processes
        create_steps: List of steps to create in the project workflow. In the multi-group
            workflow, each step gives the `step_group_id` of the group to create it in, and
            consensus can only be set on the labeling step of the first group.
        update_steps: List of steps to update in the project workflow, each given by its `id`,
            or by its `name` with `group_name` when several groups use that name.
        delete_steps: List of steps to delete from the project workflow, each given by its ID,
            by its name, or as `{"name": ..., "group_name": ...}` when several groups use
            that name.

    Returns:
        A dict with the changed properties which indicates if the mutation was successful,
            else an error message.
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).update_project_workflow(
        project_id=ProjectId(project_id),
        enforce_step_separation=enforce_step_separation,
        create_steps=create_steps,
        update_steps=update_steps,
        delete_steps=delete_steps,
    )

update_review_step_properties(self, project_id, step_name=None, assignees=None, step_coverage=None, send_back_to_step=None, use_honeypot=None, group_name=None, step_id=None)

Update properties of a review step.

Parameters:

Name Type Description Default
project_id str

Id of the project.

required
step_name str | None

Name of the review step to update. Exclusive with step_id.

None
assignees list[str] | None

List of emails to assign to the step.

None
step_coverage int | None

Percentage of assets to be reviewed in this step (0-100).

None
send_back_to_step str | None

Id of the step to send assets back to when rejected.

None
use_honeypot bool | None

Whether to use honeypot on this step.

None
group_name str | None

Name of the group containing the step named step_name, in the multi-group workflow. Required when several groups have a step with the same name.

None
step_id str | None

Id of the step to update. Exclusive with step_name and group_name.

None

Returns:

Type Description
dict

A dict with the updated step data (id, name).

Source code in kili/presentation/client/project_workflow.py
def update_review_step_properties(
    self,
    project_id: str,
    step_name: str | None = None,
    assignees: list[str] | None = None,
    step_coverage: int | None = None,
    send_back_to_step: str | None = None,
    use_honeypot: bool | None = None,
    group_name: str | None = None,
    step_id: str | None = None,
) -> dict[str, Any]:
    """Update properties of a review step.

    Args:
        project_id: Id of the project.
        step_name: Name of the review step to update. Exclusive with `step_id`.
        assignees: List of emails to assign to the step.
        step_coverage: Percentage of assets to be reviewed in this step (0-100).
        send_back_to_step: Id of the step to send assets back to when rejected.
        use_honeypot: Whether to use honeypot on this step.
        group_name: Name of the group containing the step named `step_name`, in the multi-group
            workflow.
            Required when several groups have a step with the same name.
        step_id: Id of the step to update. Exclusive with `step_name` and `group_name`.

    Returns:
        A dict with the updated step data (id, name).
    """
    return ProjectWorkflowUseCases(self.kili_api_gateway).update_review_step_properties(
        project_id=project_id,
        step_name=step_name,
        assignees=assignees,
        step_coverage=step_coverage,
        send_back_to_step=send_back_to_step,
        use_honeypot=use_honeypot,
        group_name=group_name,
        step_id=step_id,
    )