7474from lib .core .entities .work_managament import WMUserTypeEnum
7575from lib .core .jsx_conditions import EmptyQuery
7676
77-
7877logger = logging .getLogger ("sa" )
7978
8079NotEmptyStr = constr (strict = True , min_length = 1 )
@@ -1493,10 +1492,11 @@ def get_project_steps(self, project: Union[str, dict]):
14931492 :param project: project name or metadata
14941493 :type project: str or dict
14951494
1496- :return: project steps
1497- :rtype: list of dicts
1495+ :return: A list of step dictionaries,
1496+ or a dictionary containing both steps and their connections (for Keypoint workflows).
1497+ :rtype: list of dicts or dict
14981498
1499- Response Example:
1499+ Response Example for General Annotation Project :
15001500 ::
15011501
15021502 [
@@ -1515,6 +1515,34 @@ def get_project_steps(self, project: Union[str, dict]):
15151515 }
15161516 ]
15171517
1518+ Response Example for Keypoint Annotation Project:
1519+ ::
1520+
1521+ {
1522+ "steps": [
1523+ {
1524+ "step": 1,
1525+ "className": "Left Shoulder",
1526+ "class_id": "1",
1527+ "attribute": [
1528+ {
1529+ "attribute": {
1530+ "id": 123,
1531+ "group_id": 12
1532+ }
1533+ }
1534+ ]
1535+ },
1536+ {
1537+ "step": 2,
1538+ "class_id": "2",
1539+ "className": "Right Shoulder",
1540+ }
1541+ ],
1542+ "connections": [
1543+ [1, 2]
1544+ ]
1545+ }
15181546 """
15191547 project_name , _ = extract_project_folder (project )
15201548 project = self .controller .get_project (project_name )
@@ -2511,7 +2539,12 @@ def download_export(
25112539 if response .errors :
25122540 raise AppException (response .errors )
25132541
2514- def set_project_steps (self , project : Union [NotEmptyStr , dict ], steps : List [dict ]):
2542+ def set_project_steps (
2543+ self ,
2544+ project : Union [NotEmptyStr , dict ],
2545+ steps : List [dict ],
2546+ connections : List [List [int ]] = None ,
2547+ ):
25152548 """Sets project's steps.
25162549
25172550 :param project: project name or metadata
@@ -2520,7 +2553,11 @@ def set_project_steps(self, project: Union[NotEmptyStr, dict], steps: List[dict]
25202553 :param steps: new workflow list of dicts
25212554 :type steps: list of dicts
25222555
2523- Request Example:
2556+ :param connections: Defines connections between keypoint annotation steps.
2557+ Each inner list specifies a pair of step IDs indicating a connection.
2558+ :type connections: list of dicts
2559+
2560+ Request Example for General Annotation Project:
25242561 ::
25252562
25262563 sa.set_project_steps(
@@ -2541,10 +2578,40 @@ def set_project_steps(self, project: Union[NotEmptyStr, dict], steps: List[dict]
25412578 }
25422579 ]
25432580 )
2581+
2582+ Request Example for Keypoint Annotation Project:
2583+ ::
2584+
2585+ sa.set_project_steps(
2586+ project="Pose Estimation Project",
2587+ steps=[
2588+ {
2589+ "step": 1,
2590+ "class_id": 12,
2591+ "attribute": [
2592+ {
2593+ "attribute": {
2594+ "id": 123,
2595+ "group_id": 12
2596+ }
2597+ }
2598+ ]
2599+ },
2600+ {
2601+ "step": 2,
2602+ "class_id": 13
2603+ }
2604+ ],
2605+ connections=[
2606+ [1, 2]
2607+ ]
2608+ )
25442609 """
25452610 project_name , _ = extract_project_folder (project )
25462611 project = self .controller .get_project (project_name )
2547- response = self .controller .projects .set_steps (project , steps = steps )
2612+ response = self .controller .projects .set_steps (
2613+ project , steps = steps , connections = connections
2614+ )
25482615 if response .errors :
25492616 raise AppException (response .errors )
25502617
0 commit comments