wizata-dsapi 1.4.0.dev20__py3-none-any.whl → 1.4.0.dev22__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.
@@ -7,6 +7,7 @@ class PagedQueryResult:
7
7
  :ivar int size: number of records per page.
8
8
  :ivar str sort: column name used in sorting.
9
9
  :ivar int total: total number of results on all pages.
10
+ :ivar dict groups: statistics used for the execution logs charts.
10
11
  """
11
12
 
12
13
  def __init__(self,
@@ -14,7 +15,8 @@ class PagedQueryResult:
14
15
  page: int = None,
15
16
  size: int = None,
16
17
  sort: str = None,
17
- direction: str = None):
18
+ direction: str = None,
19
+ groups: dict = None):
18
20
  self.total = total
19
21
  self.page = page
20
22
  if page < 0:
@@ -29,6 +31,7 @@ class PagedQueryResult:
29
31
  if direction != 'asc' and direction != 'desc':
30
32
  raise ValueError("direction must be asc or desc")
31
33
  self.results = None
34
+ self.groups = groups if groups else {}
32
35
 
33
36
  def to_json(self):
34
37
  """
@@ -55,5 +58,6 @@ class PagedQueryResult:
55
58
  "sort": self.sort,
56
59
  "direction": sort_dir,
57
60
  "total": self.total,
58
- "results": formatted_results
61
+ "results": formatted_results,
62
+ "groups": self.groups
59
63
  }
wizata_dsapi/search.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass, field
2
- from typing import Dict, List, Any, Optional
2
+ from typing import Dict, List, Any, Optional, Union
3
3
 
4
4
 
5
5
  class FilterOperator:
@@ -17,6 +17,26 @@ class FilterOperator:
17
17
  SEARCH = "_search"
18
18
 
19
19
 
20
+ class GroupSummaryType:
21
+ """
22
+ Aggregate methods for group summary types.
23
+ """
24
+ SUM = "Sum"
25
+ AVG = "Avg"
26
+ MAX = "Max"
27
+ MIN = "Min"
28
+ COUNT = "Count"
29
+
30
+ class GroupOption:
31
+ def __init__(self, property_name: str):
32
+ self.property_name = property_name
33
+
34
+ class GroupSummary:
35
+ def __init__(self, type: str, property_name: str):
36
+ self.type = type
37
+ self.property_name = property_name
38
+
39
+
20
40
  class SortOption:
21
41
  def __init__(self, field: str, order: str = "asc"):
22
42
  self.field = field
@@ -32,33 +52,63 @@ class SearchQuery:
32
52
  """
33
53
  Helper to convert dictionary coming from endpoint to SearchQuery object.
34
54
  """
35
- raw_sort = data.get("sort", [])
36
- sort_objs = []
37
- for s in raw_sort:
38
- sort_objs.append(SortOption(field=s["field"], order=s.get("order", "asc")))
39
55
 
40
56
  svc_name = data.get("serviceName") or data.get("service_name") or "pipeline_runner"
57
+
41
58
  return cls(
42
- filters=data.get("filters", {}),
43
- sort=sort_objs,
59
+ filters=data.get("filters"),
60
+ sort=data.get("sort"),
44
61
  limit=data.get("limit", 5000),
45
62
  page=data.get("page", 1),
46
63
  size=data.get("size", 50),
47
- service_name=svc_name
64
+ service_name=svc_name,
65
+ groups=data.get("groups"),
66
+ group_summaries=data.get("groupSummaries")
48
67
  )
49
68
 
69
+
50
70
  def __init__(self,
51
71
  filters: Optional[Dict[str, Any]] = None,
52
72
  sort: Optional[List[SortOption]] = None,
53
73
  limit: int = 5000,
54
74
  page: int = 1,
55
75
  size: int = 50,
56
- service_name: str = "pipeline_runner"):
76
+ service_name: str = "pipeline_runner",
77
+ groups: Optional[List[Union[GroupOption, dict]]] = None,
78
+ group_summaries: Optional[List[Union[GroupSummary, dict]]] = None):
57
79
 
58
80
  self.filters = filters if filters is not None else {}
59
- self.sort = sort if sort is not None else []
60
81
  self.limit = limit
61
82
  self.page = page
62
83
  self.size = size
63
84
  self.service_name = service_name
64
85
 
86
+ self.sort: List[SortOption] = []
87
+ if sort:
88
+ for s in sort:
89
+ if isinstance(s, SortOption):
90
+ self.sort.append(s)
91
+ elif isinstance(s, dict):
92
+ self.sort.append(SortOption(field=s.get("field"), order=s.get("order", "asc")))
93
+
94
+
95
+ # New grouping feature
96
+ self.groups: List[GroupOption] = []
97
+ if groups:
98
+ for g in groups:
99
+ if isinstance(g, GroupOption):
100
+ self.groups.append(g)
101
+ elif isinstance(g, dict) and g.get("propertyName"):
102
+ self.groups.append(GroupOption(property_name=g.get("propertyName")))
103
+
104
+
105
+ # GroupSummaries
106
+ self.group_summaries: List[GroupSummary] = []
107
+ if group_summaries:
108
+ for gs in group_summaries:
109
+ if isinstance(gs, GroupSummary):
110
+ self.group_summaries.append(gs)
111
+ elif isinstance(gs, dict) and gs.get("propertyName"):
112
+ sum_type = gs.get("type", "Count")
113
+ self.group_summaries.append(GroupSummary(type=sum_type, property_name=gs.get("propertyName")))
114
+
wizata_dsapi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.4.0.dev20"
1
+ __version__ = "1.4.0.dev22"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 1.4.0.dev20
3
+ Version: 1.4.0.dev22
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -19,20 +19,20 @@ wizata_dsapi/ilogger.py,sha256=YKBTRp7pHYtBlnzroGRPT91_bMVJT93Pft3fUGcFSIM,488
19
19
  wizata_dsapi/insight.py,sha256=ABFZ04DqYxxzqAEfU1tzlTZqqrigM-zN-8Lbetko3g0,6468
