Skip to content

Commit 5093d42

Browse files
author
Val Brodsky
committed
Add all other attributes
1 parent 669c3fa commit 5093d42

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
@@ -15,10 +15,9 @@
1515
GRAPHQL_QUERY_SELECTIONS = """
1616
id
1717
name
18-
# serviceType
19-
# createdAt
20-
# updatedAt
21-
# createdById
18+
boostRequestedAt
19+
boostUpdatedAt
20+
boostRequestedBy
2221
boostStatus
2322
dataRowsCount
2423
dataRowsInReviewCount
@@ -46,15 +45,13 @@ class LabelingServiceDashboard(BaseModel):
4645
created_at: Optional[datetime] = Field(frozen=True, default=None)
4746
updated_at: Optional[datetime] = Field(frozen=True, default=None)
4847
created_by_id: Optional[str] = Field(frozen=True, default=None)
49-
status: LabelingServiceStatus = Field(frozen=True,
50-
default=LabelingServiceStatus.Missing)
48+
status: LabelingServiceStatus = Field(frozen=True, default=None)
5149
data_rows_count: int = Field(frozen=True)
5250
data_rows_in_review_count: int = Field(frozen=True)
5351
data_rows_in_rework_count: int = Field(frozen=True)
5452
data_rows_done_count: int = Field(frozen=True)
55-
media_type: MediaType = Field(frozen=True, default=MediaType.Unknown)
56-
editor_task_type: EditorTaskType = Field(frozen=True,
57-
default=EditorTaskType.Missing)
53+
media_type: Optional[MediaType] = Field(frozen=True, default=None)
54+
editor_task_type: EditorTaskType = Field(frozen=True, default=None)
5855

5956
client: Any # type Any to avoid circular import from client
6057

@@ -74,6 +71,9 @@ def tasks_remaining(self):
7471

7572
@property
7673
def service_type(self):
74+
if self.media_type is None:
75+
return None
76+
7777
if self.editor_task_type is None:
7878
return sentence_case(self.media_type.value)
7979

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

89-
if media_type == MediaType.LLMPromptCreation or media_type == MediaType.LLMPromptResponseCreation:
89+
if self.media_type == MediaType.LLMPromptCreation or self.media_type == MediaType.LLMPromptResponseCreation:
9090
return "Prompt response creation"
9191

9292
return sentence_case(self.media_type.value)
@@ -167,8 +167,17 @@ def convert_to_labeling_service_dashboard(client, data):
167167
)
168168

169169
@root_validator(pre=True)
170-
def convert_boost_status_to_enum(cls, data):
170+
def convert_boost_data(cls, data):
171171
if 'boostStatus' in data:
172172
data['status'] = LabelingServiceStatus(data.pop('boostStatus'))
173173

174+
if 'boostRequestedAt' in data:
175+
data['created_at'] = data.pop('boostRequestedAt')
176+
177+
if 'boostUpdatedAt' in data:
178+
data['updated_at'] = data.pop('boostUpdatedAt')
179+
180+
if 'boostRequestedBy' in data:
181+
data['created_by_id'] = data.pop('boostRequestedBy')
182+
174183
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)