rapidata 0.2.1__py3-none-any.whl → 0.4.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.
rapidata/__init__.py CHANGED
@@ -1 +1,18 @@
1
- from rapidata.rapidata_client import RapidataClient
1
+ from .rapidata_client import (
2
+ RapidataClient,
3
+ ClassifyWorkflow,
4
+ TranscriptionWorkflow,
5
+ CompareWorkflow,
6
+ FreeTextWorkflow,
7
+ DemographicSelection,
8
+ LabelingSelection,
9
+ ValidationSelection,
10
+ NaiveReferee,
11
+ ClassifyEarlyStoppingReferee,
12
+ PrivateTextMetadata,
13
+ PublicTextMetadata,
14
+ PromptMetadata,
15
+ TranscriptionMetadata,
16
+ FeatureFlags,
17
+ CountryCodes
18
+ )
@@ -1 +1,7 @@
1
- from .rapidata_client import RapidataClient
1
+ from .rapidata_client import RapidataClient
2
+ from .workflow import ClassifyWorkflow, TranscriptionWorkflow, CompareWorkflow, FreeTextWorkflow
3
+ from .selection import DemographicSelection, LabelingSelection, ValidationSelection
4
+ from .referee import NaiveReferee, ClassifyEarlyStoppingReferee
5
+ from .metadata import PrivateTextMetadata, PublicTextMetadata, PromptMetadata, TranscriptionMetadata
6
+ from .feature_flags import FeatureFlags
7
+ from .country_codes import CountryCodes
@@ -1 +1 @@
1
- from .country_codes import CountryCodes as CountryCodes
1
+ from .country_codes import CountryCodes
@@ -1 +1 @@
1
- from .feature_flags import FeatureFlags as FeatureFlags
1
+ from .feature_flags import FeatureFlags
@@ -0,0 +1,5 @@
1
+ from .base_metadata import Metadata
2
+ from .private_text_metadata import PrivateTextMetadata
3
+ from .public_text_metadata import PublicTextMetadata
4
+ from .prompt_metadata import PromptMetadata
5
+ from .transcription_metadata import TranscriptionMetadata
@@ -0,0 +1,16 @@
1
+ from rapidata.api_client.models.public_text_metadata_input import (
2
+ PublicTextMetadataInput,
3
+ )
4
+ from rapidata.rapidata_client.metadata.base_metadata import Metadata
5
+
6
+
7
+ class PublicTextMetadata(Metadata):
8
+
9
+ def __init__(self, text: str, identifier: str = "public_text"):
10
+ super().__init__(identifier=identifier)
11
+ self._text = text
12
+
13
+ def to_model(self):
14
+ return PublicTextMetadataInput(
15
+ _t="PublicTextMetadataInput", identifier=self._identifier, text=self._text
16
+ )
@@ -23,6 +23,8 @@ from rapidata.rapidata_client.order.rapidata_order import RapidataOrder
23
23
  from rapidata.rapidata_client.referee import Referee
24
24
  from rapidata.service.openapi_service import OpenAPIService
25
25
 
26
+ from rapidata.rapidata_client.workflow.compare_workflow import CompareWorkflow
27
+
26
28
 
27
29
  class RapidataOrderBuilder:
28
30
  """Builder object for creating Rapidata orders.
@@ -51,10 +53,11 @@ class RapidataOrderBuilder:
51
53
  self._country_codes: list[str] | None = None
52
54
  self._selections: list[Selection] = []
53
55
  self._rapids_per_bag: int = 2
56
+ self._priority: int = 50
54
57
 
55
58
  def _to_model(self) -> CreateOrderModel:
56
59
  if self._workflow is None:
57
- raise ValueError("You must provide a blueprint to create an order.")
60
+ raise ValueError("You must provide a workflow to create an order.")
58
61
 
59
62
  if self._referee is None:
60
63
  print("No referee provided, using default NaiveReferee.")
@@ -85,6 +88,7 @@ class RapidataOrderBuilder:
85
88
  CreateOrderModelSelectionsInner(selection.to_model())
86
89
  for selection in self._selections
87
90
  ],
91
+ priority=self._priority,
88
92
  )
89
93
 
90
94
  def create(self, submit=True, max_workers=10) -> RapidataOrder:
@@ -100,6 +104,8 @@ class RapidataOrderBuilder:
100
104
  ValueError: If no workflow is provided.
101
105
  """
102
106
  order_model = self._to_model()
107
+ if isinstance(self._workflow, CompareWorkflow): # temp fix, will be handeled by backend in the future
108
+ assert all([len(path) == 2 for path in self._media_paths]), "The media paths must come in pairs for comparison tasks."
103
109
 
104
110
  result = self._openapi_service.order_api.order_create_post(
105
111
  create_order_model=order_model
@@ -114,7 +120,6 @@ class RapidataOrderBuilder:
114
120
  )
