Skip to content

Vb/fixes and improvements 2 #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions libs/labelbox/src/labelbox/schema/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1943,11 +1943,29 @@ def get_labeling_service_status(self) -> LabelingServiceStatus:
return self.get_labeling_service().status

@experimental
def labeling_service_dashboard(self) -> LabelingServiceDashboard:
def get_labeling_service_dashboard(self) -> LabelingServiceDashboard:
"""Get the labeling service for this project.

Returns:
LabelingService: The labeling service for this project.
LabelingServiceDashboard: The labeling service for this project.

Attributes of the dashboard include:
id (str): The project id.
name (str): The project name.
created_at, updated_at (datetime): The creation and last update times of the labeling service. None if labeling service is not requested.
created_by_id (str): The user id of the creator of the labeling service. None if labeling service is not requested.
status (LabelingServiceStatus): The status of the labeling service. Returns LabelingServiceStatus.Missing if labeling service is not requested.
data_rows_count (int): The number of data rows in the project. 0 if labeling service is not requested.
data_rows_in_review_count (int): The number of data rows in review queue. 0 if labeling service is not requested.
data_rows_in_rework_count (int): The number of data rows in rework. 0 if labeling service is not requested.
data_rows_done_count (int): The number of data rows in done queue. 0 if labeling service is not requested.
tags (List[str]): Project tags.
tasks_completed (int): The number of tasks completed, the same as data_rows_done_count. 0 if labeling service is not requested.
tasks_remaining (int): The number of tasks remaining, the same as data_rows_count - data_rows_done_count. 0 if labeling service is not requested.
service_type (str): Descriptive type for labeling service.

NOTE can call dict() to get all attributes as dictionary.

"""
return LabelingServiceDashboard.get(self.client, self.uid)

Expand Down
11 changes: 7 additions & 4 deletions libs/labelbox/src/labelbox/schema/search_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def dict(self, *args, **kwargs):
class OperationType(Enum):
"""
Supported search entity types
Each type corresponds to a different filter class
"""
Organization = 'organization_id'
SharedWithOrganization = 'shared_with_organizations'
Expand All @@ -44,7 +45,7 @@ class OperationType(Enum):

class IdOperator(Enum):
"""
Supported operators for ids
Supported operators for ids like org ids, workspace ids, etc
"""
Is = 'is'

Expand All @@ -67,7 +68,7 @@ class RangeOperatorWithValue(Enum):

class OrganizationFilter(BaseSearchFilter):
"""
Filter for organization
Filter for organization to which projects belong
"""
operation: Literal[OperationType.Organization] = OperationType.Organization
operator: IdOperator
Expand All @@ -76,7 +77,7 @@ class OrganizationFilter(BaseSearchFilter):

class SharedWithOrganizationFilter(BaseSearchFilter):
"""
Find project shared with organization (i.e. not belonging to any of organization's workspace)
Find project shared with the organization (i.e. not having this organization as a tenantId)
"""
operation: Literal[
OperationType.
Expand Down Expand Up @@ -106,6 +107,7 @@ class TagFilter(BaseSearchFilter):
class ProjectStageFilter(BaseSearchFilter):
"""
Filter labelbox service / aka project stages
Stages are: requested, in_progress, completed etc. as described by LabelingServiceStatus
"""
operation: Literal[OperationType.Stage] = OperationType.Stage
operator: IdOperator
Expand Down Expand Up @@ -192,6 +194,7 @@ class WorkforceStageUpdatedRangeFilter(BaseSearchFilter):
class TaskCompletedCountFilter(BaseSearchFilter):
"""
Filter for completed tasks count
A task maps to a data row. Task completed should map to a data row in a labeling queue DONE
"""
operation: Literal[
OperationType.TaskCompletedCount] = OperationType.TaskCompletedCount
Expand All @@ -200,7 +203,7 @@ class TaskCompletedCountFilter(BaseSearchFilter):

class TaskRemainingCountFilter(BaseSearchFilter):
"""
Filter for remaining tasks count
Filter for remaining tasks count. Reverse of TaskCompletedCountFilter
"""
operation: Literal[
OperationType.TaskRemainingCount] = OperationType.TaskRemainingCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def test_request_labeling_service_dashboard(requested_labeling_service):
project, _ = requested_labeling_service

labeling_service_dashboard = project.labeling_service_dashboard()
labeling_service_dashboard = project.get_labeling_service_dashboard()
assert labeling_service_dashboard.status == LabelingServiceStatus.Requested
assert labeling_service_dashboard.tasks_completed == 0
assert labeling_service_dashboard.tasks_remaining == 0
Expand Down
Loading