@@ -994,6 +994,7 @@ def delete_images(project, image_names=None):
994994 )
995995
996996
997+ @Trackable
997998def assign_images (project , image_names , user ):
998999 """Assigns images to a user. The assignment role, QA or Annotator, will
9991000 be deduced from the user's role in the project. With SDK, the user can be
@@ -1009,6 +1010,21 @@ def assign_images(project, image_names, user):
10091010 project_name , folder_name = extract_project_folder (project )
10101011 if not folder_name :
10111012 folder_name = "root"
1013+
1014+ contributors = controller .get_project_metadata (
1015+ project_name = project_name , include_contributors = True
1016+ ).data ["contributors" ]
1017+ contributor = None
1018+ for c in contributors :
1019+ if c ["user_id" ] == user :
1020+ contributor = user
1021+
1022+ if not contributor :
1023+ logger .warning (
1024+ f"Skipping { user } . { user } is not a verified contributor for the { project_name } "
1025+ )
1026+ return
1027+
10121028 controller .assign_images (project_name , folder_name , image_names , user )
10131029
10141030
@@ -3338,3 +3354,49 @@ def _upload_s3_image(image_path: str):
33383354 duplicates .extend (duplications )
33393355
33403356 return uploaded , failed_images , duplicates
3357+
3358+
3359+ @Trackable
3360+ def aggregate_annotations_as_df (
3361+ project_root ,
3362+ include_classes_wo_annotations = False ,
3363+ include_comments = False ,
3364+ include_tags = False ,
3365+ verbose = True ,
3366+ folder_names = None ,
3367+ ):
3368+ """Aggregate annotations as pandas dataframe from project root.
3369+
3370+ :param project_root: export path of the project
3371+ :type project_root: Pathlike (str or Path)
3372+ :param include_classes_wo_annotations: enables inclusion of classes info
3373+ that have no instances in annotations
3374+ :type include_classes_wo_annotations: bool
3375+ :param include_comments: enables inclusion of comments info as commentResolved column
3376+ :type include_comments: bool
3377+ :param include_tags: enables inclusion of tags info as tag column
3378+ :type include_tags: bool
3379+ :param folder_names: Aggregate the specified folders from project_root.
3380+ If None aggregate all folders in the project_root.
3381+ :type folder_names: (list of str)
3382+
3383+ :return: DataFrame on annotations with columns:
3384+ "imageName", "instanceId",
3385+ "className", "attributeGroupName", "attributeName", "type", "error", "locked",
3386+ "visible", "trackingId", "probability", "pointLabels",
3387+ "meta" (geometry information as string), "commentResolved", "classColor",
3388+ "groupId", "imageWidth", "imageHeight", "imageStatus", "imagePinned",
3389+ "createdAt", "creatorRole", "creationType", "creatorEmail", "updatedAt",
3390+ "updatorRole", "updatorEmail", "tag", "folderName"
3391+ :rtype: pandas DataFrame
3392+ """
3393+ from superannotate .lib .app .analytics .common import aggregate_annotations_as_df
3394+
3395+ aggregate_annotations_as_df (
3396+ project_root ,
3397+ include_classes_wo_annotations ,
3398+ include_comments ,
3399+ include_tags ,
3400+ verbose ,
3401+ folder_names ,
3402+ )
0 commit comments