Skip to content

Commit 1e5aa70

Browse files
author
Val Brodsky
committed
Add all other attributes
1 parent 2957a19 commit 1e5aa70

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

libs/labelbox/src/labelbox/schema/labeling_service_dashboard.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
GRAPHQL_QUERY_SELECTIONS = """
1414
id
1515
name
16-
# serviceType
17-
# createdAt
18-
# updatedAt
19-
# createdById
16+
boostRequestedAt
17+
boostUpdatedAt
18+
boostRequestedBy
2019
boostStatus
2120
dataRowsCount
2221
dataRowsInReviewCount
@@ -44,15 +43,13 @@ class LabelingServiceDashboard(BaseModel):
4443
created_at: Optional[datetime] = Field(frozen=True, default=None)
4544
updated_at: Optional[datetime] = Field(frozen=True, default=None)
4645
created_by_id: Optional[str] = Field(frozen=True, default=None)
47-
status: LabelingServiceStatus = Field(frozen=True,
48-
default=LabelingServiceStatus.Missing)
46+
status: LabelingServiceStatus = Field(frozen=True, default=None)
4947
data_rows_count: int = Field(frozen=True)
5048
data_rows_in_review_count: int = Field(frozen=True)
5149
data_rows_in_rework_count: int = Field(frozen=True)
5250
data_rows_done_count: int = Field(frozen=True)
53-
media_type: MediaType = Field(frozen=True, default=MediaType.Unknown)
54-
editor_task_type: EditorTaskType = Field(frozen=True,
55-
default=EditorTaskType.Missing)
51+
media_type: Optional[MediaType] = Field(frozen=True, default=None)
52+
editor_task_type: EditorTaskType = Field(frozen=True, default=None)
5653

5754
client: Any # type Any to avoid circular import from client
5855

@@ -72,6 +69,9 @@ def tasks_remaining(self):
7269

7370
@property
7471
def service_type(self):
72+
if self.media_type is None:
73+
return None
74+
7575
if self.editor_task_type is None:
7676
return sentence_case(self.media_type.value)
7777

@@ -84,7 +84,7 @@ def service_type(self):
8484
if self.editor_task_type == EditorTaskType.ResponseCreation and self.media_type == MediaType.Text:
8585
return "Response creation"
8686

87-
if media_type == MediaType.LLMPromptCreation or media_type == MediaType.LLMPromptResponseCreation:
87+
if self.media_type == MediaType.LLMPromptCreation or self.media_type == MediaType.LLMPromptResponseCreation:
8888
return "Prompt response creation"
8989

9090
return sentence_case(self.media_type.value)
@@ -157,8 +157,17 @@ def convert_to_labeling_service_dashboard(client, data):
157157
)
158158

159159
@root_validator(pre=True)
160-
def convert_boost_status_to_enum(cls, data):
160+
def convert_boost_data(cls, data):
161161
if 'boostStatus' in data:
162162
data['status'] = LabelingServiceStatus(data.pop('boostStatus'))
163163

164+
if 'boostRequestedAt' in data:
165+
data['created_at'] = data.pop('boostRequestedAt')
166+
167+
if 'boostUpdatedAt' in data:
168+
data['updated_at'] = data.pop('boostUpdatedAt')
169+
170+
if 'boostRequestedBy' in data:
171+
data['created_by_id'] = data.pop('boostRequestedBy')
172+
164173
return data

libs/labelbox/src/labelbox/schema/media_type.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ class MediaType(Enum):
2323
LLM = "LLM"
2424

2525
@classmethod
26-
def _missing_(cls, name):
26+
def _missing_(cls, value: str):
2727
"""Handle missing null data types for projects
2828
created without setting allowedMediaType
2929
Handle upper case names for compatibility with
3030
the GraphQL"""
3131

32-
if name is None:
32+
if value is None:
3333
return cls.Unknown
3434

35-
for member in cls.__members__:
36-
if member.name == name.upper():
35+
for name, member in cls.__members__.items():
36+
if name.upper() == value.upper():
3737
return member
3838

3939
@classmethod

0 commit comments

Comments
 (0)