Skip to content

failure_prediction

failure_prediction ¤

FailurePredictionEvents ¤

FailurePredictionEvents(
    dataframe: DataFrame,
    signal_uuid: str,
    *,
    event_uuid: str = "maint:failure_pred",
    value_column: str = "value_double",
    time_column: str = "systime"
)

Bases: Base

Predict remaining useful life and detect escalating failure patterns in time series signals from manufacturing/industrial IoT systems.

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.

required

Returns:

Type Description
DataFrame

DataFrame with columns: systime, uuid, is_delta, current_value,

DataFrame

rul_seconds, rul_hours, confidence.

detect_exceedance_pattern ¤

detect_exceedance_pattern(
    warning_threshold: float,
    critical_threshold: float,
    window: str = "1h",
) -> 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'

Returns:

Type Description
DataFrame

DataFrame with columns: window_start, uuid, is_delta,

DataFrame

warning_count, critical_count, escalation_detected.

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, is_delta, current_value,

DataFrame

rate_of_change, estimated_time_seconds.