wizata-dsapi 1.2.2__py3-none-any.whl → 1.2.3__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.
wizata_dsapi/request.py CHANGED
@@ -13,6 +13,25 @@ filter_map = {
13
13
  }
14
14
 
15
15
 
16
+ def _format_group(my_group:dict) -> dict:
17
+ """
18
+ verify and format a group
19
+ :param my_group: group to check and format
20
+ :return: formatted group
21
+ """
22
+ if my_group is None or not isinstance(my_group, dict):
23
+ raise ValueError(f"illegal group {my_group}")
24
+ if "group_by" not in my_group:
25
+ my_group["group_by"] = "id"
26
+ elif my_group["group_by"] not in ["id" , "type"]:
27
+ raise ValueError(f"illegal group {my_group['group_by']}")
28
+ if "event_ids" in my_group:
29
+ my_group["events"] = my_group["event_ids"]
30
+ if "system_id" not in my_group or my_group["system_id"] is None or not isinstance(["system_id"], str):
31
+ raise ValueError(f"please specify system_id in {my_group}")
32
+ return my_group
33
+
34
+
16
35
  class Request(ApiDto):
17
36
  """
18
37
  request defines how to fetch data from time-series database.
@@ -117,6 +136,23 @@ class Request(ApiDto):
117
136
  else:
118
137
  raise TypeError(f'field must be None, str or a list of str')
119
138
 
139
+ @property
140
+ def groups(self) -> list:
141
+ """
142
+ return formatted groups list based on group
143
+ :return:
144
+ """
145
+ if self.group is not None and self.group != {}:
146
+ if not isinstance(self.group, list):
147
+ return [_format_group(self.group)]
148
+ else:
149
+ groups = []
150
+ for group in self.group:
151
+ groups.append(_format_group(group))
152
+ return groups
153
+ else:
154
+ return []
155
+
120
156
  def get_template_id(self):
121
157
  """
122
158
  extract template id from request if present.
wizata_dsapi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.2.2"
1
+ __version__ = "1.2.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wizata-dsapi
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -23,7 +23,7 @@ wizata_dsapi/pipeline.py,sha256=WDJeOxPZJiYW1qwTNZUm3jom2epIxqrSoiUwcrTF9EE,3130
23
23
  wizata_dsapi/pipeline_deployment.py,sha256=grekBaxUK0EhL9w7lDB8vNuW_wzLnHVm9Mq8Lkbkguk,1722
24
24
  wizata_dsapi/pipeline_image.py,sha256=M3FOr45dJIAEvsmXPpMD8JZ09k5-YpW9PRYEWJqptcI,5272
25
25
  wizata_dsapi/plot.py,sha256=SPGKFWWYNcRvHcqvvnPIIIBKsd5UwhdsxLW7b2dG2rs,2360
26
- wizata_dsapi/request.py,sha256=Uqn03M6mUct6FQ4kj5A0SwX8g0vA8rM2W3EyWUvadqA,23159
26
+ wizata_dsapi/request.py,sha256=5HdhWwPZYTUW-ESIMSFHS51eM2KUVD5WlNDgFK408Us,24410
27
27
  wizata_dsapi/script.py,sha256=DeEciwVpuCYZetgJCoivw_bYe8ma52WuTaTQ_VkLEcg,12930
28
28
  wizata_dsapi/solution_component.py,sha256=8gbZWx2h_xUqI_pAXa3goqAnR5Y-GDMii8MeGlaK1IE,9531
29
29
  wizata_dsapi/streamlit_utils.py,sha256=sXBdygktbixV828Zg01Nl27_a4F8zGFc4RY0C8g-1bc,1942
@@ -31,7 +31,7 @@ wizata_dsapi/template.py,sha256=h2f3dLduJ4WhreVxJXuFIB3pinnI3c39WxBms0bCgos,1300
31
31
  wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
32
32
  wizata_dsapi/twin.py,sha256=OFDFg2CsTxOUOVOf6kkDUEK9A3ED7yuPpN9TqodGruo,6581
33
33
  wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
34
- wizata_dsapi/version.py,sha256=uuf4VNtTNA93fMhoAur9YafzaKJFnczY-H1SSCSuRVQ,22
34
+ wizata_dsapi/version.py,sha256=C-D_WWrVkBDmQmApLcm0sWNh2CgIrwWfc8_sB5vvU-Q,22
35
35
  wizata_dsapi/wizard_function.py,sha256=RbM7W7Gf-6Rhp_1dU9DBYkHaciknGAGvuAndhAS_vyo,942
36
36
  wizata_dsapi/wizard_request.py,sha256=v6BaqKLKvTWmUSo0_gda9FabAQz5x_-GOH1Av50GzFo,3762
37
37
  wizata_dsapi/wizata_dsapi_client.py,sha256=Qz54vYoxRLBUa21Q55K5Oo1qtZpW9ucuXi4BX1N85oE,78716
@@ -42,8 +42,8 @@ wizata_dsapi/plots/__init__.py,sha256=qgnSFqrjOPur-807M8uh5awIfjM1ZHXUXcAqHc-r2l
42
42
  wizata_dsapi/plots/common.py,sha256=jdPsJqLHBwSKc6dX83BSGPqSRxzIVNHSYO5yI_8sjGk,6568
43
43
  wizata_dsapi/scripts/__init__.py,sha256=hAxiETSQf0qOHde1si1tEAJU48seqEgHrchCzS2-LvQ,80
44
44
  wizata_dsapi/scripts/common.py,sha256=efwq-Rd0lvYljIs3gSFz9izogBD7asOU2cTK-IvHTkM,4244
45
- wizata_dsapi-1.2.2.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
- wizata_dsapi-1.2.2.dist-info/METADATA,sha256=_WJlwzUyvWJZ_3MRO9gfS6qMPD2ctlM7c63Vv1RKTQY,2187
47
- wizata_dsapi-1.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
48
- wizata_dsapi-1.2.2.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
- wizata_dsapi-1.2.2.dist-info/RECORD,,
45
+ wizata_dsapi-1.2.3.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
+ wizata_dsapi-1.2.3.dist-info/METADATA,sha256=73xzIlPuyDmK2nbERE6W6i-FmjFY5K1sh9_rB7mpX5A,2187
47
+ wizata_dsapi-1.2.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
48
+ wizata_dsapi-1.2.3.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
+ wizata_dsapi-1.2.3.dist-info/RECORD,,