ts_shape.events.maintenance.failure_prediction
Classes
| Name | Description |
|---|---|
FailurePredictionEvents | Predict remaining useful life and detect escalating failure patterns |
FailurePredictionEvents
FailurePredictionEvents(
dataframe: pd.DataFrame,
signal_uuid: str,
*,
event_uuid: str = "maint:failure_pred",
value_column: str = "value_double",
time_column: str = "systime"
) -> None
Bases: Base
Predict remaining useful life and detect escalating failure patterns in time series signals from manufacturing/industrial IoT systems.
Functions
| Name | Description |
|---|---|
remaining_useful_life | Estimate remaining useful life (RUL) at each point via linear |
detect_exceedance_pattern | Track frequency of threshold exceedances in rolling windows and |
time_to_threshold | Estimate time to reach a threshold based on recent rate of change. |
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 |
event_uuid | str | UUID stamped on emitted events. | 'maint:failure_pred' |
value_column | str | Column holding the signal values. | 'value_double' |
time_column | str | Timestamp column. | 'systime' |
remaining_useful_life
remaining_useful_life(
degradation_rate: float, failure_threshold: float
) -> pd.DataFrame
Estimate remaining useful life (RUL) at each point via linear extrapolation from the recent trend to a failure threshold.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
degradation_rate | float | Expected rate of change per second (used as fallback if local slope cannot be computed). | required |
failure_threshold | float | The signal level that represents failure. The sign of degradation_rate gives the failure direction (positive: failure when the value rises to the threshold). | required |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: systime, uuid, source_uuid, is_delta, |
DataFrame | current_value, rul_seconds, rul_hours, confidence. rul_* is 0 once the |
DataFrame | threshold is reached or passed, and None when no failure is |
DataFrame | projected (flat trend, or a trend moving away from the threshold). |
detect_exceedance_pattern
detect_exceedance_pattern(
warning_threshold: float,
critical_threshold: float,
window: str = "1h",
*,
direction: str | None = None
) -> pd.DataFrame
Track frequency of threshold exceedances in rolling windows and flag escalating patterns (increasing exceedance counts).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
warning_threshold | float | Warning level (absolute value comparison). | required |
critical_threshold | float | Critical level (absolute value comparison). | required |
window | str | Rolling window size. | '1h' |
direction | str | None | "rising" (failure at high values) or "falling" (at low values). Given, a critical level that is not beyond the warning level raises ValueError (swapped levels). None (default) infers it from the order of the two levels (critical >= warning: rising). | None |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, is_delta, warning_count, critical_count, |
DataFrame | escalation_detected. end is start plus window. |
time_to_threshold
time_to_threshold(
threshold: float, direction: str = "increasing"
) -> pd.DataFrame
Estimate time to reach a threshold based on recent rate of change.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
threshold | float | Target threshold value. | required |
direction | str | 'increasing' or 'decreasing'. | 'increasing' |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: systime, uuid, source_uuid, is_delta, |
DataFrame | current_value, rate_of_change, estimated_time_seconds. |