115
121
 
116
122
  order.dataset.add_media_from_paths(self._media_paths, self._metadata, max_workers)
117
-
118
123
  if submit:
119
124
  order.submit()
120
125
 
@@ -235,3 +240,15 @@ class RapidataOrderBuilder:
235
240
  """
236
241
  self._selections = selections
237
242
  return self
243
+
244
+ def priority(self, priority: int):
245
+ """Set the priority for the order.
246
+
247
+ Args:
248
+ priority (int): The priority to be set.
249
+
250
+ Returns:
251
+ RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
252
+ """
253
+ self._priority = priority
254
+ return self
@@ -5,6 +5,9 @@ from rapidata.rapidata_client.dataset.validation_set_builder import ValidationSe
5
5
  from rapidata.rapidata_client.order.rapidata_order_builder import RapidataOrderBuilder
6
6
  from rapidata.rapidata_client.utils.utils import Utils
7
7
  from rapidata.service.openapi_service import OpenAPIService
8
+ from rapidata.rapidata_client.order.rapidata_order import RapidataOrder
9
+ from rapidata.rapidata_client.dataset.rapidata_dataset import RapidataDataset
10
+
8
11
 
9
12
 
10
13
  class RapidataClient:
@@ -59,6 +62,25 @@ class RapidataClient:
59
62
  RapidataValidationSet: The ValidationSet instance.
60
63
  """
61
64
  return RapidataValidationSet(validation_set_id, self.openapi_service)
65
+
66
+ def get_order(self, order_id: str) -> RapidataOrder:
67
+ """Get an order by ID.
68
+
69
+ Args:
70
+ order_id (str): The ID of the order.
71
+
72
+ Returns:
73
+ RapidataOrder: The Order instance.
74
+ """
75
+
76
+ # TODO: check the pipeline for the dataset id - not really necessary atm
77
+ # order = self.openapi_service.order_api.order_get_by_id_get(order_id)
78
+ # pipeline = self.openapi_service..pipeline_get_by_id_get(order.pipeline_id)
79
+ temp_dataset = RapidataDataset("temp", self.openapi_service)
80
+ return RapidataOrder(
81
+ dataset=temp_dataset,
82
+ order_id=order_id,
83
+ openapi_service=self.openapi_service)
62
84
 
63
85
  @property
64
86
  def utils(self) -> Utils:
@@ -1,3 +1,3 @@
1
- from .base_referee import Referee as Referee
2
- from .naive_referee import NaiveReferee as NaiveReferee
3
- from .classify_early_stopping_referee import ClassifyEarlyStoppingReferee as ClassifyEarlyStoppingReferee
1
+ from .base_referee import Referee
2
+ from .naive_referee import NaiveReferee #as MaxVoteReferee
3
+ from .classify_early_stopping_referee import ClassifyEarlyStoppingReferee
@@ -0,0 +1,4 @@
1
+ from .base_selection import Selection
2
+ from .demographic_selection import DemographicSelection
3
+ from .labeling_selection import LabelingSelection
4
+ from .validation_selection import ValidationSelection
@@ -1,4 +1,5 @@
1
- from .base_workflow import Workflow as Workflow
2
- from .classify_workflow import ClassifyWorkflow as ClassifyWorkflow
3
- from .compare_workflow import CompareWorkflow as CompareWorkflow
4
- from .free_text_workflow import FreeTextWorkflow as FreeTextWorkflow
1
+ from .base_workflow import Workflow
2
+ from .classify_workflow import ClassifyWorkflow
3
+ from .compare_workflow import CompareWorkflow
4
+ from .free_text_workflow import FreeTextWorkflow
5
+ from .transcription_workflow import TranscriptionWorkflow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rapidata
3
- Version: 0.2.1
3
+ Version: 0.4.0
4
4
  Summary: Rapidata package containing the Rapidata Python Client to interact with the Rapidata Web API in an easy way.
5
5
  License: Apache-2.0
6
6
  Author: Rapidata AG
@@ -1,4 +1,4 @@
1
- rapidata/__init__.py,sha256=iUiqnIukWZ4ygW9_TNt7hn1ZnDROoi6vlS5MfJq0OE4,51
1
+ rapidata/__init__.py,sha256=mawPp5WoEVziUnaycojmzCyUDMgcIcUXqGEv2dGgDtk,407
2
2
  rapidata/api_client/__init__.py,sha256=eLFuUpHlUktj4p6EyWzC9H4Fp-asEoM6q3SPHOI2FJA,18786
3
3
  rapidata/api_client/api/__init__.py,sha256=NmEdKcHiQlR8hn7KMT-V5CZv9H-uPlR8ZHJR27gUq2g,524
