Skip to main content
Version: Next

ts_shape.events.engineering.process_stability_index

Classes
NameDescription
ProcessStabilityIndexEventsEngineering: Process Stability Index

ProcessStabilityIndexEvents​

classsource
ProcessStabilityIndexEvents(
dataframe: pd.DataFrame,
signal_uuid: str,
*,
target: float | None = None,
lower_spec: float | None = None,
upper_spec: float | None = None,
event_uuid: str = "eng:stability_index",
value_column: str = "value_double",
time_column: str = "systime"
) -> None

Bases: Base

Engineering: Process Stability Index

Generate a single 0-100 stability score per shift/day for a signal. Answers 'is my process running well today?' with one number.

Methods:

  • stability_score: Composite 0-100 score per window.
  • score_trend: Is stability improving or degrading?
  • worst_periods: N worst-scoring windows.
  • stability_comparison: Compare each window to best-observed.
Functions
NameDescription
stability_scoreComposite 0-100 stability score per window.
score_trendTrack whether stability is improving or degrading.
worst_periodsReturn the N worst-scoring windows.
stability_comparisonCompare each window to the best-observed window.
Parameters
NameTypeDescriptionDefault
dataframeDataFrameLong-format timeseries frame (one row per sample, uuid identifies the signal).required
signal_uuidstrUUID of the signal to analyze.required
targetfloat | NoneTarget value. None (default) uses the signal mean.None
lower_specfloat | NoneLower specification limit. None (default) uses mean - 3 std.None
upper_specfloat | NoneUpper specification limit. None (default) uses mean + 3 std.None
event_uuidstrUUID stamped on emitted events.'eng:stability_index'
value_columnstrColumn holding the signal values.'value_double'
time_columnstrTimestamp column.'systime'

stability_score​

methodsource
stability_score(window: str = '8h') -> pd.DataFrame

Composite 0-100 stability score per window.

Four sub-scores (each 0-25):

  • variance_score: low std = high score
  • bias_score: on-target = high score
  • excursion_score: in-spec = high score
  • smoothness_score: low point-to-point jitter = high score
Parameters
NameTypeDescriptionDefault
windowstrScoring window (pandas offset string, e.g. '8h' per shift). Windows with fewer than two samples are skipped.'8h'
Returns
TypeDescription
DataFrameDataFrame with columns: start, end, duration_seconds, uuid,
DataFramesource_uuid, stability_score,
DataFramevariance_score, bias_score, excursion_score, smoothness_score,
DataFramegrade.

score_trend​

methodsource
score_trend(window: str = '8h', n_windows: int = 7) -> pd.DataFrame

Track whether stability is improving or degrading.

Parameters
NameTypeDescriptionDefault
windowstrScoring window passed to :meth:stability_score.'8h'
n_windowsintNumber of windows in the rolling average of the score.7
Returns
TypeDescription
DataFrameDataFrame with columns: start, end, duration_seconds, uuid,
DataFramesource_uuid, stability_score,
DataFramerolling_avg, trend_direction, score_change.

worst_periods​

methodsource
worst_periods(window: str = '1h', n: int = 5) -> pd.DataFrame

Return the N worst-scoring windows.

Parameters
NameTypeDescriptionDefault
windowstrScoring window passed to :meth:stability_score.'1h'
nintNumber of lowest-scoring windows to return.5
Returns
TypeDescription
DataFrameDataFrame with columns: start, end, duration_seconds, uuid,
DataFramesource_uuid, stability_score,
DataFramevariance_score, bias_score, excursion_score, smoothness_score,
DataFrameprimary_issue.

stability_comparison​

methodsource
stability_comparison(window: str = '8h') -> pd.DataFrame

Compare each window to the best-observed window.

Parameters
NameTypeDescriptionDefault
windowstrScoring window passed to :meth:stability_score.'8h'
Returns
TypeDescription
DataFrameDataFrame with columns: start, end, duration_seconds, uuid,
DataFramesource_uuid, stability_score,
DataFramebest_score, gap_to_best, pct_of_best.
DataFrameCanonical twin columns: share_of_best_pct (after pct_of_best); each holds
DataFramethe same values as the deprecated column right before it, which is removed
DataFramein the next major release.