wizata-dsapi 2.0.0.dev17__tar.gz → 2.0.0.dev19__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 (65) hide show
  1. {wizata_dsapi-2.0.0.dev17/wizata_dsapi.egg-info → wizata_dsapi-2.0.0.dev19}/PKG-INFO +1 -1
  2. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/__init__.py +1 -1
  3. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/notification.py +66 -20
  4. wizata_dsapi-2.0.0.dev19/wizata_dsapi/version.py +1 -0
  5. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19/wizata_dsapi.egg-info}/PKG-INFO +1 -1
  6. wizata_dsapi-2.0.0.dev17/wizata_dsapi/version.py +0 -1
  7. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/LICENSE.txt +0 -0
  8. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/README.rst +0 -0
  9. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/setup.cfg +0 -0
  10. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/setup.py +0 -0
  11. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/api_config.py +0 -0
  12. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/api_dto.py +0 -0
  13. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/api_interface.py +0 -0
  14. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/bucket.py +0 -0
  15. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/business_label.py +0 -0
  16. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/context.py +0 -0
  17. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/dashboard.py +0 -0
  18. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/dataframe_toolkit.py +0 -0
  19. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/datapoint.py +0 -0
  20. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/datastore.py +0 -0
  21. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/ds_dataframe.py +0 -0
  22. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/dsapi_json_encoder.py +0 -0
  23. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/edge_config.py +0 -0
  24. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/edge_device.py +0 -0
  25. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/edge_module.py +0 -0
  26. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/evaluation.py +0 -0
  27. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/execution.py +0 -0
  28. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/execution_log.py +0 -0
  29. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/experiment.py +0 -0
  30. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/graylog_log.py +0 -0
  31. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/group_system.py +0 -0
  32. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/ilogger.py +0 -0
  33. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/insight.py +0 -0
  34. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/mlmodel.py +0 -0
  35. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/mobile_asset.py +0 -0
  36. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/model_toolkit.py +0 -0
  37. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/models/__init__.py +0 -0
  38. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/models/common.py +0 -0
  39. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/paged_query_result.py +0 -0
  40. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/pipeline.py +0 -0
  41. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/pipeline_image.py +0 -0
  42. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/plot.py +0 -0
  43. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/plots/__init__.py +0 -0
  44. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/plots/common.py +0 -0
  45. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/request.py +0 -0
  46. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/script.py +0 -0
  47. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/scripts/__init__.py +0 -0
  48. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/scripts/common.py +0 -0
  49. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/search.py +0 -0
  50. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/solution_component.py +0 -0
  51. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/streamlit_utils.py +0 -0
  52. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/template.py +0 -0
  53. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/template_config.py +0 -0
  54. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/trigger.py +0 -0
  55. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/twin.py +0 -0
  56. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/twinregistration.py +0 -0
  57. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/user.py +0 -0
  58. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/wizard_function.py +0 -0
  59. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/wizard_request.py +0 -0
  60. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/wizata_dsapi_client.py +0 -0
  61. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi/words.py +0 -0
  62. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
  63. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
  64. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/wizata_dsapi.egg-info/requires.txt +0 -0
  65. {wizata_dsapi-2.0.0.dev17 → wizata_dsapi-2.0.0.dev19}/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.dev17
3
+ Version: 2.0.0.dev19
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -51,7 +51,7 @@ 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, MonitoredDatapoint, \
54
- NotificationPreference, RecipientList, Recipient, RecipientType
54
+ MonitoredPipeline, NotificationPreference, RecipientList, Recipient, RecipientType
55
55
  from .edge_device import EdgeDevice, EdgeDeviceStatus, EdgeDeviceType
56
56
  from .edge_module import EdgeModule, EdgeModuleType, WIZATA_MODULES
57
57
  from .edge_config import EdgeConsumer, EdgeWriter, EdgeTrigger
@@ -19,7 +19,7 @@ RecipientList — named list of internal users (follow preferences) and free ent
19
19
  (explicit address + channel).
20
20
  """
21
21
 
22
- from datetime import datetime
22
+ from datetime import datetime, timezone
23
23
  from enum import Enum
24
24
  from typing import Optional
25
25
  import uuid
@@ -38,19 +38,13 @@ class DeviceToken:
38
38
 
39
39
  Primary key is ``(token, tenant_id)`` — one row per device per tenant.
40
40
 
41
- Subscription model:
42
- - ``scopes``: which event types to receive.
43
- Defaults to ``[PIPELINE_USER]``.
44
- - ``twins``: hardware IDs of twins to filter on.
45
- Empty list means all twins.
41
+ Pure token registration — scopes and twins are on NotificationPreference.
46
42
  """
47
43
 
48
44
  def __init__(self):
49
45
  self.token: Optional[str] = None
50
46
  self.tenant_id: Optional[str] = None
51
47
  self.user_id: Optional[str] = None
52
- self.scopes: list = [NotificationScope.PIPELINE_USER]
53
- self.twins: list = []
54
48
  self.platform: Optional[str] = None
55
49
  self.created_at: Optional[datetime] = None
56
50
 
@@ -66,8 +60,6 @@ class DeviceToken:
66
60
  obj["tenantId"] = self.tenant_id
67
61
  if self.user_id is not None:
68
62
  obj["userId"] = self.user_id
69
- obj["scopes"] = [s.value if isinstance(s, NotificationScope) else s for s in self.scopes]
70
- obj["twins"] = list(self.twins)
71
63
  if self.platform is not None:
72
64
  obj["platform"] = self.platform
73
65
  if self.created_at is not None:
@@ -80,14 +72,6 @@ class DeviceToken:
80
72
  obj.token = data.get("token")
