update_workflow_stages(project_id, stages)
Update the workflow of your project.
Consensus Stage
"id": "<CONSENSUS STAGE ID>"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID AGREEMENT>", "<NEXT STAGE ID DISAGREEMENT>"]
Two types of stages, “Label” and “Plugin”, can be added to a consensus stage. They should adhere to the following format:
Label Stage:
"position": {"x": 0, "y": 0}
"next": ["<CONSENSUS STAGE ID>"]
"assignedTo": ["user_1@imerit.net", "user_2@imerit.net"]
"consensusId": "<CONSENSUS STAGE ID>"
Plugin Stage:
"position": {"x": 0, "y": 0}
"next": ["<CONSENSUS STAGE ID>"]
"pluginId": "<PLUGIN ID>"
"consensusId": "<CONSENSUS STAGE ID>"
Logic Stage
"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}
ango_sdk.get_project(<PROJECT ID>).get("data").get("project").get("stages")
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.
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')
ango_sdk = SDK(api_key)
start_stage = {"id": "Start",
"type": "Start",
"name": "Start",
"next": ["Label"],
"autoForward": False,
"position": {"x": 0, "y": 0}}
label_stage = {"id": "Label",
"type": "Label",
"name": "Label",
"next": ["Review"],
"assignedTo": [],
"position": {"x": 400, "y": 0}}
review_stage = {"id": "Review",
"type": "Review",
"name": "Review",
"next": ["Complete", "Label"],
"assignedTo": [],
"position": {"x": 800, "y": 0}}
complete_stage = {"id": "Complete",
"type": "Complete",
"name": "Complete",
"next": [],
"position": {"x": 1200, "y": 0}}
stages = [start_stage, label_stage, review_stage, complete_stage]
sdk_response = ango_sdk.update_workflow_stages(project_id, stages)