rapidata 2.37.0__py3-none-any.whl → 2.39.0__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 rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +3 -4
- rapidata/api_client/__init__.py +4 -5
- rapidata/api_client/api/benchmark_api.py +289 -3
- rapidata/api_client/api/leaderboard_api.py +35 -1
- rapidata/api_client/api/participant_api.py +289 -3
- rapidata/api_client/api/validation_set_api.py +119 -400
- rapidata/api_client/models/__init__.py +4 -5
- rapidata/api_client/models/ab_test_selection_a_inner.py +1 -1
- rapidata/api_client/models/compare_workflow_model1.py +1 -8
- rapidata/api_client/models/conditional_validation_selection.py +4 -9
- rapidata/api_client/models/confidence_interval.py +98 -0
- rapidata/api_client/models/create_simple_pipeline_model_pipeline_steps_inner.py +8 -22
- rapidata/api_client/models/get_standing_by_id_result.py +7 -2
- rapidata/api_client/models/get_validation_set_by_id_result.py +4 -2
- rapidata/api_client/models/simple_workflow_model1.py +1 -8
- rapidata/api_client/models/standing_by_leaderboard.py +10 -4
- rapidata/api_client/models/update_benchmark_model.py +87 -0
- rapidata/api_client/models/update_participant_model.py +87 -0
- rapidata/api_client/models/update_validation_set_model.py +93 -0
- rapidata/api_client/models/validation_chance.py +20 -3
- rapidata/api_client/models/validation_set_model.py +5 -42
- rapidata/api_client_README.md +7 -7
- rapidata/rapidata_client/__init__.py +1 -4
- rapidata/rapidata_client/api/{rapidata_exception.py → rapidata_api_client.py} +119 -2
- rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py +88 -46
- rapidata/rapidata_client/benchmark/participant/_participant.py +26 -9
- rapidata/rapidata_client/benchmark/rapidata_benchmark.py +310 -210
- rapidata/rapidata_client/benchmark/rapidata_benchmark_manager.py +134 -75
- rapidata/rapidata_client/config/__init__.py +3 -0
- rapidata/rapidata_client/config/logger.py +135 -0
- rapidata/rapidata_client/config/logging_config.py +58 -0
- rapidata/rapidata_client/config/managed_print.py +6 -0
- rapidata/rapidata_client/config/order_config.py +14 -0
- rapidata/rapidata_client/config/rapidata_config.py +15 -10
- rapidata/rapidata_client/config/tracer.py +130 -0
- rapidata/rapidata_client/config/upload_config.py +14 -0
- rapidata/rapidata_client/datapoints/_datapoint.py +1 -1
- rapidata/rapidata_client/datapoints/assets/__init__.py +1 -0
- rapidata/rapidata_client/datapoints/assets/_base_asset.py +2 -0
- rapidata/rapidata_client/datapoints/assets/_media_asset.py +1 -1
- rapidata/rapidata_client/datapoints/assets/_sessions.py +2 -2
- rapidata/rapidata_client/datapoints/assets/_text_asset.py +2 -2
- rapidata/rapidata_client/datapoints/assets/data_type_enum.py +1 -1
- rapidata/rapidata_client/datapoints/metadata/_media_asset_metadata.py +9 -8
- rapidata/rapidata_client/datapoints/metadata/_prompt_metadata.py +1 -2
- rapidata/rapidata_client/demographic/demographic_manager.py +16 -14
- rapidata/rapidata_client/filter/_base_filter.py +11 -5
- rapidata/rapidata_client/filter/age_filter.py +9 -3
- rapidata/rapidata_client/filter/and_filter.py +20 -5
- rapidata/rapidata_client/filter/campaign_filter.py +7 -1
- rapidata/rapidata_client/filter/country_filter.py +8 -2
- rapidata/rapidata_client/filter/custom_filter.py +9 -3
- rapidata/rapidata_client/filter/gender_filter.py +9 -3
- rapidata/rapidata_client/filter/language_filter.py +12 -5
- rapidata/rapidata_client/filter/models/age_group.py +4 -4
- rapidata/rapidata_client/filter/models/gender.py +4 -2
- rapidata/rapidata_client/filter/new_user_filter.py +3 -4
- rapidata/rapidata_client/filter/not_filter.py +17 -5
- rapidata/rapidata_client/filter/or_filter.py +20 -5
- rapidata/rapidata_client/filter/rapidata_filters.py +12 -9
- rapidata/rapidata_client/filter/response_count_filter.py +6 -0
- rapidata/rapidata_client/filter/user_score_filter.py +17 -5
- rapidata/rapidata_client/order/_rapidata_dataset.py +45 -17
- rapidata/rapidata_client/order/_rapidata_order_builder.py +19 -13
- rapidata/rapidata_client/order/rapidata_order.py +60 -48
- rapidata/rapidata_client/order/rapidata_order_manager.py +231 -197
- rapidata/rapidata_client/order/rapidata_results.py +71 -57
- rapidata/rapidata_client/rapidata_client.py +36 -23
- rapidata/rapidata_client/referee/__init__.py +1 -1
- rapidata/rapidata_client/referee/_base_referee.py +3 -1
- rapidata/rapidata_client/referee/_early_stopping_referee.py +2 -2
- rapidata/rapidata_client/selection/_base_selection.py +6 -0
- rapidata/rapidata_client/selection/ab_test_selection.py +7 -3
- rapidata/rapidata_client/selection/capped_selection.py +2 -2
- rapidata/rapidata_client/selection/conditional_validation_selection.py +12 -6
- rapidata/rapidata_client/selection/demographic_selection.py +9 -6
- rapidata/rapidata_client/selection/rapidata_selections.py +11 -8
- rapidata/rapidata_client/selection/shuffling_selection.py +5 -5
- rapidata/rapidata_client/selection/static_selection.py +5 -10
- rapidata/rapidata_client/selection/validation_selection.py +9 -5
- rapidata/rapidata_client/settings/_rapidata_setting.py +8 -0
- rapidata/rapidata_client/settings/alert_on_fast_response.py +8 -5
- rapidata/rapidata_client/settings/allow_neither_both.py +1 -0
- rapidata/rapidata_client/settings/custom_setting.py +3 -2
- rapidata/rapidata_client/settings/free_text_minimum_characters.py +9 -4
- rapidata/rapidata_client/settings/models/translation_behaviour_options.py +3 -2
- rapidata/rapidata_client/settings/no_shuffle.py +4 -2
- rapidata/rapidata_client/settings/play_video_until_the_end.py +7 -4
- rapidata/rapidata_client/settings/rapidata_settings.py +4 -3
- rapidata/rapidata_client/settings/translation_behaviour.py +7 -5
- rapidata/rapidata_client/validation/rapidata_validation_set.py +23 -17
- rapidata/rapidata_client/validation/rapids/box.py +3 -1
- rapidata/rapidata_client/validation/rapids/rapids.py +7 -1
- rapidata/rapidata_client/validation/rapids/rapids_manager.py +174 -141
- rapidata/rapidata_client/validation/validation_set_manager.py +285 -268
- rapidata/rapidata_client/workflow/__init__.py +1 -1
- rapidata/rapidata_client/workflow/_base_workflow.py +6 -1
- rapidata/rapidata_client/workflow/_classify_workflow.py +6 -0
- rapidata/rapidata_client/workflow/_compare_workflow.py +6 -0
- rapidata/rapidata_client/workflow/_draw_workflow.py +6 -0
- rapidata/rapidata_client/workflow/_evaluation_workflow.py +6 -0
- rapidata/rapidata_client/workflow/_free_text_workflow.py +6 -0
- rapidata/rapidata_client/workflow/_locate_workflow.py +6 -0
- rapidata/rapidata_client/workflow/_ranking_workflow.py +12 -0
- rapidata/rapidata_client/workflow/_select_words_workflow.py +6 -0
- rapidata/rapidata_client/workflow/_timestamp_workflow.py +6 -0
- rapidata/service/__init__.py +1 -1
- rapidata/service/credential_manager.py +1 -1
- rapidata/service/local_file_service.py +9 -8
- rapidata/service/openapi_service.py +2 -2
- {rapidata-2.37.0.dist-info → rapidata-2.39.0.dist-info}/METADATA +4 -1
- {rapidata-2.37.0.dist-info → rapidata-2.39.0.dist-info}/RECORD +114 -107
- rapidata/rapidata_client/logging/__init__.py +0 -2
- rapidata/rapidata_client/logging/logger.py +0 -122
- rapidata/rapidata_client/logging/output_manager.py +0 -20
- {rapidata-2.37.0.dist-info → rapidata-2.39.0.dist-info}/LICENSE +0 -0
- {rapidata-2.37.0.dist-info → rapidata-2.39.0.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Sequence, Optional, Literal
|
|
2
2
|
from itertools import zip_longest
|
|
3
3
|
|
|
4
|
+
from rapidata.rapidata_client.config.tracer import tracer
|
|
4
5
|
from rapidata.service.openapi_service import OpenAPIService
|
|
5
6
|
from rapidata.rapidata_client.order.rapidata_order import RapidataOrder
|
|
6
7
|
from rapidata.rapidata_client.order._rapidata_order_builder import RapidataOrderBuilder
|
|
@@ -33,7 +34,7 @@ from rapidata.rapidata_client.filter import RapidataFilter
|
|
|
33
34
|
from rapidata.rapidata_client.filter.rapidata_filters import RapidataFilters
|
|
34
35
|
from rapidata.rapidata_client.settings import RapidataSettings, RapidataSetting
|
|
35
36
|
from rapidata.rapidata_client.selection.rapidata_selections import RapidataSelections
|
|
36
|
-
from rapidata.rapidata_client.
|
|
37
|
+
from rapidata.rapidata_client.config import logger, rapidata_config
|
|
37
38
|
|
|
38
39
|
from rapidata.api_client.models.query_model import QueryModel
|
|
39
40
|
from rapidata.api_client.models.page_info import PageInfo
|
|
@@ -108,6 +109,23 @@ class RapidataOrderManager:
|
|
|
108
109
|
max_vote_count=responses_per_datapoint,
|
|
109
110
|
)
|
|
110
111
|
|
|
112
|
+
logger.debug(
|
|
113
|
+
"Creating order with parameters: name %s, workflow %s, assets %s, responses_per_datapoint %s, contexts %s, media_contexts %s, validation_set_id %s, confidence_threshold %s, filters %s, settings %s, sentences %s, selections %s, private_notes %s",
|
|
114
|
+
name,
|
|
115
|
+
workflow,
|
|
116
|
+
assets,
|
|
117
|
+
responses_per_datapoint,
|
|
118
|
+
contexts,
|
|
119
|
+
media_contexts,
|
|
120
|
+
validation_set_id,
|
|
121
|
+
confidence_threshold,
|
|
122
|
+
filters,
|
|
123
|
+
settings,
|
|
124
|
+
sentences,
|
|
125
|
+
selections,
|
|
126
|
+
private_notes,
|
|
127
|
+
)
|
|
128
|
+
|
|
111
129
|
order_builder = RapidataOrderBuilder(
|
|
112
130
|
name=name, openapi_service=self.__openapi_service
|
|
113
131
|
)
|
|
@@ -235,33 +253,35 @@ class RapidataOrderManager:
|
|
|
235
253
|
If provided has to be the same length as datapoints.\n
|
|
236
254
|
This will NOT be shown to the labelers but will be included in the result purely for your own reference.
|
|
237
255
|
"""
|
|
256
|
+
with tracer.start_as_current_span(
|
|
257
|
+
"RapidataOrderManager.create_classification_order"
|
|
258
|
+
):
|
|
259
|
+
if data_type == "media":
|
|
260
|
+
assets = [MediaAsset(path=path) for path in datapoints]
|
|
261
|
+
elif data_type == "text":
|
|
262
|
+
assets = [TextAsset(text=text) for text in datapoints]
|
|
263
|
+
else:
|
|
264
|
+
raise ValueError(
|
|
265
|
+
f"Unsupported data type: {data_type}, must be one of 'media' or 'text'"
|
|
266
|
+
)
|
|
238
267
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
268
|
+
return self._create_general_order(
|
|
269
|
+
name=name,
|
|
270
|
+
workflow=ClassifyWorkflow(
|
|
271
|
+
instruction=instruction, answer_options=answer_options
|
|
272
|
+
),
|
|
273
|
+
assets=assets,
|
|
274
|
+
responses_per_datapoint=responses_per_datapoint,
|
|
275
|
+
contexts=contexts,
|
|
276
|
+
media_contexts=media_contexts,
|
|
277
|
+
validation_set_id=validation_set_id,
|
|
278
|
+
confidence_threshold=confidence_threshold,
|
|
279
|
+
filters=filters,
|
|
280
|
+
selections=selections,
|
|
281
|
+
settings=settings,
|
|
282
|
+
private_notes=private_notes,
|
|
246
283
|
)
|
|
247
284
|
|
|
248
|
-
return self._create_general_order(
|
|
249
|
-
name=name,
|
|
250
|
-
workflow=ClassifyWorkflow(
|
|
251
|
-
instruction=instruction, answer_options=answer_options
|
|
252
|
-
),
|
|
253
|
-
assets=assets,
|
|
254
|
-
responses_per_datapoint=responses_per_datapoint,
|
|
255
|
-
contexts=contexts,
|
|
256
|
-
media_contexts=media_contexts,
|
|
257
|
-
validation_set_id=validation_set_id,
|
|
258
|
-
confidence_threshold=confidence_threshold,
|
|
259
|
-
filters=filters,
|
|
260
|
-
selections=selections,
|
|
261
|
-
settings=settings,
|
|
262
|
-
private_notes=private_notes,
|
|
263
|
-
)
|
|
264
|
-
|
|
265
285
|
def create_compare_order(
|
|
266
286
|
self,
|
|
267
287
|
name: str,
|
|
@@ -316,46 +336,48 @@ class RapidataOrderManager:
|
|
|
316
336
|
If provided has to be the same length as datapoints.\n
|
|
317
337
|
This will NOT be shown to the labelers but will be included in the result purely for your own reference.
|
|
318
338
|
"""
|
|
339
|
+
with tracer.start_as_current_span("RapidataOrderManager.create_compare_order"):
|
|
340
|
+
if any(type(datapoint) != list for datapoint in datapoints):
|
|
341
|
+
raise ValueError("Each datapoint must be a list of 2 paths/texts")
|
|
319
342
|
|
|
320
|
-
|
|
321
|
-
|
|
343
|
+
if any(len(datapoint) != 2 for datapoint in datapoints):
|
|
344
|
+
raise ValueError("Each datapoint must contain exactly two options")
|
|
322
345
|
|
|
323
|
-
|
|
324
|
-
|
|
346
|
+
if a_b_names is not None and len(a_b_names) != 2:
|
|
347
|
+
raise ValueError(
|
|
348
|
+
"A_B_naming must be a list of exactly two strings or None"
|
|
349
|
+
)
|
|
325
350
|
|
|
326
|
-
|
|
327
|
-
|
|
351
|
+
if data_type == "media":
|
|
352
|
+
assets = [
|
|
353
|
+
MultiAsset([MediaAsset(path=path) for path in datapoint])
|
|
354
|
+
for datapoint in datapoints
|
|
355
|
+
]
|
|
356
|
+
elif data_type == "text":
|
|
357
|
+
assets = [
|
|
358
|
+
MultiAsset([TextAsset(text=text) for text in datapoint])
|
|
359
|
+
for datapoint in datapoints
|
|
360
|
+
]
|
|
361
|
+
else:
|
|
362
|
+
raise ValueError(
|
|
363
|
+
f"Unsupported data type: {data_type}, must be one of 'media' or 'text'"
|
|
364
|
+
)
|
|
328
365
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
366
|
+
return self._create_general_order(
|
|
367
|
+
name=name,
|
|
368
|
+
workflow=CompareWorkflow(instruction=instruction, a_b_names=a_b_names),
|
|
369
|
+
assets=assets,
|
|
370
|
+
responses_per_datapoint=responses_per_datapoint,
|
|
371
|
+
contexts=contexts,
|
|
372
|
+
media_contexts=media_contexts,
|
|
373
|
+
validation_set_id=validation_set_id,
|
|
374
|
+
confidence_threshold=confidence_threshold,
|
|
375
|
+
filters=filters,
|
|
376
|
+
selections=selections,
|
|
377
|
+
settings=settings,
|
|
378
|
+
private_notes=private_notes,
|
|
342
379
|
)
|
|
343
380
|
|
|
344
|
-
return self._create_general_order(
|
|
345
|
-
name=name,
|
|
346
|
-
workflow=CompareWorkflow(instruction=instruction, a_b_names=a_b_names),
|
|
347
|
-
assets=assets,
|
|
348
|
-
responses_per_datapoint=responses_per_datapoint,
|
|
349
|
-
contexts=contexts,
|
|
350
|
-
media_contexts=media_contexts,
|
|
351
|
-
validation_set_id=validation_set_id,
|
|
352
|
-
confidence_threshold=confidence_threshold,
|
|
353
|
-
filters=filters,
|
|
354
|
-
selections=selections,
|
|
355
|
-
settings=settings,
|
|
356
|
-
private_notes=private_notes,
|
|
357
|
-
)
|
|
358
|
-
|
|
359
381
|
def create_ranking_order(
|
|
360
382
|
self,
|
|
361
383
|
name: str,
|
|
@@ -396,30 +418,31 @@ class RapidataOrderManager:
|
|
|
396
418
|
selections (Sequence[RapidataSelection], optional): The list of selections for the order. Defaults to []. Decides in what order the tasks should be shown.
|
|
397
419
|
"""
|
|
398
420
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
421
|
+
with tracer.start_as_current_span("RapidataOrderManager.create_ranking_order"):
|
|
422
|
+
if data_type == "media":
|
|
423
|
+
assets = [MediaAsset(path=path) for path in datapoints]
|
|
424
|
+
elif data_type == "text":
|
|
425
|
+
assets = [TextAsset(text=text) for text in datapoints]
|
|
426
|
+
else:
|
|
427
|
+
raise ValueError(
|
|
428
|
+
f"Unsupported data type: {data_type}, must be one of 'media' or 'text'"
|
|
429
|
+
)
|
|
407
430
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
431
|
+
return self._create_general_order(
|
|
432
|
+
name=name,
|
|
433
|
+
workflow=RankingWorkflow(
|
|
434
|
+
criteria=instruction,
|
|
435
|
+
total_comparison_budget=total_comparison_budget,
|
|
436
|
+
random_comparisons_ratio=random_comparisons_ratio,
|
|
437
|
+
context=context,
|
|
438
|
+
),
|
|
439
|
+
assets=assets,
|
|
440
|
+
responses_per_datapoint=responses_per_comparison,
|
|
441
|
+
validation_set_id=validation_set_id,
|
|
442
|
+
filters=filters,
|
|
443
|
+
selections=selections,
|
|
444
|
+
settings=settings,
|
|
445
|
+
)
|
|
423
446
|
|
|
424
447
|
def create_free_text_order(
|
|
425
448
|
self,
|
|
@@ -460,28 +483,31 @@ class RapidataOrderManager:
|
|
|
460
483
|
If provided has to be the same length as datapoints.\n
|
|
461
484
|
This will NOT be shown to the labelers but will be included in the result purely for your own reference.
|
|
462
485
|
"""
|
|
486
|
+
with tracer.start_as_current_span(
|
|
487
|
+
"RapidataOrderManager.create_free_text_order"
|
|
488
|
+
):
|
|
463
489
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
490
|
+
if data_type == "media":
|
|
491
|
+
assets = [MediaAsset(path=path) for path in datapoints]
|
|
492
|
+
elif data_type == "text":
|
|
493
|
+
assets = [TextAsset(text=text) for text in datapoints]
|
|
494
|
+
else:
|
|
495
|
+
raise ValueError(
|
|
496
|
+
f"Unsupported data type: {data_type}, must be one of 'media' or 'text'"
|
|
497
|
+
)
|
|
472
498
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
499
|
+
return self._create_general_order(
|
|
500
|
+
name=name,
|
|
501
|
+
workflow=FreeTextWorkflow(instruction=instruction),
|
|
502
|
+
assets=assets,
|
|
503
|
+
responses_per_datapoint=responses_per_datapoint,
|
|
504
|
+
contexts=contexts,
|
|
505
|
+
media_contexts=media_contexts,
|
|
506
|
+
filters=filters,
|
|
507
|
+
selections=selections,
|
|
508
|
+
settings=settings,
|
|
509
|
+
private_notes=private_notes,
|
|
510
|
+
)
|
|
485
511
|
|
|
486
512
|
def create_select_words_order(
|
|
487
513
|
self,
|
|
@@ -518,23 +544,25 @@ class RapidataOrderManager:
|
|
|
518
544
|
If provided has to be the same length as datapoints.\n
|
|
519
545
|
This will NOT be shown to the labelers but will be included in the result purely for your own reference.
|
|
520
546
|
"""
|
|
547
|
+
with tracer.start_as_current_span(
|
|
548
|
+
"RapidataOrderManager.create_select_words_order"
|
|
549
|
+
):
|
|
550
|
+
assets = [MediaAsset(path=path) for path in datapoints]
|
|
521
551
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
private_notes=private_notes,
|
|
537
|
-
)
|
|
552
|
+
return self._create_general_order(
|
|
553
|
+
name=name,
|
|
554
|
+
workflow=SelectWordsWorkflow(
|
|
555
|
+
instruction=instruction,
|
|
556
|
+
),
|
|
557
|
+
assets=assets,
|
|
558
|
+
responses_per_datapoint=responses_per_datapoint,
|
|
559
|
+
validation_set_id=validation_set_id,
|
|
560
|
+
filters=filters,
|
|
561
|
+
selections=selections,
|
|
562
|
+
settings=settings,
|
|
563
|
+
sentences=sentences,
|
|
564
|
+
private_notes=private_notes,
|
|
565
|
+
)
|
|
538
566
|
|
|
539
567
|
def create_locate_order(
|
|
540
568
|
self,
|
|
@@ -574,22 +602,22 @@ class RapidataOrderManager:
|
|
|
574
602
|
If provided has to be the same length as datapoints.\n
|
|
575
603
|
This will NOT be shown to the labelers but will be included in the result purely for your own reference.
|
|
576
604
|
"""
|
|
605
|
+
with tracer.start_as_current_span("RapidataOrderManager.create_locate_order"):
|
|
606
|
+
assets = [MediaAsset(path=path) for path in datapoints]
|
|
577
607
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
private_notes=private_notes,
|
|
592
|
-
)
|
|
608
|
+
return self._create_general_order(
|
|
609
|
+
name=name,
|
|
610
|
+
workflow=LocateWorkflow(target=instruction),
|
|
611
|
+
assets=assets,
|
|
612
|
+
responses_per_datapoint=responses_per_datapoint,
|
|
613
|
+
contexts=contexts,
|
|
614
|
+
media_contexts=media_contexts,
|
|
615
|
+
validation_set_id=validation_set_id,
|
|
616
|
+
filters=filters,
|
|
617
|
+
selections=selections,
|
|
618
|
+
settings=settings,
|
|
619
|
+
private_notes=private_notes,
|
|
620
|
+
)
|
|
593
621
|
|
|
594
622
|
def create_draw_order(
|
|
595
623
|
self,
|
|
@@ -629,22 +657,22 @@ class RapidataOrderManager:
|
|
|
629
657
|
If provided has to be the same length as datapoints.\n
|
|
630
658
|
This will NOT be shown to the labelers but will be included in the result purely for your own reference.
|
|
631
659
|
"""
|
|
660
|
+
with tracer.start_as_current_span("RapidataOrderManager.create_draw_order"):
|
|
661
|
+
assets = [MediaAsset(path=path) for path in datapoints]
|
|
632
662
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
private_notes=private_notes,
|
|
647
|
-
)
|
|
663
|
+
return self._create_general_order(
|
|
664
|
+
name=name,
|
|
665
|
+
workflow=DrawWorkflow(target=instruction),
|
|
666
|
+
assets=assets,
|
|
667
|
+
responses_per_datapoint=responses_per_datapoint,
|
|
668
|
+
contexts=contexts,
|
|
669
|
+
media_contexts=media_contexts,
|
|
670
|
+
validation_set_id=validation_set_id,
|
|
671
|
+
filters=filters,
|
|
672
|
+
selections=selections,
|
|
673
|
+
settings=settings,
|
|
674
|
+
private_notes=private_notes,
|
|
675
|
+
)
|
|
648
676
|
|
|
649
677
|
def create_timestamp_order(
|
|
650
678
|
self,
|
|
@@ -688,31 +716,34 @@ class RapidataOrderManager:
|
|
|
688
716
|
This will NOT be shown to the labelers but will be included in the result purely for your own reference.
|
|
689
717
|
"""
|
|
690
718
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
for asset in tqdm(
|
|
694
|
-
assets,
|
|
695
|
-
desc="Downloading assets and checking duration",
|
|
696
|
-
disable=RapidataOutputManager.silent_mode,
|
|
719
|
+
with tracer.start_as_current_span(
|
|
720
|
+
"RapidataOrderManager.create_timestamp_order"
|
|
697
721
|
):
|
|
698
|
-
|
|
699
|
-
raise ValueError(
|
|
700
|
-
"The datapoints for this order must have a duration. (e.g. video or audio)"
|
|
701
|
-
)
|
|
722
|
+
assets = [MediaAsset(path=path) for path in datapoints]
|
|
702
723
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
724
|
+
for asset in tqdm(
|
|
725
|
+
assets,
|
|
726
|
+
desc="Downloading assets and checking duration",
|
|
727
|
+
disable=rapidata_config.logging.silent_mode,
|
|
728
|
+
):
|
|
729
|
+
if not asset.get_duration():
|
|
730
|
+
raise ValueError(
|
|
731
|
+
"The datapoints for this order must have a duration. (e.g. video or audio)"
|
|
732
|
+
)
|
|
733
|
+
|
|
734
|
+
return self._create_general_order(
|
|
735
|
+
name=name,
|
|
736
|
+
workflow=TimestampWorkflow(instruction=instruction),
|
|
737
|
+
assets=assets,
|
|
738
|
+
responses_per_datapoint=responses_per_datapoint,
|
|
739
|
+
contexts=contexts,
|
|
740
|
+
media_contexts=media_contexts,
|
|
741
|
+
validation_set_id=validation_set_id,
|
|
742
|
+
filters=filters,
|
|
743
|
+
selections=selections,
|
|
744
|
+
settings=settings,
|
|
745
|
+
private_notes=private_notes,
|
|
746
|
+
)
|
|
716
747
|
|
|
717
748
|
def get_order_by_id(self, order_id: str) -> RapidataOrder:
|
|
718
749
|
"""Get an order by ID.
|
|
@@ -723,14 +754,14 @@ class RapidataOrderManager:
|
|
|
723
754
|
Returns:
|
|
724
755
|
RapidataOrder: The Order instance.
|
|
725
756
|
"""
|
|
757
|
+
with tracer.start_as_current_span("RapidataOrderManager.get_order_by_id"):
|
|
758
|
+
order = self.__openapi_service.order_api.order_order_id_get(order_id)
|
|
726
759
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
openapi_service=self.__openapi_service,
|
|
733
|
-
)
|
|
760
|
+
return RapidataOrder(
|
|
761
|
+
order_id=order_id,
|
|
762
|
+
name=order.order_name,
|
|
763
|
+
openapi_service=self.__openapi_service,
|
|
764
|
+
)
|
|
734
765
|
|
|
735
766
|
def find_orders(self, name: str = "", amount: int = 10) -> list[RapidataOrder]:
|
|
736
767
|
"""Find your recent orders given criteria. If nothing is provided, it will return the most recent order.
|
|
@@ -742,25 +773,28 @@ class RapidataOrderManager:
|
|
|
742
773
|
Returns:
|
|
743
774
|
list[RapidataOrder]: A list of RapidataOrder instances.
|
|
744
775
|
"""
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
776
|
+
with tracer.start_as_current_span("RapidataOrderManager.find_orders"):
|
|
777
|
+
order_page_result = self.__openapi_service.order_api.orders_get(
|
|
778
|
+
QueryModel(
|
|
779
|
+
page=PageInfo(index=1, size=amount),
|
|
780
|
+
filter=RootFilter(
|
|
781
|
+
filters=[
|
|
782
|
+
Filter(
|
|
783
|
+
field="OrderName",
|
|
784
|
+
operator=FilterOperator.CONTAINS,
|
|
785
|
+
value=name,
|
|
786
|
+
)
|
|
787
|
+
]
|
|
788
|
+
),
|
|
789
|
+
sortCriteria=[
|
|
790
|
+
SortCriterion(
|
|
791
|
+
direction=SortDirection.DESC, propertyName="OrderDate"
|
|
754
792
|
)
|
|
755
|
-
]
|
|
756
|
-
)
|
|
757
|
-
sortCriteria=[
|
|
758
|
-
SortCriterion(
|
|
759
|
-
direction=SortDirection.DESC, propertyName="OrderDate"
|
|
760
|
-
)
|
|
761
|
-
],
|
|
793
|
+
],
|
|
794
|
+
)
|
|
762
795
|
)
|
|
763
|
-
)
|
|
764
796
|
|
|
765
|
-
|
|
766
|
-
|
|
797
|
+
orders = [
|
|
798
|
+
self.get_order_by_id(order.id) for order in order_page_result.items
|
|
799
|
+
]
|
|
800
|
+
return orders
|