81
73
  obj.tenant_id = data.get("tenantId") or data.get("tenant_id")
82
74
  obj.user_id = data.get("userId") or data.get("user_id")
83
-
84
- raw_scopes = data.get("scopes")
85
- if raw_scopes is not None:
86
- obj.scopes = [NotificationScope(s.lower()) for s in raw_scopes]
87
- else:
88
- obj.scopes = [NotificationScope.PIPELINE_USER]
89
-
90
- obj.twins = data.get("twins") or []
91
75
  obj.platform = data.get("platform")
92
76
 
93
77
  created_raw = data.get("createdAt") or data.get("created_at")
@@ -108,7 +92,7 @@ class DeviceToken:
108
92
  def __repr__(self) -> str:
109
93
  return (
110
94
  f"DeviceToken(tenant={self.tenant_id!r}, user={self.user_id!r}, "
111
- f"scopes={self.scopes}, twins={self.twins!r})"
95
+ f"platform={self.platform!r})"
112
96
  )
113
97
 
114
98
 
@@ -354,6 +338,54 @@ class MonitoredDatapoint:
354
338
  return f"MonitoredDatapoint(hardware_id={self.hardware_id!r})"
355
339
 
356
340
 
341
+ class MonitoredPipeline:
342
+ """
343
+ Registry entry for a pipeline flagged for monitoring.
344
+
345
+ Stored in PostgreSQL ``"MonitoredPipeline"`` table.
346
+ PK is ``key`` (pipeline key string, one row per pipeline).
347
+
348
+ The pipeline_monitor job reads this table and creates independent
349
+ AlertRule/AlertActive entries per event type (not_triggered, failed).
350
+ """
351
+
352
+ def __init__(self, key: str = None):
353
+ self.key: Optional[str] = key
354
+ self.created_at: Optional[datetime] = None
355
+
356
+ def to_dict(self) -> dict:
357
+ obj = {}
358
+ if self.key is not None:
359
+ obj["key"] = self.key
360
+ if self.created_at is not None:
361
+ obj["createdAt"] = int(self.created_at.timestamp() * 1000)
362
+ return obj
363
+
364
+ @classmethod
365
+ def from_dict(cls, data: dict) -> "MonitoredPipeline":
366
+ obj = cls()
367
+ obj.key = data.get("key")
368
+ raw = data.get("createdAt") or data.get("created_at")
369
+ if raw is not None:
370
+ if isinstance(raw, (int, float)):
371
+ obj.created_at = datetime.fromtimestamp(raw / 1000, tz=timezone.utc)
372
+ elif isinstance(raw, datetime):
373
+ obj.created_at = raw
374
+ return obj
375
+
376
+ def api_id(self) -> str:
377
+ return self.key
378
+
379
+ def api_key(self) -> str:
380
+ return self.key
381
+
382
+ def set_id(self, value):
383
+ self.key = str(value)
384
+
385
+ def __repr__(self) -> str:
386
+ return f"MonitoredPipeline(key={self.key!r})"
387
+
388
+
357
389
  class NotificationPreference:
358
390
  """
359
391
  Per-user notification channel preferences stored in PostgreSQL
@@ -370,6 +402,8 @@ class NotificationPreference:
370
402
  self.email_enabled: bool = False
371
403
  self.sms_enabled: bool = False
372
404
  self.whatsapp_enabled: bool = False
405
+ self.scopes: list = [NotificationScope.PIPELINE_USER]
406
+ self.twins: list = []
373
407
  self.created_at: Optional[datetime] = None
374
408
  self.updated_at: Optional[datetime] = None
375
409
 
@@ -400,6 +434,8 @@ class NotificationPreference:
400
434
  obj["emailEnabled"] = self.email_enabled
401
435
  obj["smsEnabled"] = self.sms_enabled
402
436
  obj["whatsappEnabled"] = self.whatsapp_enabled
437
+ obj["scopes"] = [s.value if isinstance(s, NotificationScope) else s for s in self.scopes]
438
+ obj["twins"] = list(self.twins)
403
439
  if self.created_at is not None:
404
440
  obj["createdAt"] = self.created_at.isoformat()
405
441
  if self.updated_at is not None:
@@ -415,6 +451,13 @@ class NotificationPreference:
415
451
  obj.sms_enabled = data.get("smsEnabled", data.get("sms_enabled", False))
416
452
  obj.whatsapp_enabled = data.get("whatsappEnabled", data.get("whatsapp_enabled", False))
417
453
 
454
+ raw_scopes = data.get("scopes")
455
+ if raw_scopes is not None:
456
+ obj.scopes = [NotificationScope(s.lower()) for s in raw_scopes]
457
+ else:
458
+ obj.scopes = [NotificationScope.PIPELINE_USER]
459
+ obj.twins = data.get("twins") or []
460
+
418
461
  for key in ("createdAt", "created_at"):
419
462
  raw = data.get(key)
420
463
  if raw is not None:
@@ -452,7 +495,10 @@ class NotificationPreference:
452
495
  channels.append("sms")
453
496
  if self.whatsapp_enabled:
454
497
  channels.append("whatsapp")
455
- return f"NotificationPreference(user={self.user_id!r}, channels={channels})"
498
+ return (
499
+ f"NotificationPreference(user={self.user_id!r}, channels={channels}, "
500
+ f"scopes={[s.value for s in self.scopes]}, twins={self.twins!r})"
501
+ )
456
502
 
457
503
 
458
504
  class RecipientType(str, Enum):
@@ -0,0 +1 @@
1
+ __version__ = "2.0.0.dev19"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 2.0.0.dev17
3
+ Version: 2.0.0.dev19
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -1 +0,0 @@
1
- __version__ = "2.0.0.dev17"