rapidata 0.4.0__py3-none-any.whl → 0.5.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.

Files changed (92) hide show
  1. rapidata/__init__.py +4 -3
  2. rapidata/api_client/__init__.py +51 -15
  3. rapidata/api_client/api/__init__.py +5 -0
  4. rapidata/api_client/api/campaign_api.py +1044 -0
  5. rapidata/api_client/api/compare_workflow_api.py +316 -0
  6. rapidata/api_client/api/dataset_api.py +24 -24
  7. rapidata/api_client/api/order_api.py +206 -536
  8. rapidata/api_client/api/pipeline_api.py +843 -0
  9. rapidata/api_client/api/rapid_api.py +6 -6
  10. rapidata/api_client/api/simple_workflow_api.py +350 -0
  11. rapidata/api_client/api/validation_api.py +6 -6
  12. rapidata/api_client/api/workflow_api.py +2386 -0
  13. rapidata/api_client/api_client.py +2 -2
  14. rapidata/api_client/models/__init__.py +46 -15
  15. rapidata/api_client/models/add_campaign_artifact_result.py +87 -0
  16. rapidata/api_client/models/add_campaign_model.py +149 -0
  17. rapidata/api_client/models/admin_order_model.py +8 -1
  18. rapidata/api_client/models/age_group.py +1 -1
  19. rapidata/api_client/models/age_user_filter_model.py +2 -2
  20. rapidata/api_client/models/campaign_artifact_model.py +98 -0
  21. rapidata/api_client/models/campaign_query_model.py +105 -0
  22. rapidata/api_client/models/campaign_query_model_paged_result.py +105 -0
  23. rapidata/api_client/models/campaign_status.py +39 -0
  24. rapidata/api_client/models/campaign_user_filter_model.py +2 -2
  25. rapidata/api_client/models/compare_workflow_config.py +2 -12
  26. rapidata/api_client/models/compare_workflow_config_model.py +138 -0
  27. rapidata/api_client/models/compare_workflow_get_result_overview_get200_response.py +137 -0
  28. rapidata/api_client/models/compare_workflow_model1.py +146 -0
  29. rapidata/api_client/models/completed_rapid_model.py +103 -0
  30. rapidata/api_client/models/conditional_validation_selection.py +106 -0
  31. rapidata/api_client/models/country_user_filter_model.py +2 -2
  32. rapidata/api_client/models/create_demographic_rapid_model.py +3 -3
  33. rapidata/api_client/models/create_independent_workflow_model.py +93 -0
  34. rapidata/api_client/models/create_independent_workflow_model_workflow_config.py +140 -0
  35. rapidata/api_client/models/create_independent_workflow_result.py +89 -0
  36. rapidata/api_client/models/create_order_model.py +40 -31
  37. rapidata/api_client/models/create_order_model_selections_inner.py +40 -12
  38. rapidata/api_client/models/create_order_model_user_filters_inner.py +35 -35
  39. rapidata/api_client/models/customer_order_model.py +8 -1
  40. rapidata/api_client/models/dataset_artifact_model.py +98 -0
  41. rapidata/api_client/models/demographic_rapid_selection_config.py +7 -5
  42. rapidata/api_client/models/demographic_selection.py +8 -6
  43. rapidata/api_client/models/feedback_model.py +1 -1
  44. rapidata/api_client/models/file_artifact_model.py +98 -0
  45. rapidata/api_client/models/gender.py +1 -1
  46. rapidata/api_client/models/gender_user_filter_model.py +2 -2
  47. rapidata/api_client/models/get_attach_category_workflow_result_overview_result.py +144 -0
  48. rapidata/api_client/models/get_compare_workflow_result_overview_result.py +125 -0
  49. rapidata/api_client/models/get_compare_workflow_result_overview_small_result.py +114 -0
  50. rapidata/api_client/models/get_pipeline_by_id_result.py +100 -0
  51. rapidata/api_client/models/get_pipeline_by_id_result_artifacts_value.py +182 -0
  52. rapidata/api_client/models/get_simple_workflow_result_overview_result.py +142 -0
  53. rapidata/api_client/models/get_workflow_by_id_result.py +91 -0
  54. rapidata/api_client/models/get_workflow_by_id_result_workflow.py +140 -0
  55. rapidata/api_client/models/get_workflow_progress_result.py +100 -0
  56. rapidata/api_client/models/get_workflow_result_overview_result.py +104 -0
  57. rapidata/api_client/models/i_workflow_model_paged_result.py +105 -0
  58. rapidata/api_client/models/in_progress_rapid_model.py +103 -0
  59. rapidata/api_client/models/labeling_selection.py +2 -2
  60. rapidata/api_client/models/language_user_filter_model.py +2 -2
  61. rapidata/api_client/models/not_started_rapid_model.py +93 -0
  62. rapidata/api_client/models/order_state.py +43 -0
  63. rapidata/api_client/models/query_campaigns_model.py +112 -0
  64. rapidata/api_client/models/query_workflows_model.py +112 -0
  65. rapidata/api_client/models/ranked_datapoint_model.py +95 -0
  66. rapidata/api_client/models/rapid_answer.py +97 -0
  67. rapidata/api_client/models/rapid_answer_result.py +252 -0
  68. rapidata/api_client/models/simple_workflow_config.py +2 -12
  69. rapidata/api_client/models/simple_workflow_config_model.py +132 -0
  70. rapidata/api_client/models/simple_workflow_config_model_blueprint.py +238 -0
  71. rapidata/api_client/models/simple_workflow_get_result_overview_get200_response.py +137 -0
  72. rapidata/api_client/models/simple_workflow_model1.py +140 -0
  73. rapidata/api_client/models/static_selection.py +96 -0
  74. rapidata/api_client/models/update_workflow_config_request.py +107 -0
  75. rapidata/api_client/models/update_workflow_config_request_config.py +140 -0
  76. rapidata/api_client/models/user_score_user_filter_model.py +3 -3
  77. rapidata/api_client/models/validation_selection.py +3 -3
  78. rapidata/api_client/models/workflow_artifact_model.py +98 -0
  79. rapidata/api_client/models/workflow_config_artifact_model.py +102 -0
  80. rapidata/api_client/models/workflow_config_artifact_model_workflow_config.py +140 -0
  81. rapidata/api_client/models/workflow_state.py +41 -0
  82. rapidata/api_client/rest.py +1 -1
  83. rapidata/api_client_README.md +75 -29
  84. rapidata/rapidata_client/__init__.py +6 -1
  85. rapidata/rapidata_client/order/rapidata_order_builder.py +2 -1
  86. rapidata/rapidata_client/selection/__init__.py +1 -0
  87. rapidata/rapidata_client/selection/conditional_validation_rapid_selection.py +41 -0
  88. rapidata/rapidata_client/selection/demographic_selection.py +3 -5
  89. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/METADATA +1 -1
  90. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/RECORD +92 -40
  91. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/LICENSE +0 -0
  92. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,132 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.compare_workflow_config_referee import CompareWorkflowConfigReferee
