update_workflow_stages
imerit_ango.sdk.SDK.
update_workflow_stages(project_id, stages)
Update the workflow of your project.
Parameters
project_id: string
The unique identifier for the project. You can find the project ID in the user interface or retrieve it using the
list_projectsfunction.
stages: List[dict]
The workflow of the project, in JSON format.
Stage types and their required fields:
Start Stage
"id": "Start"
"type": "Start"
"name": "Start"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"autoForward": true or false
Complete Stage
"id": "Complete"
"type": "Complete"
"name": "Complete"
"position": {"x": 10, "y": 20}
"preventRequeue": true or false
Label Stage
"id": "<STAGE ID>"
"type": "Label"
"name": "Label"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"assignedTo": ["user_1@imerit.net", "user_2@imerit.net"]
Consensus Stage
"id": "<CONSENSUS STAGE ID>"
"type": "Consensus"
"name": "Consensus"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID AGREEMENT>", "<NEXT STAGE ID DISAGREEMENT>"]
"consensusId": null
"consensusConfig": {"threshold": {}, "adjudicationMethod": "best"}
Two types of stages, “Label” and “Plugin”, can be added to a consensus stage. They should adhere to the following format:
Label Stage:
"id": "<STAGE ID>"
"type": "Label"
"name": "Consensus_1"
"position": {"x": 0, "y": 0}
"next": ["<CONSENSUS STAGE ID>"]
"assignedTo": ["user_1@imerit.net", "user_2@imerit.net"]
"consensusId": "<CONSENSUS STAGE ID>"
"consensusConfig": {}
Plugin Stage:
"id": "<STAGE ID>"
"type": "Plugin"
"name": "Consensus_2"
"position": {"x": 0, "y": 0}
"next": ["<CONSENSUS STAGE ID>"]
"pluginId": "<PLUGIN ID>"
"pluginConfig": {"categorySchema": [], "configJSON": "", "overwrite": true}
"consensusId": "<CONSENSUS STAGE ID>"
Review Stage
"id": "<STAGE ID>"
"type": "Review"
"name": "Review"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID ACCEPTED>", "<NEXT STAGE ID REJECTED>"]
"assignedTo": ["user_1@imerit.net", "user_2@imerit.net"]
"readOnly": true or false
Hold Stage
"id": "<STAGE ID>"
"type": "Hold"
"name": "Hold"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
Logic Stage
"id": "<STAGE ID>"
"type": "Logic"
"name": "Logic"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID IF CONDITION>", ..., "<NEXT STAGE ID ELSE CONDITION>"]
"logic": {"conditions": [...]}
A single condition should follow:
Logic Type: Annotation Type
{"type": "AnnotationType", "value": {"tools": [{"schemaId": "<Schema ID>", "filter": ["exists"]}]}, "index": 0}
Logic Type: Assignee
{"type": "Annotator", "value": ["user@imerit.net"], "index": 0}
Logic Type: Random Sample
{"type": "RandomSample", "value": 0.100", "index": 0}
Logic Type: Task Duration
{"type": "Duration", "value": [Start Time, End Time], "index": 0}
Logic Type: Batch
{"type": "Batch", "value": ["<SELECTED BATCH ID>"], "index": 0}
Plugin Stage
"id": "<STAGE ID>"
"type": "Plugin"
"name": "Plugin"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"pluginId": "<PLUGIN ID>"
"pluginConfig": {"overwrite": true, "categorySchema": [], "configJSON": ""}
Webhook Stage
"id": "<STAGE ID>"
"type": "Webhook"
"name": "Webhook"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"webhook": {"authType": "<Auth Type>", "secret": "<SECRET>", "url": "<URL>"}
Note: To get an idea of what you can pass as input in Stages, you may create a workflow in a project, then run:
As the returned JSON, you'll get the JSON representation of the project's workflow, which you can use as a skeleton to create your own workflow JSONs.
Returns:
output: dict
A dictionary containing the result of the operation.
Including a
statusfield indicating whether the request was successful and adatafield containing the response payload with updated resources produced by the operation.
How to verify in Ango Hub?
After successfully executing the update_workflow_stages function, you can validate the changes directly in Ango Hub.
Navigate to: Projects → [Your Project] → Workflow
Confirm that the workflow stages have been updated as expected.
Changes made via the SDK are reflected in Ango Hub in near real-time. If updates are not immediately visible, please refresh the page.
Example
Create a workflow from scratch
Disable the "Auto Forward on Upload" option on the Start stage
Prevent requeueing to Complete stage
See also
Last updated