wizata-dsapi 2.0.0.dev2__tar.gz → 2.0.0.dev4__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 (59) hide show
  1. {wizata_dsapi-2.0.0.dev2/wizata_dsapi.egg-info → wizata_dsapi-2.0.0.dev4}/PKG-INFO +1 -1
  2. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/__init__.py +2 -1
  3. wizata_dsapi-2.0.0.dev4/wizata_dsapi/dashboard.py +112 -0
  4. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/notification.py +5 -0
  5. wizata_dsapi-2.0.0.dev4/wizata_dsapi/version.py +1 -0
  6. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4/wizata_dsapi.egg-info}/PKG-INFO +1 -1
  7. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi.egg-info/SOURCES.txt +1 -0
  8. wizata_dsapi-2.0.0.dev2/wizata_dsapi/version.py +0 -1
  9. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/LICENSE.txt +0 -0
  10. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/README.rst +0 -0
  11. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/setup.cfg +0 -0
  12. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/setup.py +0 -0
  13. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/api_config.py +0 -0
  14. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/api_dto.py +0 -0
  15. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/api_interface.py +0 -0
  16. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/bucket.py +0 -0
  17. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/business_label.py +0 -0
  18. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/context.py +0 -0
  19. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/dataframe_toolkit.py +0 -0
  20. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/datapoint.py +0 -0
  21. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/datastore.py +0 -0
  22. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/ds_dataframe.py +0 -0
  23. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/dsapi_json_encoder.py +0 -0
  24. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/edge_device.py +0 -0
  25. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/evaluation.py +0 -0
  26. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/execution.py +0 -0
  27. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/execution_log.py +0 -0
  28. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/experiment.py +0 -0
  29. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/group_system.py +0 -0
  30. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/ilogger.py +0 -0
  31. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/insight.py +0 -0
  32. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/mlmodel.py +0 -0
  33. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/model_toolkit.py +0 -0
  34. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/models/__init__.py +0 -0
  35. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/models/common.py +0 -0
  36. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/paged_query_result.py +0 -0
  37. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/pipeline.py +0 -0
  38. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/pipeline_image.py +0 -0
  39. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/plot.py +0 -0
  40. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/plots/__init__.py +0 -0
  41. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/plots/common.py +0 -0
  42. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/request.py +0 -0
  43. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/script.py +0 -0
  44. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/scripts/__init__.py +0 -0
  45. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/scripts/common.py +0 -0
  46. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/search.py +0 -0
  47. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/solution_component.py +0 -0
  48. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/streamlit_utils.py +0 -0
  49. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/template.py +0 -0
  50. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/trigger.py +0 -0
  51. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/twin.py +0 -0
  52. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/twinregistration.py +0 -0
  53. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/wizard_function.py +0 -0
  54. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/wizard_request.py +0 -0
  55. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/wizata_dsapi_client.py +0 -0
  56. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi/words.py +0 -0
  57. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
  58. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/wizata_dsapi.egg-info/requires.txt +0 -0
  59. {wizata_dsapi-2.0.0.dev2 → wizata_dsapi-2.0.0.dev4}/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: 2.0.0.dev2
