Skip to content

Commit 8a783be

Browse files
authored
Vb/fixes and improvements 2 (#1778)
1 parent 2497939 commit 8a783be

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

libs/labelbox/src/labelbox/schema/project.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,11 +1943,29 @@ def get_labeling_service_status(self) -> LabelingServiceStatus:
19431943
return self.get_labeling_service().status
19441944

19451945
@experimental
1946-
def labeling_service_dashboard(self) -> LabelingServiceDashboard:
1946+
def get_labeling_service_dashboard(self) -> LabelingServiceDashboard:
19471947
"""Get the labeling service for this project.
19481948
19491949
Returns:
1950-
LabelingService: The labeling service for this project.
1950+
LabelingServiceDashboard: The labeling service for this project.
1951+
1952+
Attributes of the dashboard include:
1953+
id (str): The project id.
1954+
name (str): The project name.
1955+
created_at, updated_at (datetime): The creation and last update times of the labeling service. None if labeling service is not requested.
1956+
created_by_id (str): The user id of the creator of the labeling service. None if labeling service is not requested.
1957+
status (LabelingServiceStatus): The status of the labeling service. Returns LabelingServiceStatus.Missing if labeling service is not requested.
1958+
data_rows_count (int): The number of data rows in the project. 0 if labeling service is not requested.
1959+
data_rows_in_review_count (int): The number of data rows in review queue. 0 if labeling service is not requested.
1960+
data_rows_in_rework_count (int): The number of data rows in rework. 0 if labeling service is not requested.
1961+
data_rows_done_count (int): The number of data rows in done queue. 0 if labeling service is not requested.
1962+
tags (List[str]): Project tags.
1963+
tasks_completed (int): The number of tasks completed, the same as data_rows_done_count. 0 if labeling service is not requested.
1964+
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.
1965+
service_type (str): Descriptive type for labeling service.
1966+
1967+
NOTE can call dict() to get all attributes as dictionary.
1968+
19511969
"""
19521970
return LabelingServiceDashboard.get(self.client, self.uid)
19531971

libs/labelbox/src/labelbox/schema/search_filters.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def dict(self, *args, **kwargs):
3030
class OperationType(Enum):
3131
"""
3232
Supported search entity types
33+
Each type corresponds to a different filter class
3334
"""
3435
Organization = 'organization_id'
3536
SharedWithOrganization = 'shared_with_organizations'
@@ -44,7 +45,7 @@ class OperationType(Enum):
4445

4546
class IdOperator(Enum):
4647
"""
47-
Supported operators for ids
48+
Supported operators for ids like org ids, workspace ids, etc
4849
"""
4950
Is = 'is'
5051

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

6869
class OrganizationFilter(BaseSearchFilter):
6970
"""
70-
Filter for organization
71+
Filter for organization to which projects belong
7172
"""
7273
operation: Literal[OperationType.Organization] = OperationType.Organization
7374
operator: IdOperator
@@ -76,7 +77,7 @@ class OrganizationFilter(BaseSearchFilter):
7677

7778
class SharedWithOrganizationFilter(BaseSearchFilter):
7879
"""
79-
Find project shared with organization (i.e. not belonging to any of organization's workspace)
80+
Find project shared with the organization (i.e. not having this organization as a tenantId)
8081
"""
8182
operation: Literal[
8283
OperationType.
@@ -106,6 +107,7 @@ class TagFilter(BaseSearchFilter):
106107
class ProjectStageFilter(BaseSearchFilter):
107108
"""
108109
Filter labelbox service / aka project stages
110+
Stages are: requested, in_progress, completed etc. as described by LabelingServiceStatus
109111
"""
110112
operation: Literal[OperationType.Stage] = OperationType.Stage
111113
operator: IdOperator
@@ -192,6 +194,7 @@ class WorkforceStageUpdatedRangeFilter(BaseSearchFilter):
192194
class TaskCompletedCountFilter(BaseSearchFilter):
193195
"""
194196
Filter for completed tasks count
197+
A task maps to a data row. Task completed should map to a data row in a labeling queue DONE
195198
"""
196199
operation: Literal[
197200
OperationType.TaskCompletedCount] = OperationType.TaskCompletedCount
@@ -200,7 +203,7 @@ class TaskCompletedCountFilter(BaseSearchFilter):
200203

201204
class TaskRemainingCountFilter(BaseSearchFilter):
202205
"""
203-
Filter for remaining tasks count
206+
Filter for remaining tasks count. Reverse of TaskCompletedCountFilter
204207
"""
205208
operation: Literal[
206209
OperationType.TaskRemainingCount] = OperationType.TaskRemainingCount

libs/labelbox/tests/integration/test_labeling_dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def test_request_labeling_service_dashboard(requested_labeling_service):
1010
project, _ = requested_labeling_service
1111

12-
labeling_service_dashboard = project.labeling_service_dashboard()
12+
labeling_service_dashboard = project.get_labeling_service_dashboard()
1313
assert labeling_service_dashboard.status == LabelingServiceStatus.Requested
1414
assert labeling_service_dashboard.tasks_completed == 0
1515
assert labeling_service_dashboard.tasks_remaining == 0

0 commit comments

Comments
 (0)