sapiopycommons 2025.8.15a705__py3-none-any.whl → 2025.8.15a706__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sapiopycommons might be problematic. Click here for more details.
- sapiopycommons/ai/tool_of_tools.py +917 -0
- sapiopycommons/callbacks/callback_util.py +26 -16
- sapiopycommons/files/assay_plate_reader.py +93 -0
- sapiopycommons/files/file_text_converter.py +207 -0
- sapiopycommons/flowcyto/flow_cyto.py +2 -24
- sapiopycommons/general/accession_service.py +2 -28
- sapiopycommons/multimodal/multimodal.py +2 -24
- sapiopycommons/webhook/webservice_handlers.py +1 -1
- {sapiopycommons-2025.8.15a705.dist-info → sapiopycommons-2025.8.15a706.dist-info}/METADATA +2 -2
- {sapiopycommons-2025.8.15a705.dist-info → sapiopycommons-2025.8.15a706.dist-info}/RECORD +12 -43
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.py +0 -43
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.pyi +0 -31
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.py +0 -123
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.pyi +0 -598
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/converter/proto/converter_pb2.py +0 -50
- sapiopycommons/ai/api/plan/converter/proto/converter_pb2.pyi +0 -61
- sapiopycommons/ai/api/plan/converter/proto/converter_pb2_grpc.py +0 -149
- sapiopycommons/ai/api/plan/item/proto/item_container_pb2.py +0 -55
- sapiopycommons/ai/api/plan/item/proto/item_container_pb2.pyi +0 -88
- sapiopycommons/ai/api/plan/item/proto/item_container_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/proto/step_output_pb2.py +0 -45
- sapiopycommons/ai/api/plan/proto/step_output_pb2.pyi +0 -42
- sapiopycommons/ai/api/plan/proto/step_output_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/proto/step_pb2.py +0 -43
- sapiopycommons/ai/api/plan/proto/step_pb2.pyi +0 -43
- sapiopycommons/ai/api/plan/proto/step_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/script/proto/script_pb2.py +0 -59
- sapiopycommons/ai/api/plan/script/proto/script_pb2.pyi +0 -102
- sapiopycommons/ai/api/plan/script/proto/script_pb2_grpc.py +0 -153
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2.py +0 -41
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2.pyi +0 -35
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2.py +0 -75
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2.pyi +0 -237
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2_grpc.py +0 -154
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.py +0 -39
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.pyi +0 -32
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2_grpc.py +0 -24
- sapiopycommons/ai/converter_service_base.py +0 -116
- sapiopycommons/ai/protobuf_utils.py +0 -504
- sapiopycommons/ai/test_client.py +0 -338
- sapiopycommons/ai/tool_service_base.py +0 -917
- {sapiopycommons-2025.8.15a705.dist-info → sapiopycommons-2025.8.15a706.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.8.15a705.dist-info → sapiopycommons-2025.8.15a706.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,504 +0,0 @@
|
|
|
1
|
-
from sapiopylib.rest.pojo.Sort import SortDirection
|
|
2
|
-
from sapiopylib.rest.pojo.datatype.FieldDefinition import AbstractVeloxFieldDefinition, FieldType, \
|
|
3
|
-
VeloxBooleanFieldDefinition, VeloxDateFieldDefinition, VeloxAccessionFieldDefinition, VeloxActionFieldDefinition, \
|
|
4
|
-
VeloxChildLinkFieldDefinition, VeloxDateRangeFieldDefinition, VeloxDoubleFieldDefinition, \
|
|
5
|
-
VeloxEnumFieldDefinition, VeloxIdentifierFieldDefinition, VeloxIntegerFieldDefinition, \
|
|
6
|
-
VeloxLongFieldDefinition, VeloxMultiParentFieldDefinition, VeloxParentFieldDefinition, \
|
|
7
|
-
VeloxPickListFieldDefinition, VeloxSelectionFieldDefinition, VeloxShortFieldDefinition, \
|
|
8
|
-
VeloxStringFieldDefinition, VeloxSideLinkFieldDefinition, VeloxActionStringFieldDefinition, FieldValidator, \
|
|
9
|
-
ListMode, SapioDoubleFormat, SapioStringFormat
|
|
10
|
-
|
|
11
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.fields_pb2 import FieldValuePbo
|
|
12
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import FieldTypePbo, SortDirectionPbo, \
|
|
13
|
-
DoubleFormatPbo, StringFormatPbo, FieldValidatorPbo, VeloxFieldDefPbo, BooleanPropertiesPbo, DatePropertiesPbo, \
|
|
14
|
-
DoublePropertiesPbo, IntegerPropertiesPbo, LongPropertiesPbo, SelectionPropertiesPbo, StringPropertiesPbo, \
|
|
15
|
-
SideLinkPropertiesPbo, ShortPropertiesPbo, PickListPropertiesPbo, ParentLinkPropertiesPbo, MultiParentPropertiesPbo, \
|
|
16
|
-
IdentifierPropertiesPbo, FileBlobPropertiesPbo, EnumPropertiesPbo, DateRangePropertiesPbo, ChildLinkPropertiesPbo, \
|
|
17
|
-
ActionStringPropertiesPbo, ActionPropertiesPbo, AccessionPropertiesPbo, SelectionDependentFieldEntryPbo, \
|
|
18
|
-
EnumDependentFieldEntryPbo, BooleanDependentFieldEntryPbo
|
|
19
|
-
from sapiopycommons.general.aliases import FieldValue
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# FR-47422: Created class.
|
|
23
|
-
class ProtobufUtils:
|
|
24
|
-
@staticmethod
|
|
25
|
-
def field_type_to_pbo(field_type: FieldType) -> FieldTypePbo:
|
|
26
|
-
"""
|
|
27
|
-
Convert a FieldType enum to its corresponding FieldTypePbo.
|
|
28
|
-
|
|
29
|
-
:param field_type: The FieldType enum value.
|
|
30
|
-
:return: The corresponding FieldTypePbo.
|
|
31
|
-
"""
|
|
32
|
-
match field_type:
|
|
33
|
-
case FieldType.ACTION:
|
|
34
|
-
return FieldTypePbo.ACTION
|
|
35
|
-
case FieldType.ACTION_STRING:
|
|
36
|
-
return FieldTypePbo.ACTION_STRING
|
|
37
|
-
case FieldType.AUTO_ACCESSION:
|
|
38
|
-
return FieldTypePbo.AUTO_ACCESSION
|
|
39
|
-
case FieldType.BOOLEAN:
|
|
40
|
-
return FieldTypePbo.BOOLEAN
|
|
41
|
-
case FieldType.CHILDLINK:
|
|
42
|
-
return FieldTypePbo.CHILDLINK
|
|
43
|
-
case FieldType.DATE:
|
|
44
|
-
return FieldTypePbo.DATE
|
|
45
|
-
case FieldType.DATE_RANGE:
|
|
46
|
-
return FieldTypePbo.DATE_RANGE
|
|
47
|
-
case FieldType.DOUBLE:
|
|
48
|
-
return FieldTypePbo.DOUBLE
|
|
49
|
-
case FieldType.ENUM:
|
|
50
|
-
return FieldTypePbo.ENUM
|
|
51
|
-
# case FieldType.FILE_BLOB:
|
|
52
|
-
# return FieldTypePbo.FILE_BLOB
|
|
53
|
-
case FieldType.IDENTIFIER:
|
|
54
|
-
return FieldTypePbo.IDENTIFIER
|
|
55
|
-
case FieldType.INTEGER:
|
|
56
|
-
return FieldTypePbo.INTEGER
|
|
57
|
-
case FieldType.LINK:
|
|
58
|
-
return FieldTypePbo.LINK
|
|
59
|
-
case FieldType.LONG:
|
|
60
|
-
return FieldTypePbo.LONG
|
|
61
|
-
case FieldType.MULTIPARENTLINK:
|
|
62
|
-
return FieldTypePbo.MULTIPARENTLINK
|
|
63
|
-
case FieldType.PARENTLINK:
|
|
64
|
-
return FieldTypePbo.PARENTLINK
|
|
65
|
-
case FieldType.PICKLIST:
|
|
66
|
-
return FieldTypePbo.PICKLIST
|
|
67
|
-
case FieldType.SELECTION:
|
|
68
|
-
return FieldTypePbo.SELECTION
|
|
69
|
-
case FieldType.SHORT:
|
|
70
|
-
return FieldTypePbo.SHORT
|
|
71
|
-
case FieldType.SIDE_LINK:
|
|
72
|
-
return FieldTypePbo.SIDE_LINK
|
|
73
|
-
case FieldType.STRING:
|
|
74
|
-
return FieldTypePbo.STRING
|
|
75
|
-
case _:
|
|
76
|
-
return FieldTypePbo.FIELD_TYPE_UNSPECIFIED
|
|
77
|
-
|
|
78
|
-
@staticmethod
|
|
79
|
-
def sort_direction_to_pbo(sort_direction: SortDirection | None) -> SortDirectionPbo:
|
|
80
|
-
"""
|
|
81
|
-
Convert a SortDirection enum to its corresponding SortDirectionPbo.
|
|
82
|
-
|
|
83
|
-
:param sort_direction: The SortDirection enum value.
|
|
84
|
-
:return: The corresponding SortDirectionPbo.
|
|
85
|
-
"""
|
|
86
|
-
if sort_direction is None or sort_direction == SortDirection.NONE:
|
|
87
|
-
return SortDirectionPbo.SORT_DIRECTION_NONE
|
|
88
|
-
elif sort_direction == SortDirection.ASCENDING:
|
|
89
|
-
return SortDirectionPbo.SORT_DIRECTION_ASCENDING
|
|
90
|
-
elif sort_direction == SortDirection.DESCENDING:
|
|
91
|
-
return SortDirectionPbo.SORT_DIRECTION_DESCENDING
|
|
92
|
-
else:
|
|
93
|
-
return SortDirectionPbo.SORT_DIRECTION_UNSPECIFIED
|
|
94
|
-
|
|
95
|
-
@staticmethod
|
|
96
|
-
def double_format_to_pbo(double_format: SapioDoubleFormat | None) -> DoubleFormatPbo:
|
|
97
|
-
"""
|
|
98
|
-
Convert a SapioDoubleFormat enum to its corresponding DoubleFormatPbo.
|
|
99
|
-
|
|
100
|
-
:param double_format: The SapioDoubleFormat enum value.
|
|
101
|
-
:return: The corresponding DoubleFormatPbo.
|
|
102
|
-
"""
|
|
103
|
-
if double_format is None:
|
|
104
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_UNSPECIFIED
|
|
105
|
-
elif double_format == SapioDoubleFormat.CURRENCY:
|
|
106
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_CURRENCY
|
|
107
|
-
elif double_format == SapioDoubleFormat.PERCENTAGE:
|
|
108
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_PERCENTAGE
|
|
109
|
-
else:
|
|
110
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_UNSPECIFIED
|
|
111
|
-
|
|
112
|
-
@staticmethod
|
|
113
|
-
def string_format_to_pbo(string_format: SapioStringFormat | None) -> StringFormatPbo:
|
|
114
|
-
"""
|
|
115
|
-
Convert a SapioStringFormat enum to its corresponding StringFormatPbo.
|
|
116
|
-
|
|
117
|
-
:param string_format: The SapioStringFormat enum value.
|
|
118
|
-
:return: The corresponding StringFormatPbo.
|
|
119
|
-
"""
|
|
120
|
-
if string_format is None:
|
|
121
|
-
return StringFormatPbo.STRING_FORMAT_UNSPECIFIED
|
|
122
|
-
elif string_format == SapioStringFormat.EMAIL:
|
|
123
|
-
return StringFormatPbo.STRING_FORMAT_EMAIL
|
|
124
|
-
elif string_format == SapioStringFormat.PHONE:
|
|
125
|
-
return StringFormatPbo.STRING_FORMAT_PHONE
|
|
126
|
-
else:
|
|
127
|
-
return StringFormatPbo.STRING_FORMAT_UNSPECIFIED
|
|
128
|
-
|
|
129
|
-
@staticmethod
|
|
130
|
-
def field_validator_to_pbo(validator: FieldValidator | None) -> FieldValidatorPbo | None:
|
|
131
|
-
"""
|
|
132
|
-
Convert a FieldValidator object to its corresponding FieldValidatorPbo.
|
|
133
|
-
|
|
134
|
-
:param validator: The FieldValidator object.
|
|
135
|
-
:return: The corresponding FieldValidatorPbo or None if validator is None.
|
|
136
|
-
"""
|
|
137
|
-
if validator is None:
|
|
138
|
-
return None
|
|
139
|
-
return FieldValidatorPbo(
|
|
140
|
-
validation_regex=validator.validation_regex,
|
|
141
|
-
error_message=validator.error_message
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
@staticmethod
|
|
145
|
-
def list_mode_to_str(list_mode: ListMode, field: VeloxSelectionFieldDefinition) -> str | None:
|
|
146
|
-
"""
|
|
147
|
-
Convert a ListMode enum to its string representation.
|
|
148
|
-
|
|
149
|
-
:param list_mode: The ListMode enum value.
|
|
150
|
-
:param field: The VeloxSelectionFieldDefinition object.
|
|
151
|
-
:return: The string representation of the ListMode or None if list_mode is None.
|
|
152
|
-
"""
|
|
153
|
-
if list_mode is None:
|
|
154
|
-
return None
|
|
155
|
-
list_mode_str = list_mode.list_mode_name
|
|
156
|
-
if list_mode == ListMode.LIST:
|
|
157
|
-
list_mode_str += field.pick_list_name or ""
|
|
158
|
-
elif list_mode == ListMode.PLUGIN:
|
|
159
|
-
list_mode_str += field.plugin_name or ""
|
|
160
|
-
elif list_mode == ListMode.REPORT:
|
|
161
|
-
list_mode_str += field.custom_report_name or ""
|
|
162
|
-
return list_mode_str
|
|
163
|
-
|
|
164
|
-
@staticmethod
|
|
165
|
-
def field_def_to_pbo(field: AbstractVeloxFieldDefinition) -> VeloxFieldDefPbo:
|
|
166
|
-
"""
|
|
167
|
-
Convert a AbstractVeloxFieldDefinition object to its corresponding VeloxFieldDefPbo.
|
|
168
|
-
|
|
169
|
-
:param field: The AbstractVeloxFieldDefinition object.
|
|
170
|
-
:return: The corresponding VeloxFieldDefPbo.
|
|
171
|
-
"""
|
|
172
|
-
accession_properties: AccessionPropertiesPbo | None = None
|
|
173
|
-
action_properties: ActionPropertiesPbo | None = None
|
|
174
|
-
action_string_properties: ActionStringPropertiesPbo | None = None
|
|
175
|
-
boolean_properties: BooleanPropertiesPbo | None = None
|
|
176
|
-
child_link_properties: ChildLinkPropertiesPbo | None = None
|
|
177
|
-
date_properties: DatePropertiesPbo | None = None
|
|
178
|
-
date_range_properties: DateRangePropertiesPbo | None = None
|
|
179
|
-
double_properties: DoublePropertiesPbo | None = None
|
|
180
|
-
enum_properties: EnumPropertiesPbo | None = None
|
|
181
|
-
file_blob_properties: FileBlobPropertiesPbo | None = None
|
|
182
|
-
identifier_properties: IdentifierPropertiesPbo | None = None
|
|
183
|
-
integer_properties: IntegerPropertiesPbo | None = None
|
|
184
|
-
long_properties: LongPropertiesPbo | None = None
|
|
185
|
-
multi_parent_properties: MultiParentPropertiesPbo | None = None
|
|
186
|
-
parent_link_properties: ParentLinkPropertiesPbo | None = None
|
|
187
|
-
picklist_properties: PickListPropertiesPbo | None = None
|
|
188
|
-
selection_properties: SelectionPropertiesPbo | None = None
|
|
189
|
-
short_properties: ShortPropertiesPbo | None = None
|
|
190
|
-
side_link_properties: SideLinkPropertiesPbo | None = None
|
|
191
|
-
string_properties: StringPropertiesPbo | None = None
|
|
192
|
-
|
|
193
|
-
if isinstance(field, VeloxAccessionFieldDefinition):
|
|
194
|
-
accession_properties = AccessionPropertiesPbo(
|
|
195
|
-
unique_value=field.unique_value,
|
|
196
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
197
|
-
link_out=field.link_out,
|
|
198
|
-
link_out_url=field.link_out_url,
|
|
199
|
-
sequence_key=field.sequence_key,
|
|
200
|
-
prefix=field.prefix,
|
|
201
|
-
suffix=field.suffix,
|
|
202
|
-
number_of_digits=field.number_of_digits,
|
|
203
|
-
starting_value=field.starting_value
|
|
204
|
-
)
|
|
205
|
-
elif isinstance(field, VeloxActionFieldDefinition):
|
|
206
|
-
action_properties = ActionPropertiesPbo(
|
|
207
|
-
# icon_name # Missing in FieldDefinition.py
|
|
208
|
-
# icon_color # Missing in FieldDefinition.py
|
|
209
|
-
# background_color # Missing in FieldDefinition.py
|
|
210
|
-
# font_color # Missing in FieldDefinition.py
|
|
211
|
-
# action_plugin_path # Missing in FieldDefinition.py
|
|
212
|
-
)
|
|
213
|
-
elif isinstance(field, VeloxActionStringFieldDefinition):
|
|
214
|
-
action_string_properties = ActionStringPropertiesPbo(
|
|
215
|
-
default_value=field.default_value,
|
|
216
|
-
max_length=field.max_length,
|
|
217
|
-
unique_value=field.unique_value,
|
|
218
|
-
icon_name=field.icon_name,
|
|
219
|
-
action_plugin_path=field.action_plugin_path,
|
|
220
|
-
field_validator=ProtobufUtils.field_validator_to_pbo(field.field_validator),
|
|
221
|
-
direct_edit=field.direct_edit
|
|
222
|
-
)
|
|
223
|
-
elif isinstance(field, VeloxBooleanFieldDefinition):
|
|
224
|
-
boolean_properties = BooleanPropertiesPbo(
|
|
225
|
-
default_value=field.default_value,
|
|
226
|
-
is_process_todo_item=field.process_todo_item,
|
|
227
|
-
dependent_fields=[BooleanDependentFieldEntryPbo(k, v) for k, v in field.get_dependent_field_map().items()],
|
|
228
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
229
|
-
)
|
|
230
|
-
elif isinstance(field, VeloxChildLinkFieldDefinition):
|
|
231
|
-
child_link_properties = ChildLinkPropertiesPbo(
|
|
232
|
-
# default_value # Missing in FieldDefinition.py
|
|
233
|
-
)
|
|
234
|
-
elif isinstance(field, VeloxDateFieldDefinition):
|
|
235
|
-
date_properties = DatePropertiesPbo(
|
|
236
|
-
default_value=field.default_value,
|
|
237
|
-
static_date=field.static_date,
|
|
238
|
-
date_time_format=field.date_time_format
|
|
239
|
-
)
|
|
240
|
-
elif isinstance(field, VeloxDateRangeFieldDefinition):
|
|
241
|
-
date_range_properties = DateRangePropertiesPbo(
|
|
242
|
-
default_value=field.default_value,
|
|
243
|
-
is_static=field.static_date,
|
|
244
|
-
date_time_format=field.date_time_format
|
|
245
|
-
)
|
|
246
|
-
elif isinstance(field, VeloxDoubleFieldDefinition):
|
|
247
|
-
double_properties = DoublePropertiesPbo(
|
|
248
|
-
min_value=field.min_value,
|
|
249
|
-
max_value=field.max_value,
|
|
250
|
-
default_value=field.default_value,
|
|
251
|
-
precision=field.precision,
|
|
252
|
-
double_format=ProtobufUtils.double_format_to_pbo(field.double_format),
|
|
253
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
254
|
-
)
|
|
255
|
-
# elif isinstance(field, VeloxFileBlobFieldDefinition):
|
|
256
|
-
# file_blob_properties = FileBlobPropertiesPbo()
|
|
257
|
-
elif isinstance(field, VeloxEnumFieldDefinition):
|
|
258
|
-
enum_properties = EnumPropertiesPbo(
|
|
259
|
-
default_value=field.default_value,
|
|
260
|
-
values=field.values if field.values is not None else [],
|
|
261
|
-
# color_mapping # Missing in FieldDefinition.py
|
|
262
|
-
# auto_clear_field_list # Missing in FieldDefinition.py
|
|
263
|
-
dependent_fields=[EnumDependentFieldEntryPbo(k, v) for k,v in field.get_dependent_field_map().items()],
|
|
264
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
265
|
-
)
|
|
266
|
-
elif isinstance(field, VeloxIdentifierFieldDefinition):
|
|
267
|
-
identifier_properties = IdentifierPropertiesPbo(
|
|
268
|
-
# default_value # Missing in FieldDefinition.py
|
|
269
|
-
)
|
|
270
|
-
elif isinstance(field, VeloxIntegerFieldDefinition):
|
|
271
|
-
integer_properties = IntegerPropertiesPbo(
|
|
272
|
-
min_value=field.min_value,
|
|
273
|
-
max_value=field.max_value,
|
|
274
|
-
default_value=field.default_value,
|
|
275
|
-
unique_value=field.unique_value,
|
|
276
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
277
|
-
)
|
|
278
|
-
elif isinstance(field, VeloxLongFieldDefinition):
|
|
279
|
-
long_properties = LongPropertiesPbo(
|
|
280
|
-
min_value=field.min_value,
|
|
281
|
-
max_value=field.max_value,
|
|
282
|
-
default_value=field.default_value,
|
|
283
|
-
unique_value=field.unique_value,
|
|
284
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
285
|
-
)
|
|
286
|
-
elif isinstance(field, VeloxMultiParentFieldDefinition):
|
|
287
|
-
multi_parent_properties = MultiParentPropertiesPbo()
|
|
288
|
-
elif isinstance(field, VeloxParentFieldDefinition):
|
|
289
|
-
parent_link_properties = ParentLinkPropertiesPbo(
|
|
290
|
-
# default_value # Missing in FieldDefinition.py
|
|
291
|
-
)
|
|
292
|
-
elif isinstance(field, VeloxPickListFieldDefinition):
|
|
293
|
-
picklist_properties = PickListPropertiesPbo(
|
|
294
|
-
default_value=field.default_value,
|
|
295
|
-
pick_list_name=field.pick_list_name,
|
|
296
|
-
direct_edit=field.direct_edit,
|
|
297
|
-
# link_out # Missing in FieldDefinition.py
|
|
298
|
-
# link_out_url # Missing in FieldDefinition.py
|
|
299
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
300
|
-
# field_validator # Missing in FieldDefinition.py
|
|
301
|
-
# color_mapping # Missing in FieldDefinition.py
|
|
302
|
-
# auto_clear_field_list # Missing in FieldDefinition.py
|
|
303
|
-
# process_detail_map # Missing in FieldDefinition.py
|
|
304
|
-
dependent_fields=[SelectionDependentFieldEntryPbo(k, v) for k,v in field.get_dependent_field_map().items()],
|
|
305
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
306
|
-
)
|
|
307
|
-
elif isinstance(field, VeloxSelectionFieldDefinition):
|
|
308
|
-
list_mode_str = ProtobufUtils.list_mode_to_str(field.list_mode, field)
|
|
309
|
-
selection_properties = SelectionPropertiesPbo(
|
|
310
|
-
default_value=field.default_value,
|
|
311
|
-
list_mode=list_mode_str,
|
|
312
|
-
# auto_sort # Missing in FieldDefinition.py
|
|
313
|
-
direct_edit=field.direct_edit,
|
|
314
|
-
unique_value=field.unique_value,
|
|
315
|
-
# link_out # Missing in FieldDefinition.py
|
|
316
|
-
# link_out_url # Missing in FieldDefinition.py
|
|
317
|
-
multi_select=field.multi_select,
|
|
318
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
319
|
-
# is_auto_size # Missing in FieldDefinition.py
|
|
320
|
-
# field_validator # Missing in FieldDefinition.py
|
|
321
|
-
static_list_values=field.static_list_values if field.static_list_values is not None else [],
|
|
322
|
-
# color_mapping # Missing in FieldDefinition.py
|
|
323
|
-
# auto_clear_field_list # Missing in FieldDefinition.py
|
|
324
|
-
# process_detail_map # Missing in FieldDefinition.py
|
|
325
|
-
dependent_fields=[SelectionDependentFieldEntryPbo(k, v) for k,v in field.get_dependent_field_map().items()],
|
|
326
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
327
|
-
)
|
|
328
|
-
elif isinstance(field, VeloxShortFieldDefinition):
|
|
329
|
-
short_properties = ShortPropertiesPbo(
|
|
330
|
-
min_value=field.min_value,
|
|
331
|
-
max_value=field.max_value,
|
|
332
|
-
default_value=field.default_value,
|
|
333
|
-
unique_value=field.unique_value,
|
|
334
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
335
|
-
)
|
|
336
|
-
elif isinstance(field, VeloxSideLinkFieldDefinition):
|
|
337
|
-
side_link_properties = SideLinkPropertiesPbo(
|
|
338
|
-
linked_data_type_name=field.linked_data_type_name,
|
|
339
|
-
default_value=field.default_value,
|
|
340
|
-
# show_in_knowledge_graph # Missing in FieldDefinition.py
|
|
341
|
-
# knowledge_graph_display_name # Missing in FieldDefinition.py
|
|
342
|
-
)
|
|
343
|
-
elif isinstance(field, VeloxStringFieldDefinition):
|
|
344
|
-
string_properties = StringPropertiesPbo(
|
|
345
|
-
default_value=field.default_value,
|
|
346
|
-
max_length=field.max_length,
|
|
347
|
-
num_lines=field.num_lines,
|
|
348
|
-
unique_value=field.unique_value,
|
|
349
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
350
|
-
html_editor=field.html_editor,
|
|
351
|
-
link_out=field.link_out,
|
|
352
|
-
link_out_url=field.link_out_url,
|
|
353
|
-
string_format=ProtobufUtils.string_format_to_pbo(field.string_format),
|
|
354
|
-
is_auto_size=field.auto_size,
|
|
355
|
-
field_validator=ProtobufUtils.field_validator_to_pbo(field.field_validator),
|
|
356
|
-
# preserve_padding # Missing in FieldDefinition.py
|
|
357
|
-
)
|
|
358
|
-
else:
|
|
359
|
-
print(f"Warning: Unhandled field type for properties mapping: {type(field)}")
|
|
360
|
-
|
|
361
|
-
return VeloxFieldDefPbo(
|
|
362
|
-
data_field_type=ProtobufUtils.field_type_to_pbo(field.data_field_type),
|
|
363
|
-
data_field_name=field.data_field_name,
|
|
364
|
-
display_name=field.display_name,
|
|
365
|
-
description=field.description,
|
|
366
|
-
required=field.required,
|
|
367
|
-
editable=field.editable,
|
|
368
|
-
visible=field.visible,
|
|
369
|
-
identifier=field.identifier,
|
|
370
|
-
identifier_order=field.identifier_order,
|
|
371
|
-
sort_direction=ProtobufUtils.sort_direction_to_pbo(field.sort_direction),
|
|
372
|
-
sort_order=field.sort_order,
|
|
373
|
-
tag=field.tag,
|
|
374
|
-
# approve_edit # Missing in FieldDefinition.py
|
|
375
|
-
# workflow_only_editing # Missing in FieldDefinition.py
|
|
376
|
-
# font_size # Missing in FieldDefinition.py
|
|
377
|
-
# bold_font # Missing in FieldDefinition.py
|
|
378
|
-
# italic_font # Missing in FieldDefinition.py
|
|
379
|
-
# text_decoration # Missing in FieldDefinition.py
|
|
380
|
-
is_key_field=field.key_field,
|
|
381
|
-
key_field_order=field.key_field_order,
|
|
382
|
-
# is_removable # Missing in FieldDefinition.py
|
|
383
|
-
is_system_field=field.system_field,
|
|
384
|
-
# is_restricted # Missing in FieldDefinition.py
|
|
385
|
-
is_audit_logged=field.audit_logged,
|
|
386
|
-
# is_active # Missing in FieldDefinition.py
|
|
387
|
-
# is_for_plugin_use_only # Missing in FieldDefinition.py
|
|
388
|
-
default_table_column_width=field.default_table_column_width,
|
|
389
|
-
|
|
390
|
-
accession_properties=accession_properties,
|
|
391
|
-
action_properties=action_properties,
|
|
392
|
-
action_string_properties=action_string_properties,
|
|
393
|
-
boolean_properties=boolean_properties,
|
|
394
|
-
child_link_properties=child_link_properties,
|
|
395
|
-
date_properties=date_properties,
|
|
396
|
-
date_range_properties=date_range_properties,
|
|
397
|
-
double_properties=double_properties,
|
|
398
|
-
enum_properties=enum_properties,
|
|
399
|
-
file_blob_properties=file_blob_properties,
|
|
400
|
-
identifier_properties=identifier_properties,
|
|
401
|
-
integer_properties=integer_properties,
|
|
402
|
-
long_properties=long_properties,
|
|
403
|
-
multi_parent_properties=multi_parent_properties,
|
|
404
|
-
parent_link_properties=parent_link_properties,
|
|
405
|
-
picklist_properties=picklist_properties,
|
|
406
|
-
selection_properties=selection_properties,
|
|
407
|
-
short_properties=short_properties,
|
|
408
|
-
side_link_properties=side_link_properties,
|
|
409
|
-
string_properties=string_properties,
|
|
410
|
-
)
|
|
411
|
-
|
|
412
|
-
@staticmethod
|
|
413
|
-
def value_to_field_pbo(value: FieldValue) -> FieldValuePbo:
|
|
414
|
-
"""
|
|
415
|
-
Convert a Python value to its corresponding FieldValuePbo.
|
|
416
|
-
|
|
417
|
-
:param value: The Python value (str, int, float, bool).
|
|
418
|
-
:return: The corresponding FieldValuePbo object.
|
|
419
|
-
"""
|
|
420
|
-
field_value = FieldValuePbo()
|
|
421
|
-
if isinstance(value, str):
|
|
422
|
-
field_value.string_value = value
|
|
423
|
-
elif isinstance(value, int):
|
|
424
|
-
field_value.int_value = value
|
|
425
|
-
elif isinstance(value, float):
|
|
426
|
-
field_value.double_value = value
|
|
427
|
-
elif isinstance(value, bool):
|
|
428
|
-
field_value.bool_value = value
|
|
429
|
-
else:
|
|
430
|
-
raise ValueError(f"Unsupported value type: {type(value)}")
|
|
431
|
-
return field_value
|
|
432
|
-
|
|
433
|
-
@staticmethod
|
|
434
|
-
def field_pbo_to_value(value: FieldValuePbo) -> FieldValue:
|
|
435
|
-
"""
|
|
436
|
-
Convert a StepRecordFieldValue to its corresponding Python value.
|
|
437
|
-
|
|
438
|
-
:param value: The StepRecordFieldValue object.
|
|
439
|
-
:return: The corresponding Python value.
|
|
440
|
-
"""
|
|
441
|
-
if value.HasField("string_value"):
|
|
442
|
-
return value.string_value
|
|
443
|
-
elif value.HasField("int_value"):
|
|
444
|
-
return value.int_value
|
|
445
|
-
elif value.HasField("double_value"):
|
|
446
|
-
return value.double_value
|
|
447
|
-
elif value.HasField("bool_value"):
|
|
448
|
-
return value.bool_value
|
|
449
|
-
else:
|
|
450
|
-
return None
|
|
451
|
-
|
|
452
|
-
@staticmethod
|
|
453
|
-
def field_def_pbo_to_default_value(field_def: VeloxFieldDefPbo) -> FieldValue:
|
|
454
|
-
"""
|
|
455
|
-
Get the default value of a VeloxFieldDefPbo.
|
|
456
|
-
|
|
457
|
-
:param field_def: The VeloxFieldDefPbo object.
|
|
458
|
-
:return: The default value for the field definition.
|
|
459
|
-
"""
|
|
460
|
-
match field_def.data_field_type:
|
|
461
|
-
case FieldTypePbo.ACTION:
|
|
462
|
-
return None
|
|
463
|
-
case FieldTypePbo.ACTION_STRING:
|
|
464
|
-
return field_def.action_string_properties.default_value
|
|
465
|
-
case FieldTypePbo.AUTO_ACCESSION:
|
|
466
|
-
return None
|
|
467
|
-
case FieldTypePbo.BOOLEAN:
|
|
468
|
-
return field_def.boolean_properties.default_value
|
|
469
|
-
case FieldTypePbo.CHILDLINK:
|
|
470
|
-
return None
|
|
471
|
-
case FieldTypePbo.DATE:
|
|
472
|
-
return field_def.date_properties.default_value
|
|
473
|
-
case FieldTypePbo.DATE_RANGE:
|
|
474
|
-
return field_def.date_range_properties.default_value
|
|
475
|
-
case FieldTypePbo.DOUBLE:
|
|
476
|
-
return field_def.double_properties.default_value
|
|
477
|
-
case FieldTypePbo.ENUM:
|
|
478
|
-
return field_def.enum_properties.default_value
|
|
479
|
-
# case FieldTypePbo.FILE_BLOB:
|
|
480
|
-
# return None
|
|
481
|
-
case FieldTypePbo.IDENTIFIER:
|
|
482
|
-
return None
|
|
483
|
-
case FieldTypePbo.INTEGER:
|
|
484
|
-
return field_def.integer_properties.default_value
|
|
485
|
-
case FieldTypePbo.LINK:
|
|
486
|
-
return None
|
|
487
|
-
case FieldTypePbo.LONG:
|
|
488
|
-
return field_def.long_properties.default_value
|
|
489
|
-
case FieldTypePbo.MULTIPARENTLINK:
|
|
490
|
-
return None
|
|
491
|
-
case FieldTypePbo.PARENTLINK:
|
|
492
|
-
return None
|
|
493
|
-
case FieldTypePbo.PICKLIST:
|
|
494
|
-
return field_def.picklist_properties.default_value
|
|
495
|
-
case FieldTypePbo.SELECTION:
|
|
496
|
-
return field_def.selection_properties.default_value
|
|
497
|
-
case FieldTypePbo.SHORT:
|
|
498
|
-
return field_def.short_properties.default_value
|
|
499
|
-
case FieldTypePbo.SIDE_LINK:
|
|
500
|
-
return field_def.side_link_properties.default_value
|
|
501
|
-
case FieldTypePbo.STRING:
|
|
502
|
-
return field_def.string_properties.default_value
|
|
503
|
-
case _:
|
|
504
|
-
raise Exception(f"Unexpected field type: {field_def.data_field_type}")
|