20
20
  wizata_dsapi/mlmodel.py,sha256=QkWBNordOQiw6Vv4xN_pxwJWqbBm29vY1dyDZgmMS_4,26324
21
21
  wizata_dsapi/model_toolkit.py,sha256=UNyw5CFSgZeXydQFsiDIRTjoMeqIsdyIIuiwumLW5bA,1574
22
- wizata_dsapi/paged_query_result.py,sha256=QU0JukkBk7wwfE43wOcj4so2aYpGj5r5_XobLfm8CnE,1939
22
+ wizata_dsapi/paged_query_result.py,sha256=WMtxMulIEiWMZxNwdgJcKfmm3mBOGKKO6zMeE1mhcQ0,2129
23
23
  wizata_dsapi/pipeline.py,sha256=gqZ6R8d8f_uz9xI3Umz2uN3yTD4N3jsBPltAIg--Bjk,31646
24
24
  wizata_dsapi/pipeline_image.py,sha256=4DhDo1SYftN6QcNbehNbM86VTD6EYGmtlcOmE5DP5Vc,6330
25
25
  wizata_dsapi/plot.py,sha256=-gV6rZJQDhGH4CV9BgefjeJWI--X5HDBOjseEzHr3Gc,1971
26
26
  wizata_dsapi/request.py,sha256=W4E1BHacQdJiBLPI96yVeHz41rbfFuGrbuw1U60L_DM,27560
27
27
  wizata_dsapi/script.py,sha256=DeEciwVpuCYZetgJCoivw_bYe8ma52WuTaTQ_VkLEcg,12930
28
- wizata_dsapi/search.py,sha256=LcWzjauHj4EzIl7aEXAsZGpX2IYl6e4Vw2jGWtdrfHI,1767
28
+ wizata_dsapi/search.py,sha256=nGbs3FUgpByY_iehslT_quRinYBViKVX8jI-mDeq6s0,3399
29
29
  wizata_dsapi/solution_component.py,sha256=8gbZWx2h_xUqI_pAXa3goqAnR5Y-GDMii8MeGlaK1IE,9531
30
30
  wizata_dsapi/streamlit_utils.py,sha256=sXBdygktbixV828Zg01Nl27_a4F8zGFc4RY0C8g-1bc,1942
31
31
  wizata_dsapi/template.py,sha256=wtCRKKk3PchH4RrNgNYlEF_9C6bzZwKIeLyEvgv6Fdo,13704
32
32
  wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
33
33
  wizata_dsapi/twin.py,sha256=S0DUzQf1smZXZTdXpXZPtkZYCfKIhw53EecCnsl9i4Q,11017
34
34
  wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
35
- wizata_dsapi/version.py,sha256=rdWb7-sRh1ikR1MPSNXnFtr5Wgd4se16okHI7g_hfYA,28
35
+ wizata_dsapi/version.py,sha256=5fqi6-MnuV0hvCz7ExBM59mdK0C1-HCzZPaNbyJblIk,28
36
36
  wizata_dsapi/wizard_function.py,sha256=RbM7W7Gf-6Rhp_1dU9DBYkHaciknGAGvuAndhAS_vyo,942
37
37
  wizata_dsapi/wizard_request.py,sha256=v6BaqKLKvTWmUSo0_gda9FabAQz5x_-GOH1Av50GzFo,3762
38
38
  wizata_dsapi/wizata_dsapi_client.py,sha256=pClIADBb_CfgT4P4Hz9mopgsuC0Wa_XiZBuej7x5JUM,85056
@@ -43,8 +43,8 @@ wizata_dsapi/plots/__init__.py,sha256=qgnSFqrjOPur-807M8uh5awIfjM1ZHXUXcAqHc-r2l
43
43
  wizata_dsapi/plots/common.py,sha256=jdPsJqLHBwSKc6dX83BSGPqSRxzIVNHSYO5yI_8sjGk,6568
44
44
  wizata_dsapi/scripts/__init__.py,sha256=hAxiETSQf0qOHde1si1tEAJU48seqEgHrchCzS2-LvQ,80
45
45
  wizata_dsapi/scripts/common.py,sha256=efwq-Rd0lvYljIs3gSFz9izogBD7asOU2cTK-IvHTkM,4244
46
- wizata_dsapi-1.4.0.dev20.dist-info/licenses/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
47
- wizata_dsapi-1.4.0.dev20.dist-info/METADATA,sha256=XAsaess3KexlRaXwYVSKXsXETqz4ndGgkTGyPZp2ISc,4960
48
- wizata_dsapi-1.4.0.dev20.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
49
- wizata_dsapi-1.4.0.dev20.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
50
- wizata_dsapi-1.4.0.dev20.dist-info/RECORD,,
46
+ wizata_dsapi-1.4.0.dev22.dist-info/licenses/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
47
+ wizata_dsapi-1.4.0.dev22.dist-info/METADATA,sha256=CWxqvKA_uLH4mObJLivZcFb4WHz0Dh2yJFVBfVDmN5k,4960
48
+ wizata_dsapi-1.4.0.dev22.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
49
+ wizata_dsapi-1.4.0.dev22.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
50
+ wizata_dsapi-1.4.0.dev22.dist-info/RECORD,,