3
+ Version: 2.0.0.dev4
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -51,4 +51,5 @@ from .streamlit_utils import (get_streamlit_token, get_streamlit_domain, get_str
51
51
 
52
52
  from .search import FilterOperator, SearchQuery, SortOption, GroupSearchQuery
53
53
  from .notification import NotificationScope, DeviceToken, AlertRule, AlertActive
54
- from .edge_device import EdgeDevice, EdgeDeviceStatus, EdgeDeviceType
54
+ from .edge_device import EdgeDevice, EdgeDeviceStatus, EdgeDeviceType
55
+ from .dashboard import Dashboard, DashboardType
@@ -0,0 +1,112 @@
1
+ """
2
+ Dashboard DTO for mobile dashboard persistence.
3
+
4
+ DashboardType — platform the dashboard is designed for:
5
+ - MOBILE: mobile app dashboard.
6
+
7
+ Dashboard — stores a named dashboard with an ordered list of tiles.
8
+ Linked to either a template (by key) or a twin (by hardware_id), not both.
9
+ Tiles are stored as a JSON array — tile order is array index.
10
+ """
11
+
12
+ from datetime import datetime, timezone
13
+ from enum import Enum
14
+ from typing import Optional
15
+
16
+
17
+ class DashboardType(str, Enum):
18
+ MOBILE = "mobile"
19
+
20
+
21
+ class Dashboard:
22
+ """
23
+ Dashboard entity stored in PostgreSQL ``"Dashboard"`` table.
24
+
25
+ PK is ``id`` (UUID, server-generated).
26
+
27
+ - ``name``: display name.
28
+ - ``dashboard_type``: MOBILE (more values later).
29
+ - ``template``: template key (mutually exclusive with ``twin``).
30
+ - ``twin``: twin hardware ID (mutually exclusive with ``template``).
31
+ - ``tiles``: ordered list of tile dicts (type + config).
32
+ """
33
+
34
+ def __init__(self):
35
+ self.id: Optional[str] = None
36
+ self.name: Optional[str] = None
37
+ self.dashboard_type: Optional[DashboardType] = None
38
+ self.template: Optional[str] = None
39
+ self.twin: Optional[str] = None
40
+ self.tiles: list = []
41
+ self.created_at: Optional[datetime] = None
42
+ self.updated_at: Optional[datetime] = None
43
+
44
+ # ------------------------------------------------------------------
45
+ # Serialisation
46
+ # ------------------------------------------------------------------
47
+
48
+ def to_dict(self) -> dict:
49
+ obj = {}
50
+ if self.id is not None:
51
+ obj["id"] = str(self.id)
52
+ if self.name is not None:
53
+ obj["name"] = self.name
54
+ if self.dashboard_type is not None:
55
+ obj["dashboardType"] = (
56
+ self.dashboard_type.value
57
+ if isinstance(self.dashboard_type, DashboardType)
58
+ else self.dashboard_type
59
+ )
60
+ if self.template is not None:
61
+ obj["template"] = self.template
62
+ if self.twin is not None:
63
+ obj["twin"] = self.twin
64
+ obj["tiles"] = list(self.tiles)
65
+ if self.created_at is not None:
66
+ obj["createdAt"] = int(self.created_at.timestamp() * 1000)
67
+ if self.updated_at is not None:
68
+ obj["updatedAt"] = int(self.updated_at.timestamp() * 1000)
69
+ return obj
70
+
71
+ @classmethod
72
+ def from_dict(cls, data: dict) -> "Dashboard":
73
+ obj = cls()
74
+ obj.id = data.get("id")
75
+ obj.name = data.get("name")
76
+
77
+ raw_type = data.get("dashboardType") or data.get("dashboard_type")
78
+ if raw_type is not None:
79
+ obj.dashboard_type = DashboardType(raw_type.lower())
80
+
81
+ obj.template = data.get("template")
82
+ obj.twin = data.get("twin")
83
+ obj.tiles = data.get("tiles") or []
84
+
85
+ created_raw = data.get("createdAt") or data.get("created_at")
86
+ if created_raw is not None:
87
+ obj.created_at = datetime.fromtimestamp(created_raw / 1000, tz=timezone.utc)
88
+
89
+ updated_raw = data.get("updatedAt") or data.get("updated_at")
90
+ if updated_raw is not None:
91
+ obj.updated_at = datetime.fromtimestamp(updated_raw / 1000, tz=timezone.utc)
92
+ return obj
93
+
94
+ # ------------------------------------------------------------------
95
+ # API identity helpers
96
+ # ------------------------------------------------------------------
97
+
98
+ def api_id(self) -> str:
99
+ return str(self.id) if self.id else None
100
+
101
+ def api_key(self) -> str:
102
+ return str(self.id) if self.id else None
103
+
104
+ def set_id(self, value):
105
+ self.id = str(value)
106
+
107
+ def __repr__(self) -> str:
108
+ return (
109
+ f"Dashboard(id={self.id!r}, name={self.name!r}, "
110
+ f"type={self.dashboard_type!r}, "
111
+ f"template={self.template!r}, twin={self.twin!r})"
112
+ )
@@ -24,6 +24,7 @@ class NotificationScope(str, Enum):
24
24
  PIPELINE_USER = "pipeline_user"
25
25
  EDGE_MONITOR = "edge_monitor"
26
26
  PIPELINE_MONITOR = "pipeline_monitor"
27
+ DATAPOINT_MONITOR = "datapoint_monitor"
27
28
 
28
29
 
29
30
  class DeviceToken:
@@ -127,6 +128,7 @@ class AlertRule:
127
128
  self.event_type: Optional[str] = None
128
129
  self.pipeline_key: Optional[str] = None
129
130
  self.group_system: Optional[str] = None
131
+ self.hardware_id: Optional[str] = None
130
132
  self.scope: Optional[NotificationScope] = None
131
133
  self.expiration_cycles: int = 3
132
134
  self.activation_threshold: int = 1
@@ -145,6 +147,8 @@ class AlertRule:
145
147
  obj["pipelineKey"] = self.pipeline_key
146
148
  if self.group_system is not None:
147
149
  obj["groupSystem"] = self.group_system
150
+ if self.hardware_id is not None:
151
+ obj["hardwareId"] = self.hardware_id
148
152
  if self.scope is not None:
149
153
  obj["scope"] = self.scope.value if isinstance(self.scope, NotificationScope) else self.scope
150
154
  obj["expirationCycles"] = self.expiration_cycles
@@ -158,6 +162,7 @@ class AlertRule:
158
162
  obj.event_type = data.get("eventType") or data.get("event_type")
159
163
  obj.pipeline_key = data.get("pipelineKey") or data.get("pipeline_key")
160
164
  obj.group_system = data.get("groupSystem") or data.get("group_system")
165
+ obj.hardware_id = data.get("hardwareId") or data.get("hardware_id")
161
166
 
162
167
  raw_scope = data.get("scope")
163
168
  if raw_scope is not None:
@@ -0,0 +1 @@
1
+ __version__ = "2.0.0.dev4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 2.0.0.dev2
3
+ Version: 2.0.0.dev4
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -8,6 +8,7 @@ wizata_dsapi/api_interface.py
8
8
  wizata_dsapi/bucket.py
9
9
  wizata_dsapi/business_label.py
10
10
  wizata_dsapi/context.py
11
+ wizata_dsapi/dashboard.py
11
12
  wizata_dsapi/dataframe_toolkit.py
12
13
  wizata_dsapi/datapoint.py
13
14
  wizata_dsapi/datastore.py
@@ -1 +0,0 @@
1
- __version__ = "2.0.0.dev2"