wizata-dsapi 1.4.0.dev10__tar.gz → 1.4.0.dev15__tar.gz

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.
Files changed (56) hide show
  1. {wizata_dsapi-1.4.0.dev10/wizata_dsapi.egg-info → wizata_dsapi-1.4.0.dev15}/PKG-INFO +1 -1
  2. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/__init__.py +2 -0
  3. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/execution_log.py +20 -4
  4. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/paged_query_result.py +28 -0
  5. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/plot.py +2 -11
  6. wizata_dsapi-1.4.0.dev15/wizata_dsapi/search.py +61 -0
  7. wizata_dsapi-1.4.0.dev15/wizata_dsapi/version.py +1 -0
  8. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/wizata_dsapi_client.py +1 -1
  9. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15/wizata_dsapi.egg-info}/PKG-INFO +1 -1
  10. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi.egg-info/SOURCES.txt +1 -0
  11. wizata_dsapi-1.4.0.dev10/wizata_dsapi/version.py +0 -1
  12. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/LICENSE.txt +0 -0
  13. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/README.rst +0 -0
  14. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/setup.cfg +0 -0
  15. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/setup.py +0 -0
  16. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/api_config.py +0 -0
  17. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/api_dto.py +0 -0
  18. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/api_interface.py +0 -0
  19. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/bucket.py +0 -0
  20. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/business_label.py +0 -0
  21. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/context.py +0 -0
  22. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/dataframe_toolkit.py +0 -0
  23. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/datapoint.py +0 -0
  24. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/datastore.py +0 -0
  25. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/ds_dataframe.py +0 -0
  26. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/dsapi_json_encoder.py +0 -0
  27. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/evaluation.py +0 -0
  28. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/execution.py +0 -0
  29. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/experiment.py +0 -0
  30. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/group_system.py +0 -0
  31. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/ilogger.py +0 -0
  32. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/insight.py +0 -0
  33. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/mlmodel.py +0 -0
  34. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/model_toolkit.py +0 -0
  35. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/models/__init__.py +0 -0
  36. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/models/common.py +0 -0
  37. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/pipeline.py +0 -0
  38. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/pipeline_image.py +0 -0
  39. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/plots/__init__.py +0 -0
  40. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/plots/common.py +0 -0
  41. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/request.py +0 -0
  42. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/script.py +0 -0
  43. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/scripts/__init__.py +0 -0
  44. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/scripts/common.py +0 -0
  45. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/solution_component.py +0 -0
  46. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/streamlit_utils.py +0 -0
  47. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/template.py +0 -0
  48. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/trigger.py +0 -0
  49. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/twin.py +0 -0
  50. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/twinregistration.py +0 -0
  51. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/wizard_function.py +0 -0
  52. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/wizard_request.py +0 -0
  53. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi/words.py +0 -0
  54. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
  55. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi.egg-info/requires.txt +0 -0
  56. {wizata_dsapi-1.4.0.dev10 → wizata_dsapi-1.4.0.dev15}/wizata_dsapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 1.4.0.dev10
3
+ Version: 1.4.0.dev15
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -48,3 +48,5 @@ from .evaluation import Evaluation
48
48
  # Streamlit utils
49
49
  from .streamlit_utils import (get_streamlit_token, get_streamlit_domain, get_streamlit_from, get_streamlit_to,
50
50
  get_streamlit_twin_id)
51
+
52
+ from .search import FilterOperator, SearchQuery, SortOption
@@ -1,4 +1,5 @@
1
1
  from .api_dto import Dto
2
+ from .plot import Plot
2
3
  from .experiment import Experiment
3
4
  from .pipeline import Pipeline
4
5
  from .twin import Twin
@@ -49,6 +50,12 @@ class ExecutionLog(Dto):
49
50
  if isinstance(properties, str):
50
51
  properties = json.loads(properties)
51
52
 
