ts_shape.events.engineering.process_stability_index
Classes
| Name | Description |
|---|---|
ProcessStabilityIndexEvents | Engineering: Process Stability Index |
ProcessStabilityIndexEvents
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
| Name | Description |
|---|---|
stability_score | Composite 0-100 stability score per window. |
score_trend | Track whether stability is improving or degrading. |
worst_periods | Return the N worst-scoring windows. |
stability_comparison | Compare each window to the best-observed window. |
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format timeseries frame (one row per sample, uuid identifies the signal). | required |
signal_uuid | str | UUID of the signal to analyze. | required |
target | float | None | Target value. None (default) uses the signal mean. | None |
lower_spec | float | None | Lower specification limit. None (default) uses mean - 3 std. | None |
upper_spec | float | None | Upper specification limit. None (default) uses mean + 3 std. | None |
event_uuid | str | UUID stamped on emitted events. | 'eng:stability_index' |
value_column | str | Column holding the signal values. | 'value_double' |
time_column | str | Timestamp column. | 'systime' |
stability_score
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
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Scoring window (pandas offset string, e.g. '8h' per shift). Windows with fewer than two samples are skipped. | '8h' |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, stability_score, |
DataFrame | variance_score, bias_score, excursion_score, smoothness_score, |
DataFrame | grade. |
score_trend
score_trend(window: str = '8h', n_windows: int = 7) -> pd.DataFrame
Track whether stability is improving or degrading.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Scoring window passed to :meth:stability_score. | '8h' |
n_windows | int | Number of windows in the rolling average of the score. | 7 |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, stability_score, |
DataFrame | rolling_avg, trend_direction, score_change. |
worst_periods
worst_periods(window: str = '1h', n: int = 5) -> pd.DataFrame
Return the N worst-scoring windows.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Scoring window passed to :meth:stability_score. | '1h' |
n | int | Number of lowest-scoring windows to return. | 5 |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, stability_score, |
DataFrame | variance_score, bias_score, excursion_score, smoothness_score, |
DataFrame | primary_issue. |
stability_comparison
stability_comparison(window: str = '8h') -> pd.DataFrame
Compare each window to the best-observed window.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Scoring window passed to :meth:stability_score. | '8h' |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, stability_score, |
DataFrame | best_score, gap_to_best, pct_of_best. |
DataFrame | Canonical twin columns: share_of_best_pct (after pct_of_best); each holds |
DataFrame | the same values as the deprecated column right before it, which is removed |
DataFrame | in the next major release. |