4
4
  rapidata/api_client/api/coco_api.py,sha256=v5xYyQVlAv4ENgihWlji3BkbczQYKxLP0gnxfQLRmkI,24926
@@ -220,38 +220,39 @@ rapidata/api_client/models/workflow_split_model.py,sha256=zthOSaUl8dbLhLymLK_lrP
220
220
  rapidata/api_client/models/workflow_split_model_filter_configs_inner.py,sha256=1Fx9uZtztiiAdMXkj7YeCqt7o6VkG9lKf7D7UP_h088,7447
221
221
  rapidata/api_client/rest.py,sha256=A8BNcRsSo-Pn6sluvAOkTONtiA8gpulLjvGX93sQiAs,9419
222
222
  rapidata/api_client_README.md,sha256=ebeOypm4MabEycVUxBm8YQjjijLaSJMmxtlA3cFklP4,30117
223
- rapidata/rapidata_client/__init__.py,sha256=JUnCWjIxuAROIKid96Fz-Kiul7PmtnNofzwhTclAU2I,43
223
+ rapidata/rapidata_client/__init__.py,sha256=99DP3H19vIvmXqqNUjnoT-8aaZdtxCaOOgP8yYSbVB4,470
224
224
  rapidata/rapidata_client/config.py,sha256=tQLgN6k_ATOX1GzZh38At2rgBDLStV6rJ6z0vsTTPjg,186
225
- rapidata/rapidata_client/country_codes/__init__.py,sha256=Y8qeG2IMjvMGvhaPydq0nhwRQHb6dQqilctlEXu0_PE,55
225
+ rapidata/rapidata_client/country_codes/__init__.py,sha256=FB9Dcks44J6C6YBSYmTmNZ71tE130x6NO_3aLJ8fKzQ,40
226
226
  rapidata/rapidata_client/country_codes/country_codes.py,sha256=Q0HMX7uHJQDeLCFPP5bq4iYi6pgcDWEcl2ONGhjgoeU,286
227
227
  rapidata/rapidata_client/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
228
228
  rapidata/rapidata_client/dataset/rapidata_dataset.py,sha256=QDsl7ZCZxuG02yfEpBSphfSDZh_qHz6m5HUCGwZflfw,3205
229
229
  rapidata/rapidata_client/dataset/rapidata_validation_set.py,sha256=YrnUzia9AXgq2z917FtztFxj4fD5EgTWXVPBzLVIujY,9374
230
230
  rapidata/rapidata_client/dataset/validation_rapid_parts.py,sha256=SIeQesEXPPOW5kclxYLNWaKllBXHm7DQKBdMU-GXnfc,2104
231
231
  rapidata/rapidata_client/dataset/validation_set_builder.py,sha256=B9D-uNCo_PO0NCUHju_7dsWtz_KcOmvFIsxUgQ67Q2M,7471
232
- rapidata/rapidata_client/feature_flags/__init__.py,sha256=BNG_NQ4CrrC61fAWliImr8r581pIvegrkepVVbxcBw8,55
232
+ rapidata/rapidata_client/feature_flags/__init__.py,sha256=IYkcK_bZCl5RfyQFiWjjUdz4y0jipiW9qfeopq4EjQQ,40
233
233
  rapidata/rapidata_client/feature_flags/feature_flags.py,sha256=hcS9YRzpsPWpZfw-3QwSuf2TaVg-MOHBxY788oNqIW4,3957
234
- rapidata/rapidata_client/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
234
+ rapidata/rapidata_client/metadata/__init__.py,sha256=qMmo4wqScUCAJ6YXRWxvJLmbFA5YRbK39p9_exV1d50,246
235
235
  rapidata/rapidata_client/metadata/base_metadata.py,sha256=BJoZT4lRs94lu7PE3__LcsMINHNDVKRKRART-EKzSaw,217
236
236
  rapidata/rapidata_client/metadata/private_text_metadata.py,sha256=VJ_SJwp8OMFZLuUMRWvPeKOySXYJuGr-YgpwuLfTbmo,517
237
237
  rapidata/rapidata_client/metadata/prompt_metadata.py,sha256=_FypjKWrC3iKUO_G2CVwAGcYbEYClVv4K7upqlnmecw,468
238
+ rapidata/rapidata_client/metadata/public_text_metadata.py,sha256=LTiBQHs6izxQ6-C84d6Pf7lL4ENTDgg__HZnDKvzvMc,511
238
239
  rapidata/rapidata_client/metadata/transcription_metadata.py,sha256=THtDEVCON4UlcXHmXrjilaOLHys4TrktUOPGWnXaCcc,631
239
240
  rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
240
241
  rapidata/rapidata_client/order/rapidata_order.py,sha256=DCfw_xH7Ja8KURlJYaxVuX6dM81sUF7HLyX4iTfqqZc,3098
