diff --git a/libs/labelbox/src/labelbox/client.py b/libs/labelbox/src/labelbox/client.py index e67bf30bf..d2fa3e57e 100644 --- a/libs/labelbox/src/labelbox/client.py +++ b/libs/labelbox/src/labelbox/client.py @@ -2419,7 +2419,8 @@ def get_labeling_service_dashboards( search_query: A list of search filters representing the search NOTE: - - Retrieves all projects for the organization or as filtered by the search query. + - Retrieves all projects for the organization or as filtered by the search query + - INCLUDING those not requesting labeling services - Sorted by project created date in ascending order. Examples: diff --git a/libs/labelbox/src/labelbox/schema/labeling_service_dashboard.py b/libs/labelbox/src/labelbox/schema/labeling_service_dashboard.py index efbd740fb..9c64d57b3 100644 --- a/libs/labelbox/src/labelbox/schema/labeling_service_dashboard.py +++ b/libs/labelbox/src/labelbox/schema/labeling_service_dashboard.py @@ -30,7 +30,7 @@ class LabelingServiceDashboardTags(BaseModel): - name: str + text: str color: str type: str @@ -167,7 +167,6 @@ def get_all( search_query=build_search_filter(search_query) if search_query else None, ) - params: Dict[str, Union[str, int]] = {} def convert_to_labeling_service_dashboard(client, data): diff --git a/libs/labelbox/src/labelbox/schema/search_filters.py b/libs/labelbox/src/labelbox/schema/search_filters.py index e3e7d0e4b..10b46755d 100644 --- a/libs/labelbox/src/labelbox/schema/search_filters.py +++ b/libs/labelbox/src/labelbox/schema/search_filters.py @@ -3,6 +3,7 @@ from typing import List, Literal, Union from labelbox.pydantic_compat import BaseModel +from labelbox.schema.labeling_service_status import LabelingServiceStatus from labelbox.utils import format_iso_datetime @@ -31,6 +32,7 @@ class OperationType(Enum): Supported search entity types """ Organization = 'organization_id' + SharedWithOrganization = 'shared_with_organizations' Workspace = 'workspace' Tag = 'tag' Stage = 'stage' @@ -72,6 +74,17 @@ class OrganizationFilter(BaseSearchFilter): values: List[str] +class SharedWithOrganizationFilter(BaseSearchFilter): + """ + Find project shared with organization (i.e. not belonging to any of organization's workspace) + """ + operation: Literal[ + OperationType. + SharedWithOrganization] = OperationType.SharedWithOrganization + operator: IdOperator + values: List[str] + + class WorkspaceFilter(BaseSearchFilter): """ Filter for workspace @@ -96,7 +109,7 @@ class ProjectStageFilter(BaseSearchFilter): """ operation: Literal[OperationType.Stage] = OperationType.Stage operator: IdOperator - values: List[str] + values: List[LabelingServiceStatus] class DateValue(BaseSearchFilter): @@ -194,7 +207,8 @@ class TaskRemainingCountFilter(BaseSearchFilter): value: IntegerValue -SearchFilter = Union[OrganizationFilter, WorkspaceFilter, TagFilter, +SearchFilter = Union[OrganizationFilter, WorkspaceFilter, + SharedWithOrganizationFilter, TagFilter, ProjectStageFilter, WorkforceRequestedDateFilter, WorkforceStageUpdatedFilter, WorkforceRequestedDateRangeFilter, diff --git a/libs/labelbox/tests/unit/test_unit_search_filters.py b/libs/labelbox/tests/unit/test_unit_search_filters.py index 404ba7b34..38e091487 100644 --- a/libs/labelbox/tests/unit/test_unit_search_filters.py +++ b/libs/labelbox/tests/unit/test_unit_search_filters.py @@ -1,5 +1,6 @@ from datetime import datetime -from labelbox.schema.search_filters import IntegerValue, RangeOperatorWithSingleValue, DateRange, RangeOperatorWithValue, DateRangeValue, DateValue, IdOperator, OperationType, OrganizationFilter, ProjectStageFilter, TagFilter, TaskCompletedCountFilter, TaskRemainingCountFilter, WorkforceRequestedDateFilter, WorkforceRequestedDateRangeFilter, WorkforceStageUpdatedFilter, WorkforceStageUpdatedRangeFilter, WorkspaceFilter, build_search_filter +from labelbox.schema.labeling_service import LabelingServiceStatus +from labelbox.schema.search_filters import IntegerValue, RangeOperatorWithSingleValue, DateRange, RangeOperatorWithValue, DateRangeValue, DateValue, IdOperator, OperationType, OrganizationFilter, ProjectStageFilter, SharedWithOrganizationFilter, TagFilter, TaskCompletedCountFilter, TaskRemainingCountFilter, WorkforceRequestedDateFilter, WorkforceRequestedDateRangeFilter, WorkforceStageUpdatedFilter, WorkforceStageUpdatedRangeFilter, WorkspaceFilter, build_search_filter from labelbox.utils import format_iso_datetime @@ -7,15 +8,18 @@ def test_id_filters(): filters = [ OrganizationFilter(operator=IdOperator.Is, values=["clphb4vd7000cd2wv1ktu5cwa"]), + SharedWithOrganizationFilter(operator=IdOperator.Is, + values=["clphb4vd7000cd2wv1ktu5cwa"]), WorkspaceFilter(operator=IdOperator.Is, values=["clphb4vd7000cd2wv1ktu5cwa"]), TagFilter(operator=IdOperator.Is, values=["tag"]), - ProjectStageFilter(operator=IdOperator.Is, values=["requested"]), + ProjectStageFilter(operator=IdOperator.Is, + values=[LabelingServiceStatus.Requested]), ] assert build_search_filter( filters - ) == '[{operator: "is", values: ["clphb4vd7000cd2wv1ktu5cwa"], type: "organization_id"}, {operator: "is", values: ["clphb4vd7000cd2wv1ktu5cwa"], type: "workspace"}, {operator: "is", values: ["tag"], type: "tag"}, {operator: "is", values: ["requested"], type: "stage"}]' + ) == '[{operator: "is", values: ["clphb4vd7000cd2wv1ktu5cwa"], type: "organization_id"}, {operator: "is", values: ["clphb4vd7000cd2wv1ktu5cwa"], type: "shared_with_organizations"}, {operator: "is", values: ["clphb4vd7000cd2wv1ktu5cwa"], type: "workspace"}, {operator: "is", values: ["tag"], type: "tag"}, {operator: "is", values: ["REQUESTED"], type: "stage"}]' def test_date_filters():