wizata-dsapi 2.0.0.dev27__tar.gz → 2.0.0.dev28__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 (66) hide show
  1. {wizata_dsapi-2.0.0.dev27/wizata_dsapi.egg-info → wizata_dsapi-2.0.0.dev28}/PKG-INFO +1 -1
  2. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/plots/__init__.py +1 -1
  3. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/plots/common.py +140 -32
  4. wizata_dsapi-2.0.0.dev28/wizata_dsapi/version.py +1 -0
  5. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28/wizata_dsapi.egg-info}/PKG-INFO +1 -1
  6. wizata_dsapi-2.0.0.dev27/wizata_dsapi/version.py +0 -1
  7. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/LICENSE.txt +0 -0
  8. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/README.rst +0 -0
  9. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/setup.cfg +0 -0
  10. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/setup.py +0 -0
  11. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/__init__.py +0 -0
  12. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/api_config.py +0 -0
  13. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/api_dto.py +0 -0
  14. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/api_interface.py +0 -0
  15. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/bucket.py +0 -0
  16. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/business_label.py +0 -0
  17. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/context.py +0 -0
  18. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/dashboard.py +0 -0
  19. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/dataframe_toolkit.py +0 -0
  20. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/datapoint.py +0 -0
  21. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/datastore.py +0 -0
  22. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/ds_dataframe.py +0 -0
  23. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/dsapi_json_encoder.py +0 -0
  24. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/edge_config.py +0 -0
  25. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/edge_device.py +0 -0
  26. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/edge_module.py +0 -0
  27. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/evaluation.py +0 -0
  28. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/execution.py +0 -0
  29. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/execution_log.py +0 -0
  30. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/experiment.py +0 -0
  31. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/graylog_log.py +0 -0
  32. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/group_system.py +0 -0
  33. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/ilogger.py +0 -0
  34. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/insight.py +0 -0
  35. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/mlmodel.py +0 -0
  36. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/mobile_asset.py +0 -0
  37. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/model_toolkit.py +0 -0
  38. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/models/__init__.py +0 -0
  39. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/models/common.py +0 -0
  40. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/notification.py +0 -0
  41. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/paged_query_result.py +0 -0
  42. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/pipeline.py +0 -0
  43. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/pipeline_image.py +0 -0
  44. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/plot.py +0 -0
  45. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/plots/theme.py +0 -0
  46. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/request.py +0 -0
  47. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/script.py +0 -0
  48. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/scripts/__init__.py +0 -0
  49. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/scripts/common.py +0 -0
  50. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/search.py +0 -0
  51. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/solution_component.py +0 -0
  52. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/streamlit_utils.py +0 -0
  53. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/template.py +0 -0
  54. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/template_config.py +0 -0
  55. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/trigger.py +0 -0
  56. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/twin.py +0 -0
  57. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/twinregistration.py +0 -0
  58. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/user.py +0 -0
  59. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/wizard_function.py +0 -0
  60. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/wizard_request.py +0 -0
  61. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/wizata_dsapi_client.py +0 -0
  62. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi/words.py +0 -0
  63. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
  64. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
  65. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/wizata_dsapi.egg-info/requires.txt +0 -0
  66. {wizata_dsapi-2.0.0.dev27 → wizata_dsapi-2.0.0.dev28}/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.dev27
3
+ Version: 2.0.0.dev28
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -1,2 +1,2 @@
1
- from .common import ts_chart, confusion_matrix, r_squared, anomalies_chart, parallel_coordinates, data_table, setpoint_recommendation, feature_importance
1
+ from .common import ts_chart, confusion_matrix, r_squared, anomalies_chart, parallel_coordinates, data_table, setpoint_recommendation, feature_importance, process_variability
2
2
  from . import theme
@@ -6,8 +6,11 @@ import plotly.graph_objects as go
6
6
  import plotly.express as px
7
7
  import sklearn.metrics
8
8
 
9
+ from plotly.subplots import make_subplots
10
+
9
11
  from .theme import (
10
- apply_theme, SERIES_COLORS, ANOMALY_COLOR, TEXT_MUTED, WHITE,
12
+ apply_theme, SERIES_COLORS, ANOMALY_COLOR, MAIN_COLOR, POSITIVE_COLOR,
13
+ TEXT_MUTED, WHITE,
11
14
  TABLE_HEADER_BG, TABLE_HEADER_TEXT, TABLE_CELL_BG, TABLE_CELL_TEXT,
12
15
  TABLE_LINE_COLOR, FONT_FAMILY, FONT_SIZE,
13
16
  )
@@ -221,14 +224,12 @@ def parallel_coordinates(context: wizata_dsapi.Context):
221
224
 
222
225
 
223
226
  def setpoint_recommendation(context: wizata_dsapi.Context):