241
- rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=Wx7lhThTd6SwJNSbXzhGCsEgMhizjsriGz2zMjbQyEI,8134
242
- rapidata/rapidata_client/rapidata_client.py,sha256=z3vz5_GNivnShj7kqii-eUff16rvwSy62zwi8WZqAWo,2776
243
- rapidata/rapidata_client/referee/__init__.py,sha256=x0AxGCsR6TlDjfqQ00lB9V7QVS9EZCJzweNEIzx42PI,207
242
+ rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=lciogpvXZhMNe8RE_6qLtHNSzSQobfqOXdw106f9mzg,8838
243
+ rapidata/rapidata_client/rapidata_client.py,sha256=NsLE6WRrnPFNyCklD0d249XmCoVr_Z_z8HOf-scEnxM,3623
244
+ rapidata/rapidata_client/referee/__init__.py,sha256=Ow9MQsONhF4sX2wFK9jbvSBrpcJgtq3OglIQMkBUdIY,167
244
245
  rapidata/rapidata_client/referee/base_referee.py,sha256=bMy7cw0a-pGNbFu6u_1_Jplu0A483Ubj4oDQzh8vu8k,493
245
246
  rapidata/rapidata_client/referee/classify_early_stopping_referee.py,sha256=B5wsqKM3_Oc1TU_MFGiIyiXjwK1LcmaVjhzLdaL8Cgw,1797
246
247
  rapidata/rapidata_client/referee/naive_referee.py,sha256=KWMLSc73gOdM8YT_ciFhfN7J4eKgtOFphBG9tIra9g0,1179
247
- rapidata/rapidata_client/selection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
248
+ rapidata/rapidata_client/selection/__init__.py,sha256=KogO0_Hc0ENP5YWZrWhJ5AbNURJvmGuJurFrOuNyjps,198
248
249
  rapidata/rapidata_client/selection/base_selection.py,sha256=Y3HkROPm4I4HLNiR0HuHKpvk236KkRlsoDxQATm_chY,138
249
250
  rapidata/rapidata_client/selection/demographic_selection.py,sha256=DU8YvAj-WFALMAQJgjvBm1_ruIdPg2JVuKw07f7nDuA,453
250
251
  rapidata/rapidata_client/selection/labeling_selection.py,sha256=cqDMQEXfQGMmgIvPgGOYgIGaXflV_J7LZsGOsakLXqo,425
251
252
  rapidata/rapidata_client/selection/validation_selection.py,sha256=HswzD2SvZZWisNLoGj--0sT_TIK8crYp3xGGndo6aLY,523
252
253
  rapidata/rapidata_client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
254
  rapidata/rapidata_client/utils/utils.py,sha256=Fl99gCnh_HnieIp099xEvEv4g2kEIKiFcUp0G2iz6x8,815
254
- rapidata/rapidata_client/workflow/__init__.py,sha256=CDG8bKOBhLV4A0uBlqOd__79fH9KW3-UlZsR1RANLf0,250
255
+ rapidata/rapidata_client/workflow/__init__.py,sha256=nHB6heVVf_A3nhSL0NGapnGqJAL0K9nfOpfyaUM5srw,238
255
256
  rapidata/rapidata_client/workflow/base_workflow.py,sha256=VoZtNIFoylTrylMWC7CqzuSCLfG2yEGCmenf-HBzYOI,1196
256
257
  rapidata/rapidata_client/workflow/classify_workflow.py,sha256=NkyyBrlCDqYVQaCARR9EHYuREEtXond69kD6jbzcN3M,1713
257
258
  rapidata/rapidata_client/workflow/compare_workflow.py,sha256=nqrgtohlXBfgHh_cRPOFAlwdI8wVc7PUsH0FDM7wIjg,1431
@@ -262,7 +263,7 @@ rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5
262
263
  rapidata/service/openapi_service.py,sha256=-vrM2jEzQxr9KAerOYkVhpvMEeHwjzRwm9L_VFyzOT0,1537
263
264
  rapidata/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
264
265
  rapidata/utils/image_utils.py,sha256=TldO3eJWG8IhfJjm5MfNGO0mEDm1mQTsRoA0HLU1Uxs,404
265
- rapidata-0.2.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
266
- rapidata-0.2.1.dist-info/METADATA,sha256=3Uw9M9uj4-Za3qasR5n2w6LITe8O21Ladaqs0XBpgos,961
267
- rapidata-0.2.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
268
- rapidata-0.2.1.dist-info/RECORD,,
266
+ rapidata-0.4.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
267
+ rapidata-0.4.0.dist-info/METADATA,sha256=F6QuVl_gSq63EK07SgYL97-63aTgaZQBUKVB7z___L0,961
268
+ rapidata-0.4.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
269
+ rapidata-0.4.0.dist-info/RECORD,,