53
+ plots = data.get("plots")
54
+ _plots = []
55
+ if isinstance(plots, list):
56
+ for plot in plots:
57
+ _plots.append(Plot.from_dict(plot))
58
+
52
59
  return cls(
53
60
  execution_id=uuid.UUID(data["id"]) if "id" in data and not isinstance(data["id"], int) else None,
54
61
  experiment=data.get("experiment"),
@@ -64,7 +71,8 @@ class ExecutionLog(Dto):
64
71
  execution_time=int(data.get("executionTime")) if "executionTime" in data and data["executionTime"] is not None else None,
65
72
  trigger_id=uuid.UUID(data["executionTriggerId"]) if "executionTriggerId" in data and data["executionTriggerId"] is not None else None,
66
73
  version=data.get("version"),
67
- properties=properties
74
+ properties=properties,
75
+ plots=_plots
68
76
  )
69
77
 
70
78
  def __init__(self,
@@ -83,7 +91,8 @@ class ExecutionLog(Dto):
83
91
  execution_time: int = None,
84
92
  trigger_id: uuid.UUID = None,
85
93
  version: str = None,
86
- properties: dict = None):
94
+ properties: dict = None,
95
+ plots: list = None):
87
96
 
88
97
  # labels
89
98
  self._experiment = None
@@ -132,7 +141,10 @@ class ExecutionLog(Dto):
132
141
  properties = {}
133
142
  self.properties = properties
134
143
  self.models = []
135
- self.plots = []
144
+ if plots is not None:
145
+ self.plots = plots
146
+ else:
147
+ self.plots = []
136
148
  self.dataframes = []
137
149
  self.messages = []
138
150
 
@@ -393,7 +405,7 @@ class ExecutionLog(Dto):
393
405
  "template": self.get_template_key(),
394
406
  "twin": self.get_twin_key(),
395
407
  "edgeDeviceId": self.edge_device_id,
396
- "status": self.status.value if self.status else None
408
+ "status": self.status.value if hasattr(self.status, 'value') else self.status
397
409
  }
398
410
  return {k: v for k, v in labels.items() if v is not None}
399
411
 
@@ -409,6 +421,10 @@ class ExecutionLog(Dto):
409
421
  "version": self.version,
410
422
  "messages": self.messages or None
411
423
  }
424
+ if self.plots is not None and len(self.plots) > 0:
425
+ data["plots"] = []
426
+ for plot in self.plots:
427
+ data["plots"].append(plot.to_json(target="logs"))
412
428
  return {k: v for k, v in data.items() if v is not None}
413
429
 
414
430
  def to_dict(self) -> dict:
@@ -29,3 +29,31 @@ class PagedQueryResult:
29
29
  if direction != 'asc' and direction != 'desc':
30
30
  raise ValueError("direction must be asc or desc")
31
31
  self.results = None
32
+
33
+ def to_json(self):
34
+ """
35
+ format the results
36
+ """
37
+
38
+ if self.direction == "asc":
39
+ sort_dir = "asc"
40
+ else:
41
+ sort_dir = "desc"
42
+
43
+ formatted_results = []
44
+ if self.results:
45
+ for obj in self.results:
46
+ if hasattr(obj, 'to_json'):
47
+ formatted_results.append(obj.to_json())
48
+ elif hasattr(obj, 'to_dict'):
49
+ formatted_results.append(obj.to_dict())
50
+ else:
51
+ formatted_results.append(obj)
52
+ return {
53
+ "page": self.page,
54
+ "size": self.size,
55
+ "sort": self.sort,
56
+ "direction": sort_dir,
57
+ "total": self.total,
58
+ "results": formatted_results
59
+ }
@@ -6,7 +6,6 @@ class Plot(ApiDto):
6
6
  """
7
7
  A plot is a definition of a Plotly figure that can be stored and shared on Wizata.
8
8
  :ivar plot_id: The UUID of the plot.
9
- :ivar generatedById: The UUID of the Execution from which the plot was created.
10
9
  :ivar name: A simple name helping the user identifying the plot.
11
10
  :ivar figure: Plotly figure defining the plot itself.
12
11
  """
@@ -21,14 +20,12 @@ class Plot(ApiDto):
21
20
  obj.from_json(data)
22
21
  return obj
23
22
 
24
- def __init__(self, plot_id=None, name=None, generated_by_id=None, figure=None):
23
+ def __init__(self, plot_id=None, name=None, figure=None):
25
24
  if plot_id is None:
26
25
  self.plot_id = uuid.uuid4()
27
26
  else:
28
27
  self.plot_id = plot_id
29
28
  self.name = name
30
- self.generatedById = generated_by_id # Execution
31
- # Step Id
32
29
  self.figure = figure
33
30
 
34
31
  def api_id(self) -> str:
@@ -56,8 +53,6 @@ class Plot(ApiDto):
56
53
  self.name = obj["name"]
57
54
  if "figure" in obj.keys():
58
55
  self.figure = obj["figure"]
59
- if "generatedById" in obj.keys():
60
- self.generatedById = uuid.UUID(obj["generatedById"])
61
56
 
62
57
  def to_json(self, target: str = None):
63
58
  """
@@ -69,11 +64,7 @@ class Plot(ApiDto):
69
64
  }
70
65
  if self.name is not None:
71
66
  obj["name"] = self.name
72
- if target is None or target != 'backend-create':
67
+ if target is None or target != 'logs':
73
68
  if self.figure is not None:
74
69
  obj["figure"] = self.figure
75
- if self.generatedById is not None:
76
- #TODO: add generateById as UUID or find another way to store plots
77
- #obj["generatedById"] = str(self.generatedById)
78
- pass
79
70
  return obj
@@ -0,0 +1,61 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Dict, List, Any, Optional
3
+
4
+
5
+ class FilterOperator:
6
+ """
7
+ Constants for standard filtering operators.
8
+ """
9
+ EQ = "eq"
10
+ NE = "ne"
11
+ GT = "gt"
12
+ GTE = "gte"
13
+ LT = "lt"
14
+ LTE = "lte"
15
+ IN = "in"
16
+ CONTAINS = "contains"
17
+ SEARCH = "_search"
18
+
19
+
20
+ class SortOption:
21
+ def __init__(self, field: str, order: str = "asc"):
22
+ self.field = field
23
+ self.order = order
24
+
25
+
26
+ class SearchQuery:
27
+ """
28
+ Generic class to represent JSON request structure.
29
+ """
30
+ @classmethod
31
+ def from_dict(cls, data: dict):
32
+ """
33
+ Helper to convert dictionary coming from endpoint to SearchQuery object.
34
+ """
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
+
40
+ svc_name = data.get("serviceName") or data.get("service_name") or "pipeline_runner"
41
+ return cls(
42
+ filters=data.get("filters", {}),
43
+ sort=sort_objs,
44
+ limit=data.get("limit", 50),
45
+ offset=data.get("offset", 0),
46
+ service_name=svc_name
47
+ )
48
+
49
+ def __init__(self,
50
+ filters: Optional[Dict[str, Any]] = None,
51
+ sort: Optional[List[SortOption]] = None,
52
+ limit: int = 50,
53
+ offset: int = 0,
54
+ service_name: str = "pipeline_runner"):
55
+
56
+ self.filters = filters if filters is not None else {}
57
+ self.sort = sort if sort is not None else []
58
+ self.limit = limit
59
+ self.offset = offset
60
+ self.service_name = service_name
61
+
@@ -0,0 +1 @@
1
+ __version__ = "1.4.0.dev15"
@@ -1053,7 +1053,7 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
1053
1053
  else:
1054
1054
  raise self.__raise_error(response)
1055
1055
 
1056
- def plot(self, plot_id: str = None, plot: Plot = None, figure=None,):
1056
+ def plot(self, plot_id: str = None, plot: Plot = None, figure=None):
1057
1057
  """
1058
1058
  Fetch and show plot.
1059
1059
  :param plot: Wizata Plot Object
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 1.4.0.dev10
3
+ Version: 1.4.0.dev15
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -28,6 +28,7 @@ wizata_dsapi/pipeline_image.py
28
28
  wizata_dsapi/plot.py
29
29
  wizata_dsapi/request.py
30
30
  wizata_dsapi/script.py
31
+ wizata_dsapi/search.py
31
32
  wizata_dsapi/solution_component.py
32
33
  wizata_dsapi/streamlit_utils.py
33
34
  wizata_dsapi/template.py
@@ -1 +0,0 @@
1
- __version__ = "1.4.0.dev10"