Skip to content

init

maintenance ¤

Maintenance Events

Detectors for maintenance-related patterns: degradation trends, failure prediction, and vibration analysis for predictive maintenance on manufacturing/industrial IoT time series data.

  • DegradationDetectionEvents: Detect trend degradation, variance increases, level shifts, and compute composite health scores.
  • detect_trend_degradation: Rolling linear regression slope detection.
  • detect_variance_increase: Rolling variance vs baseline comparison.
  • detect_level_shift: CUSUM-like permanent mean shift detection.
  • health_score: Composite 0-100 score from drift, variance, and trend.

  • FailurePredictionEvents: Predict remaining useful life and escalating failure patterns.

  • remaining_useful_life: Linear extrapolation to failure threshold.
  • detect_exceedance_pattern: Rolling threshold exceedance frequency.
  • time_to_threshold: Rate-of-change based threshold ETA.

  • VibrationAnalysisEvents: Vibration signal analysis for rotating equipment.

  • detect_rms_exceedance: Rolling RMS vs baseline threshold.
  • detect_amplitude_growth: Peak-to-peak amplitude tracking.
  • bearing_health_indicators: Kurtosis and crest factor per window.

DegradationDetectionEvents ¤

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

Bases: Base

Detect degradation patterns in time series signals: trend degradation, variance increases, level shifts, and composite health scores.

Designed for predictive maintenance on manufacturing/industrial IoT data.

detect_trend_degradation ¤

detect_trend_degradation(
    window: str = "1h",
    min_slope: float = 0.0,
    direction: str = "decreasing",
) -> pd.DataFrame

Detect intervals where a rolling linear regression slope exceeds min_slope in the given direction, indicating trend-based degradation.

Parameters:

Name Type Description Default
window str

Rolling window size (e.g. '1h', '30m').

'1h'
min_slope float

Minimum absolute slope to consider degradation.

0.0
direction str

'decreasing' (negative slope) or 'increasing' (positive slope).

'decreasing'

Returns:

Type Description
DataFrame

DataFrame with columns: start, end, uuid, is_delta, avg_slope,

DataFrame

total_change, duration_seconds.

detect_variance_increase ¤

detect_variance_increase(
    window: str = "1h", threshold_factor: float = 2.0
) -> pd.DataFrame

Compare rolling variance against a baseline (first window) and flag intervals where the ratio exceeds threshold_factor.

Parameters:

Name Type Description Default
window str

Rolling window size.

'1h'
threshold_factor float

Minimum variance ratio to flag.

2.0

Returns:

Type Description
DataFrame

DataFrame with columns: start, end, uuid, is_delta,

DataFrame

baseline_variance, current_variance, ratio.

detect_level_shift ¤

detect_level_shift(
    min_shift: float, hold: str = "5m"
) -> pd.DataFrame

CUSUM-like detection for permanent mean shifts in the signal.

Parameters:

Name Type Description Default
min_shift float

Minimum absolute shift magnitude to detect.

required
hold str

Minimum duration the new level must persist.

'5m'

Returns:

Type Description
DataFrame

DataFrame with columns: systime, uuid, is_delta,

DataFrame

shift_magnitude, prev_mean, new_mean.

health_score ¤

health_score(
    window: str = "1h", baseline_window: str = "24h"
) -> pd.DataFrame

Composite 0-100 health score based on mean drift, variance change, and trend slope, computed over rolling windows.

Parameters:

Name Type Description Default
window str

Rolling window for current metrics.

'1h'
baseline_window str

Initial period used to establish baseline behaviour.

'24h'

Returns:

Type Description
DataFrame

DataFrame with columns: systime, uuid, is_delta,

DataFrame

health_score, mean_drift_pct, variance_ratio, trend_slope.

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.

VibrationAnalysisEvents ¤

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

Bases: Base

Analyse vibration signals from industrial equipment: RMS exceedance, amplitude growth, and bearing health indicators (kurtosis, crest factor).

detect_rms_exceedance ¤

detect_rms_exceedance(
    baseline_rms: float,
    threshold_factor: float = 1.5,
    window: str = "1m",
) -> pd.DataFrame

Compute rolling RMS and flag intervals exceeding baseline_rms * threshold_factor.

Parameters:

Name Type Description Default
baseline_rms float

Known baseline RMS value for healthy equipment.

required
threshold_factor float

Multiplier above baseline to trigger alarm.

1.5
window str

Rolling window size.

'1m'

Returns:

Type Description
DataFrame

DataFrame with columns: start, end, uuid, is_delta,

DataFrame

rms_value, baseline_rms, ratio, duration_seconds.

detect_amplitude_growth ¤

detect_amplitude_growth(
    window: str = "1h", growth_threshold: float = 0.1
) -> pd.DataFrame

Track peak-to-peak amplitude in non-overlapping windows and flag windows where amplitude grows beyond growth_threshold relative to baseline.

Parameters:

Name Type Description Default
window str

Window size for amplitude measurement.

'1h'
growth_threshold float

Minimum fractional growth (e.g. 0.1 = 10%) to flag.

0.1

Returns:

Type Description
DataFrame

DataFrame with columns: window_start, uuid, is_delta,

DataFrame

amplitude, baseline_amplitude, growth_pct.

bearing_health_indicators ¤

bearing_health_indicators(
    window: str = "5m",
) -> pd.DataFrame

Compute bearing health indicators per window: RMS, peak value, crest factor (peak/RMS), and kurtosis.

Parameters:

Name Type Description Default
window str

Window size for indicator computation.

'5m'

Returns:

Type Description
DataFrame

DataFrame with columns: window_start, uuid, is_delta,

DataFrame

rms, peak, crest_factor, kurtosis.