224
- """Compare current vs recommended setpoint values as a Wizata-themed table.
225
-
226
- Auto-pairs columns: for every column ending in '_recommended', looks for a matching column
227
- with the same name minus the suffix. Validates that the base column corresponds to a datapoint
228
- with BusinessType.SET_POINTS via context.datapoints (defense against accidental pairings).
229
- Uses the **last row** of the dataframe for current and recommended values (most recent state).
227
+ """Compare current vs recommended setpoint values as a grouped bar chart with a summary table.
230
228
 
231
- Output columns: Setpoint | Current | Recommended | Δ | Δ (%)
229
+ Auto-pairs columns: for every column ending in '_recommended', matches the same column name
230
+ without the suffix and validates via context.datapoints BusinessType.SET_POINTS. Uses the last
231
+ row of the dataframe (most recent state). The top half shows a horizontal grouped bar chart
232
+ (Current vs Recommended), the bottom half a table with Setpoint | Current | Recommended | delta | delta (%).
232
233
  """
233
234
  df = context.dataframe
234
235
  datapoints = context.datapoints or {}
@@ -244,8 +245,6 @@ def setpoint_recommendation(context: wizata_dsapi.Context):
244
245
  base = col[: -len(suffix)]
245
246
  if base not in df.columns:
246
247
  continue
247
- # Safety check: only pair if the base column is a declared setpoint datapoint.
248
- # If datapoints are not populated (e.g. local test), fall back to pairing by name.
249
248
  if datapoints:
250
249
  dp = datapoints.get(base)
251
250
  if dp is None or dp.business_type != wizata_dsapi.BusinessType.SET_POINTS:
@@ -258,32 +257,64 @@ def setpoint_recommendation(context: wizata_dsapi.Context):
258
257
  )
259
258
 
260
259
  last = df.iloc[-1]
261
- rows = []
260
+ names, currents, recommendeds, deltas, pcts = [], [], [], [], []
262
261
  for base, rec in pairs:
263
- current = last[base]
264
- recommended = last[rec]
262
+ current = float(last[base])
263
+ recommended = float(last[rec])
265
264
  delta = recommended - current
266
265
  pct = (delta / current * 100.0) if current not in (0, 0.0) and not pd.isna(current) else float("nan")
267
- rows.append({
268
- "Setpoint": base,
269
- "Current": current,
270
- "Recommended": recommended,
271
- "Δ": delta,
272
- "Δ (%)": pct,
273
- })
274
-
275
- out = pd.DataFrame(rows)
276
-
277
- # Formatting — round numerics for readability
278
- for col in ("Current", "Recommended", "Δ", "Δ (%)"):
279
- out[col] = out[col].apply(lambda v: "—" if pd.isna(v) else f"{v:.3f}")
266
+ names.append(base)
267
+ currents.append(current)
268
+ recommendeds.append(recommended)
269
+ deltas.append(delta)
270
+ pcts.append(pct)
271
+
272
+ # ── Build combined figure: bar chart (top) + table (bottom) ──────────
273
+ fig = make_subplots(
274
+ rows=2, cols=1,
275
+ specs=[[{"type": "xy"}], [{"type": "domain"}]],
276
+ row_heights=[0.55, 0.45],
277
+ vertical_spacing=0.08,
278
+ )
280
279
 
281
- n_rows = len(out)
280
+ # Grouped horizontal bars
281
+ fig.add_trace(go.Bar(
282
+ y=names,
283
+ x=recommendeds,
284
+ orientation="h",
285
+ name="Recommended Value",
286
+ marker_color=POSITIVE_COLOR,
287
+ text=[f"{v:.2f}" for v in recommendeds],
288
+ textposition="inside",
289
+ insidetextanchor="start",
290
+ textfont=dict(color=WHITE, size=FONT_SIZE),
291
+ ), row=1, col=1)
292
+
293
+ fig.add_trace(go.Bar(
294
+ y=names,
295
+ x=currents,
296
+ orientation="h",
297
+ name="Current Value",
298
+ marker_color=MAIN_COLOR,
299
+ text=[f"{v:.2f}" for v in currents],
300
+ textposition="inside",
301
+ insidetextanchor="start",
302
+ textfont=dict(color=WHITE, size=FONT_SIZE),
303
+ ), row=1, col=1)
304
+
305
+ fig.update_layout(barmode="group")
306
+ fig.update_xaxes(title_text="Values", row=1, col=1)
307
+ fig.update_yaxes(title_text="Setpoints", row=1, col=1)
308
+
309
+ # Summary table
310
+ fmt = lambda v: "—" if pd.isna(v) else f"{v:.3f}"
311
+ n_rows = len(names)
282
312
  cell_bg = [TABLE_CELL_BG[i % 2] for i in range(n_rows)]
283
313
 
284
- fig = go.Figure(data=[go.Table(
314
+ fig.add_trace(go.Table(
285
315
  header=dict(
286
- values=[f"<b>{c}</b>" for c in out.columns],
316
+ values=["<b>Setpoint</b>", "<b>Current</b>", "<b>Recommended</b>",
317
+ "<b>\u0394</b>", "<b>\u0394 (%)</b>"],
287
318
  fill_color=TABLE_HEADER_BG,
288
319
  font=dict(family=FONT_FAMILY, size=FONT_SIZE, color=TABLE_HEADER_TEXT),
289
320
  align="left",
@@ -291,16 +322,25 @@ def setpoint_recommendation(context: wizata_dsapi.Context):
291
322
  height=32,
292
323
  ),
293
324
  cells=dict(
294
- values=[out[c].tolist() for c in out.columns],
325
+ values=[
326
+ names,
327
+ [fmt(v) for v in currents],
328
+ [fmt(v) for v in recommendeds],
329
+ [fmt(v) for v in deltas],
330
+ [fmt(v) for v in pcts],
331
+ ],
295
332
  fill_color=[cell_bg],
296
333
  font=dict(family=FONT_FAMILY, size=FONT_SIZE, color=TABLE_CELL_TEXT),
297
334
  align="left",
298
335
  line_color=TABLE_LINE_COLOR,
299
336
  height=28,
300
337
  ),
301
- )])
338
+ ), row=2, col=1)
302
339
 
303
- fig.update_layout(margin=dict(l=0, r=0, t=0, b=0))
340
+ fig.update_layout(
341
+ title="Actual vs Recommended Values",
342
+ legend=dict(orientation="h", y=1.02, x=0.5, xanchor="center"),
343
+ )
304
344
  apply_theme(fig)
305
345
 
306
346
  context.set_plot(figure=fig, name="setpoint_recommendation")
@@ -361,6 +401,74 @@ def feature_importance(context: wizata_dsapi.Context):
361
401
  context.set_plot(figure=fig, name="feature_importance")
362
402
 
363
403
 
404
+ def process_variability(context: wizata_dsapi.Context):
405
+ """Parallel coordinates plot showing configurations variability across process features, colored by
406
+ a quality/outcome column. Each line is one row (time step) of the dataframe; each vertical axis
407
+ is a numeric feature. The color gradient runs from red (poor quality) through yellow to green
408
+ (good quality) based on the 'color_by' column.
409
+
410
+ Column selection:
411
+ - color_by: property name of the quality column used for coloring (defaults to
412
+ context.properties['target_feat'] if set, otherwise the last numeric column).
413
+ - color_reverse: set to true (default) when a LOWER color_by value is better
414
+ (e.g. residual_co2) — low values will be green. Set to false when higher is better
415
+ (e.g. 'good_bottles') — high values will be green.
416
+ """
417
+ df = context.dataframe
418
+ if df is None or len(df) == 0:
419
+ raise ValueError("process_variability: dataframe is empty")
420
+
421
+ numeric_cols = df.select_dtypes(include="number").columns.tolist()
422
+ if len(numeric_cols) < 2:
423
+ raise ValueError("process_variability: need at least 2 numeric columns")
424
+
425
+ # Resolve color column
426
+ color_by = context.properties.get("color_by")
427
+ if color_by is None:
428
+ color_by = context.properties.get("target_feat")
429
+ if color_by is None:
430
+ color_by = numeric_cols[-1]
431
+ if color_by not in df.columns:
432
+ raise ValueError(f"process_variability: color_by column '{color_by}' not found in dataframe")
433
+
434
+ color_reverse = context.properties.get("color_reverse", True)
435
+ if isinstance(color_reverse, str):
436
+ color_reverse = color_reverse.lower() not in ("false", "0", "no")
437
+
438
+ # Build dimensions for all numeric columns
439
+ dimensions = []
440
+ for col in numeric_cols:
441
+ col_vals = df[col].dropna()
442
+ if col_vals.empty:
443
+ continue
444
+ dimensions.append(dict(
445
+ label=col,
446
+ values=df[col].values,
447
+ range=[float(col_vals.min()), float(col_vals.max())],
448
+ ))
449
+
450
+ # Colorscale: red → yellow → green (reversed if lower is better)
451
+ if color_reverse:
452
+ colorscale = [[0, POSITIVE_COLOR], [0.5, "#FDDD60"], [1, "#FF6E76"]]
453
+ else:
454
+ colorscale = [[0, "#FF6E76"], [0.5, "#FDDD60"], [1, POSITIVE_COLOR]]
455
+
456
+ fig = go.Figure(data=go.Parcoords(
457
+ line=dict(
458
+ color=df[color_by].values,
459
+ colorscale=colorscale,
460
+ showscale=True,
461
+ colorbar=dict(title=color_by),
462
+ ),
463
+ dimensions=dimensions,
464
+ ))
465
+
466
+ fig.update_layout(title="Configurations Variability")
467
+ apply_theme(fig)
468
+
469
+ context.set_plot(figure=fig, name="process_variability")
470
+
471
+
364
472
  def data_table(context: wizata_dsapi.Context):
365
473
  """Render the dataframe as a styled table with Wizata theme colors."""
366
474
  df = context.dataframe.copy()
@@ -0,0 +1 @@
1
+ __version__ = "2.0.0.dev28"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 2.0.0.dev27
3
+ Version: 2.0.0.dev28
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.dev27"