23
+ from rapidata.api_client.models.feature_flag import FeatureFlag
24
+ from rapidata.api_client.models.simple_workflow_config_model_blueprint import SimpleWorkflowConfigModelBlueprint
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class SimpleWorkflowConfigModel(BaseModel):
29
+ """
30
+ The configuration for a simple workflow. A simple workflow creates a rapid for each datapoint in its dataset. It is considered complete when all rapids have been completed.
31
+ """ # noqa: E501
32
+ t: StrictStr = Field(description="Discriminator value for SimpleWorkflowConfig", alias="_t")
33
+ referee: CompareWorkflowConfigReferee
34
+ blueprint: SimpleWorkflowConfigModelBlueprint
35
+ target_country_codes: List[StrictStr] = Field(description="A list of country codes that this workflow is targeting.", alias="targetCountryCodes")
36
+ feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
37
+ priority: Optional[StrictStr] = None
38
+ is_fallback: Optional[StrictBool] = Field(default=None, alias="isFallback")
39
+ __properties: ClassVar[List[str]] = ["_t", "referee", "blueprint", "targetCountryCodes", "featureFlags", "priority", "isFallback"]
40
+
41
+ @field_validator('t')
42
+ def t_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value not in set(['SimpleWorkflowConfig']):
45
+ raise ValueError("must be one of enum values ('SimpleWorkflowConfig')")
46
+ return value
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """Returns the JSON representation of the model using alias"""
61
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
62
+ return json.dumps(self.to_dict())
63
+
64
+ @classmethod
65
+ def from_json(cls, json_str: str) -> Optional[Self]:
66
+ """Create an instance of SimpleWorkflowConfigModel from a JSON string"""
67
+ return cls.from_dict(json.loads(json_str))
68
+
69
+ def to_dict(self) -> Dict[str, Any]:
70
+ """Return the dictionary representation of the model using alias.
71
+
72
+ This has the following differences from calling pydantic's
73
+ `self.model_dump(by_alias=True)`:
74
+
75
+ * `None` is only added to the output dict for nullable fields that
76
+ were set at model initialization. Other fields with value `None`
77
+ are ignored.
78
+ """
79
+ excluded_fields: Set[str] = set([
80
+ ])
81
+
82
+ _dict = self.model_dump(
83
+ by_alias=True,
84
+ exclude=excluded_fields,
85
+ exclude_none=True,
86
+ )
87
+ # override the default output from pydantic by calling `to_dict()` of referee
88
+ if self.referee:
89
+ _dict['referee'] = self.referee.to_dict()
90
+ # override the default output from pydantic by calling `to_dict()` of blueprint
91
+ if self.blueprint:
92
+ _dict['blueprint'] = self.blueprint.to_dict()
93
+ # override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
94
+ _items = []
95
+ if self.feature_flags:
96
+ for _item_feature_flags in self.feature_flags:
97
+ if _item_feature_flags:
98
+ _items.append(_item_feature_flags.to_dict())
99
+ _dict['featureFlags'] = _items
100
+ # set to None if priority (nullable) is None
101
+ # and model_fields_set contains the field
102
+ if self.priority is None and "priority" in self.model_fields_set:
103
+ _dict['priority'] = None
104
+
105
+ # set to None if is_fallback (nullable) is None
106
+ # and model_fields_set contains the field
107
+ if self.is_fallback is None and "is_fallback" in self.model_fields_set:
108
+ _dict['isFallback'] = None
109
+
110
+ return _dict
111
+
112
+ @classmethod
113
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
114
+ """Create an instance of SimpleWorkflowConfigModel from a dict"""
115
+ if obj is None:
116
+ return None
117
+
118
+ if not isinstance(obj, dict):
119
+ return cls.model_validate(obj)
120
+
121
+ _obj = cls.model_validate({
122
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'SimpleWorkflowConfig',
123
+ "referee": CompareWorkflowConfigReferee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
124
+ "blueprint": SimpleWorkflowConfigModelBlueprint.from_dict(obj["blueprint"]) if obj.get("blueprint") is not None else None,
125
+ "targetCountryCodes": obj.get("targetCountryCodes"),
126
+ "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
127
+ "priority": obj.get("priority"),
128
+ "isFallback": obj.get("isFallback")
129
+ })
130
+ return _obj
131
+
132
+
@@ -0,0 +1,238 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ import pprint
18
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
19
+ from typing import Any, List, Optional
20
+ from rapidata.api_client.models.attach_category_rapid_blueprint import AttachCategoryRapidBlueprint
21
+ from rapidata.api_client.models.bounding_box_rapid_blueprint import BoundingBoxRapidBlueprint
22
+ from rapidata.api_client.models.compare_rapid_blueprint import CompareRapidBlueprint
23
+ from rapidata.api_client.models.free_text_rapid_blueprint import FreeTextRapidBlueprint
24
+ from rapidata.api_client.models.line_rapid_blueprint import LineRapidBlueprint
25
+ from rapidata.api_client.models.locate_rapid_blueprint import LocateRapidBlueprint
26
+ from rapidata.api_client.models.named_entity_rapid_blueprint import NamedEntityRapidBlueprint
27
+ from rapidata.api_client.models.polygon_rapid_blueprint import PolygonRapidBlueprint
28
+ from rapidata.api_client.models.transcription_rapid_blueprint import TranscriptionRapidBlueprint
29
+ from pydantic import StrictStr, Field
30
+ from typing import Union, List, Set, Optional, Dict
31
+ from typing_extensions import Literal, Self
32
+
33
+ SIMPLEWORKFLOWCONFIGMODELBLUEPRINT_ONE_OF_SCHEMAS = ["AttachCategoryRapidBlueprint", "BoundingBoxRapidBlueprint", "CompareRapidBlueprint", "FreeTextRapidBlueprint", "LineRapidBlueprint", "LocateRapidBlueprint", "NamedEntityRapidBlueprint", "PolygonRapidBlueprint", "TranscriptionRapidBlueprint"]
34
+
35
+ class SimpleWorkflowConfigModelBlueprint(BaseModel):
36
+ """
37
+ The blueprint to use when creating rapids for this workflow. The blueprint determines what kind of rapids will be created and what data they will contain.
38
+ """
39
+ # data type: TranscriptionRapidBlueprint
40
+ oneof_schema_1_validator: Optional[TranscriptionRapidBlueprint] = None
41
+ # data type: PolygonRapidBlueprint
42
+ oneof_schema_2_validator: Optional[PolygonRapidBlueprint] = None
43
+ # data type: NamedEntityRapidBlueprint
44
+ oneof_schema_3_validator: Optional[NamedEntityRapidBlueprint] = None
45
+ # data type: LocateRapidBlueprint
46
+ oneof_schema_4_validator: Optional[LocateRapidBlueprint] = None
47
+ # data type: LineRapidBlueprint
48
+ oneof_schema_5_validator: Optional[LineRapidBlueprint] = None
49
+ # data type: FreeTextRapidBlueprint
50
+ oneof_schema_6_validator: Optional[FreeTextRapidBlueprint] = None
51
+ # data type: CompareRapidBlueprint
52
+ oneof_schema_7_validator: Optional[CompareRapidBlueprint] = None
53
+ # data type: AttachCategoryRapidBlueprint
54
+ oneof_schema_8_validator: Optional[AttachCategoryRapidBlueprint] = None
55
+ # data type: BoundingBoxRapidBlueprint
56
+ oneof_schema_9_validator: Optional[BoundingBoxRapidBlueprint] = None
57
+ actual_instance: Optional[Union[AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint]] = None
58
+ one_of_schemas: Set[str] = { "AttachCategoryRapidBlueprint", "BoundingBoxRapidBlueprint", "CompareRapidBlueprint", "FreeTextRapidBlueprint", "LineRapidBlueprint", "LocateRapidBlueprint", "NamedEntityRapidBlueprint", "PolygonRapidBlueprint", "TranscriptionRapidBlueprint" }
59
+
60
+ model_config = ConfigDict(
61
+ validate_assignment=True,
62
+ protected_namespaces=(),
63
+ )
64
+
65
+
66
+ discriminator_value_class_map: Dict[str, str] = {
67
+ }
68
+
69
+ def __init__(self, *args, **kwargs) -> None:
70
+ if args:
71
+ if len(args) > 1:
72
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
73
+ if kwargs:
74
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
75
+ super().__init__(actual_instance=args[0])
76
+ else:
77
+ super().__init__(**kwargs)
78
+
79
+ @field_validator('actual_instance')
80
+ def actual_instance_must_validate_oneof(cls, v):
81
+ instance = SimpleWorkflowConfigModelBlueprint.model_construct()
82
+ error_messages = []
83
+ match = 0
84
+ # validate data type: TranscriptionRapidBlueprint
85
+ if not isinstance(v, TranscriptionRapidBlueprint):
86
+ error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionRapidBlueprint`")
87
+ else:
88
+ match += 1
89
+ # validate data type: PolygonRapidBlueprint
90
+ if not isinstance(v, PolygonRapidBlueprint):
91
+ error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonRapidBlueprint`")
92
+ else:
93
+ match += 1
94
+ # validate data type: NamedEntityRapidBlueprint
95
+ if not isinstance(v, NamedEntityRapidBlueprint):
96
+ error_messages.append(f"Error! Input type `{type(v)}` is not `NamedEntityRapidBlueprint`")
97
+ else:
98
+ match += 1
99
+ # validate data type: LocateRapidBlueprint
100
+ if not isinstance(v, LocateRapidBlueprint):
101
+ error_messages.append(f"Error! Input type `{type(v)}` is not `LocateRapidBlueprint`")
102
+ else:
103
+ match += 1
104
+ # validate data type: LineRapidBlueprint
105
+ if not isinstance(v, LineRapidBlueprint):
106
+ error_messages.append(f"Error! Input type `{type(v)}` is not `LineRapidBlueprint`")
107
+ else:
108
+ match += 1
109
+ # validate data type: FreeTextRapidBlueprint
110
+ if not isinstance(v, FreeTextRapidBlueprint):
111
+ error_messages.append(f"Error! Input type `{type(v)}` is not `FreeTextRapidBlueprint`")
112
+ else:
113
+ match += 1
114
+ # validate data type: CompareRapidBlueprint
115
+ if not isinstance(v, CompareRapidBlueprint):
116
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CompareRapidBlueprint`")
117
+ else:
118
+ match += 1
119
+ # validate data type: AttachCategoryRapidBlueprint
120
+ if not isinstance(v, AttachCategoryRapidBlueprint):
121
+ error_messages.append(f"Error! Input type `{type(v)}` is not `AttachCategoryRapidBlueprint`")
122
+ else:
123
+ match += 1
124
+ # validate data type: BoundingBoxRapidBlueprint
125
+ if not isinstance(v, BoundingBoxRapidBlueprint):
126
+ error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxRapidBlueprint`")
127
+ else:
128
+ match += 1
129
+ if match > 1:
130
+ # more than 1 match
131
+ raise ValueError("Multiple matches found when setting `actual_instance` in SimpleWorkflowConfigModelBlueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
132
+ elif match == 0:
133
+ # no match
134
+ raise ValueError("No match found when setting `actual_instance` in SimpleWorkflowConfigModelBlueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
135
+ else:
136
+ return v
137
+
138
+ @classmethod
139
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
140
+ return cls.from_json(json.dumps(obj))
141
+
142
+ @classmethod
143
+ def from_json(cls, json_str: str) -> Self:
144
+ """Returns the object represented by the json string"""
145
+ instance = cls.model_construct()
146
+ error_messages = []
147
+ match = 0
148
+
149
+ # deserialize data into TranscriptionRapidBlueprint
150
+ try:
151
+ instance.actual_instance = TranscriptionRapidBlueprint.from_json(json_str)
152
+ match += 1
153
+ except (ValidationError, ValueError) as e:
154
+ error_messages.append(str(e))
155
+ # deserialize data into PolygonRapidBlueprint
156
+ try:
157
+ instance.actual_instance = PolygonRapidBlueprint.from_json(json_str)
158
+ match += 1
159
+ except (ValidationError, ValueError) as e:
160
+ error_messages.append(str(e))
161
+ # deserialize data into NamedEntityRapidBlueprint
162
+ try:
163
+ instance.actual_instance = NamedEntityRapidBlueprint.from_json(json_str)
164
+ match += 1
165
+ except (ValidationError, ValueError) as e:
166
+ error_messages.append(str(e))
167
+ # deserialize data into LocateRapidBlueprint
168
+ try:
169
+ instance.actual_instance = LocateRapidBlueprint.from_json(json_str)
170
+ match += 1
171
+ except (ValidationError, ValueError) as e:
172
+ error_messages.append(str(e))
173
+ # deserialize data into LineRapidBlueprint
174
+ try:
175
+ instance.actual_instance = LineRapidBlueprint.from_json(json_str)
176
+ match += 1
177
+ except (ValidationError, ValueError) as e:
178
+ error_messages.append(str(e))
179
+ # deserialize data into FreeTextRapidBlueprint
180
+ try:
181
+ instance.actual_instance = FreeTextRapidBlueprint.from_json(json_str)
182
+ match += 1
183
+ except (ValidationError, ValueError) as e:
184
+ error_messages.append(str(e))
185
+ # deserialize data into CompareRapidBlueprint
186
+ try:
187
+ instance.actual_instance = CompareRapidBlueprint.from_json(json_str)
188
+ match += 1
189
+ except (ValidationError, ValueError) as e:
190
+ error_messages.append(str(e))
191
+ # deserialize data into AttachCategoryRapidBlueprint
192
+ try:
193
+ instance.actual_instance = AttachCategoryRapidBlueprint.from_json(json_str)
194
+ match += 1
195
+ except (ValidationError, ValueError) as e:
196
+ error_messages.append(str(e))
197
+ # deserialize data into BoundingBoxRapidBlueprint
198
+ try:
199
+ instance.actual_instance = BoundingBoxRapidBlueprint.from_json(json_str)
200
+ match += 1
201
+ except (ValidationError, ValueError) as e:
202
+ error_messages.append(str(e))
203
+
204
+ if match > 1:
205
+ # more than 1 match
206
+ raise ValueError("Multiple matches found when deserializing the JSON string into SimpleWorkflowConfigModelBlueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
207
+ elif match == 0:
208
+ # no match
209
+ raise ValueError("No match found when deserializing the JSON string into SimpleWorkflowConfigModelBlueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
210
+ else:
211
+ return instance
212
+
213
+ def to_json(self) -> str:
214
+ """Returns the JSON representation of the actual instance"""
215
+ if self.actual_instance is None:
216
+ return "null"
217
+
218
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
219
+ return self.actual_instance.to_json()
220
+ else:
221
+ return json.dumps(self.actual_instance)
222
+
223
+ def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint]]:
224
+ """Returns the dict representation of the actual instance"""
225
+ if self.actual_instance is None:
226
+ return None
227
+
228
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
229
+ return self.actual_instance.to_dict()
230
+ else:
231
+ # primitive type
232
+ return self.actual_instance
233
+
234
+ def to_str(self) -> str:
235
+ """Returns the string representation of the actual instance"""
236
+ return pprint.pformat(self.model_dump())
237
+
238
+
@@ -0,0 +1,137 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ import pprint
18
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
19
+ from typing import Any, List, Optional
20
+ from rapidata.api_client.models.get_attach_category_workflow_result_overview_result import GetAttachCategoryWorkflowResultOverviewResult
21
+ from rapidata.api_client.models.get_simple_workflow_result_overview_result import GetSimpleWorkflowResultOverviewResult
22
+ from pydantic import StrictStr, Field
23
+ from typing import Union, List, Set, Optional, Dict
24
+ from typing_extensions import Literal, Self
25
+
26
+ SIMPLEWORKFLOWGETRESULTOVERVIEWGET200RESPONSE_ONE_OF_SCHEMAS = ["GetAttachCategoryWorkflowResultOverviewResult", "GetSimpleWorkflowResultOverviewResult"]
27
+
28
+ class SimpleWorkflowGetResultOverviewGet200Response(BaseModel):
29
+ """
30
+ SimpleWorkflowGetResultOverviewGet200Response
31
+ """
32
+ # data type: GetAttachCategoryWorkflowResultOverviewResult
33
+ oneof_schema_1_validator: Optional[GetAttachCategoryWorkflowResultOverviewResult] = None
34
+ # data type: GetSimpleWorkflowResultOverviewResult
35
+ oneof_schema_2_validator: Optional[GetSimpleWorkflowResultOverviewResult] = None
36
+ actual_instance: Optional[Union[GetAttachCategoryWorkflowResultOverviewResult, GetSimpleWorkflowResultOverviewResult]] = None
37
+ one_of_schemas: Set[str] = { "GetAttachCategoryWorkflowResultOverviewResult", "GetSimpleWorkflowResultOverviewResult" }
38
+
39
+ model_config = ConfigDict(
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def __init__(self, *args, **kwargs) -> None:
46
+ if args:
47
+ if len(args) > 1:
48
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
49
+ if kwargs:
50
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
51
+ super().__init__(actual_instance=args[0])
52
+ else:
53
+ super().__init__(**kwargs)
54
+
55
+ @field_validator('actual_instance')
56
+ def actual_instance_must_validate_oneof(cls, v):
57
+ instance = SimpleWorkflowGetResultOverviewGet200Response.model_construct()
58
+ error_messages = []
59
+ match = 0
60
+ # validate data type: GetAttachCategoryWorkflowResultOverviewResult
61
+ if not isinstance(v, GetAttachCategoryWorkflowResultOverviewResult):
62
+ error_messages.append(f"Error! Input type `{type(v)}` is not `GetAttachCategoryWorkflowResultOverviewResult`")
63
+ else:
64
+ match += 1
65
+ # validate data type: GetSimpleWorkflowResultOverviewResult
66
+ if not isinstance(v, GetSimpleWorkflowResultOverviewResult):
67
+ error_messages.append(f"Error! Input type `{type(v)}` is not `GetSimpleWorkflowResultOverviewResult`")
68
+ else:
69
+ match += 1
70
+ if match > 1:
71
+ # more than 1 match
72
+ raise ValueError("Multiple matches found when setting `actual_instance` in SimpleWorkflowGetResultOverviewGet200Response with oneOf schemas: GetAttachCategoryWorkflowResultOverviewResult, GetSimpleWorkflowResultOverviewResult. Details: " + ", ".join(error_messages))
73
+ elif match == 0:
74
+ # no match
75
+ raise ValueError("No match found when setting `actual_instance` in SimpleWorkflowGetResultOverviewGet200Response with oneOf schemas: GetAttachCategoryWorkflowResultOverviewResult, GetSimpleWorkflowResultOverviewResult. Details: " + ", ".join(error_messages))
76
+ else:
77
+ return v
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
81
+ return cls.from_json(json.dumps(obj))
82
+
83
+ @classmethod
84
+ def from_json(cls, json_str: str) -> Self:
85
+ """Returns the object represented by the json string"""
86
+ instance = cls.model_construct()
87
+ error_messages = []
88
+ match = 0
89
+
90
+ # deserialize data into GetAttachCategoryWorkflowResultOverviewResult
91
+ try:
92
+ instance.actual_instance = GetAttachCategoryWorkflowResultOverviewResult.from_json(json_str)
93
+ match += 1
94
+ except (ValidationError, ValueError) as e:
95
+ error_messages.append(str(e))
96
+ # deserialize data into GetSimpleWorkflowResultOverviewResult
97
+ try:
98
+ instance.actual_instance = GetSimpleWorkflowResultOverviewResult.from_json(json_str)
99
+ match += 1
100
+ except (ValidationError, ValueError) as e:
101
+ error_messages.append(str(e))
102
+
103
+ if match > 1:
104
+ # more than 1 match
105
+ raise ValueError("Multiple matches found when deserializing the JSON string into SimpleWorkflowGetResultOverviewGet200Response with oneOf schemas: GetAttachCategoryWorkflowResultOverviewResult, GetSimpleWorkflowResultOverviewResult. Details: " + ", ".join(error_messages))
106
+ elif match == 0:
107
+ # no match
108
+ raise ValueError("No match found when deserializing the JSON string into SimpleWorkflowGetResultOverviewGet200Response with oneOf schemas: GetAttachCategoryWorkflowResultOverviewResult, GetSimpleWorkflowResultOverviewResult. Details: " + ", ".join(error_messages))
109
+ else:
110
+ return instance
111
+
112
+ def to_json(self) -> str:
113
+ """Returns the JSON representation of the actual instance"""
114
+ if self.actual_instance is None:
115
+ return "null"
116
+
117
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
118
+ return self.actual_instance.to_json()
119
+ else:
120
+ return json.dumps(self.actual_instance)
121
+
122
+ def to_dict(self) -> Optional[Union[Dict[str, Any], GetAttachCategoryWorkflowResultOverviewResult, GetSimpleWorkflowResultOverviewResult]]:
123
+ """Returns the dict representation of the actual instance"""
124
+ if self.actual_instance is None:
125
+ return None
126
+
127
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
128
+ return self.actual_instance.to_dict()
129
+ else:
130
+ # primitive type
131
+ return self.actual_instance
132
+
133
+ def to_str(self) -> str:
134
+ """Returns the string representation of the actual instance"""
135
+ return pprint.pformat(self.model_dump())
136
+
137
+
@@ -0,0 +1,140 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.compare_workflow_config_referee import CompareWorkflowConfigReferee
23
+ from rapidata.api_client.models.feature_flag import FeatureFlag
24
+ from rapidata.api_client.models.simple_workflow_config_blueprint import SimpleWorkflowConfigBlueprint
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class SimpleWorkflowModel1(BaseModel):
29
+ """
30
+ SimpleWorkflowModel1
31
+ """ # noqa: E501
32
+ t: StrictStr = Field(description="Discriminator value for SimpleWorkflowModel", alias="_t")
33
+ id: StrictStr
34
+ dataset_id: Optional[StrictStr] = Field(alias="datasetId")
35
+ target_country_codes: List[StrictStr] = Field(alias="targetCountryCodes")
36
+ feature_flags: List[FeatureFlag] = Field(alias="featureFlags")
37
+ state: StrictStr
38
+ priority: StrictStr
39
+ blueprint: SimpleWorkflowConfigBlueprint
40
+ referee: CompareWorkflowConfigReferee
41
+ name: StrictStr
42
+ owner_mail: Optional[StrictStr] = Field(alias="ownerMail")
43
+ __properties: ClassVar[List[str]] = ["_t", "id", "datasetId", "targetCountryCodes", "featureFlags", "state", "priority", "blueprint", "referee", "name", "ownerMail"]
44
+
45
+ @field_validator('t')
46
+ def t_validate_enum(cls, value):
47
+ """Validates the enum"""
48
+ if value not in set(['SimpleWorkflowModel']):
49
+ raise ValueError("must be one of enum values ('SimpleWorkflowModel')")
50
+ return value
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of SimpleWorkflowModel1 from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ """
83
+ excluded_fields: Set[str] = set([
84
+ ])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
92
+ _items = []
93
+ if self.feature_flags:
94
+ for _item_feature_flags in self.feature_flags:
95
+ if _item_feature_flags:
96
+ _items.append(_item_feature_flags.to_dict())
97
+ _dict['featureFlags'] = _items
98
+ # override the default output from pydantic by calling `to_dict()` of blueprint
99
+ if self.blueprint:
100
+ _dict['blueprint'] = self.blueprint.to_dict()
101
+ # override the default output from pydantic by calling `to_dict()` of referee
102
+ if self.referee:
103
+ _dict['referee'] = self.referee.to_dict()
104
+ # set to None if dataset_id (nullable) is None
105
+ # and model_fields_set contains the field
106
+ if self.dataset_id is None and "dataset_id" in self.model_fields_set:
107
+ _dict['datasetId'] = None
108
+
109
+ # set to None if owner_mail (nullable) is None
110
+ # and model_fields_set contains the field
111
+ if self.owner_mail is None and "owner_mail" in self.model_fields_set:
112
+ _dict['ownerMail'] = None
113
+
114
+ return _dict
115
+
116
+ @classmethod
117
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
118
+ """Create an instance of SimpleWorkflowModel1 from a dict"""
119
+ if obj is None:
120
+ return None
121
+
122
+ if not isinstance(obj, dict):
123
+ return cls.model_validate(obj)
124
+
125
+ _obj = cls.model_validate({
126
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'SimpleWorkflowModel',
127
+ "id": obj.get("id"),
128
+ "datasetId": obj.get("datasetId"),
129
+ "targetCountryCodes": obj.get("targetCountryCodes"),
130
+ "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
131
+ "state": obj.get("state"),
132
+ "priority": obj.get("priority"),
133
+ "blueprint": SimpleWorkflowConfigBlueprint.from_dict(obj["blueprint"]) if obj.get("blueprint") is not None else None,
134
+ "referee": CompareWorkflowConfigReferee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
135
+ "name": obj.get("name"),
136
+ "ownerMail": obj.get("ownerMail")
137
+ })
138
+ return _obj
139
+
140
+