Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ FailSight β€” Predictive Maintenance & Reliability Intelligence

Python Status

End-to-end ML-powered predictive maintenance system for turbofan engines

Features β€’ Quick Start β€’ Architecture β€’ Dashboard β€’ Contributing


πŸ“‹ Overview

FailSight is an intelligent predictive maintenance platform built on NASA CMAPSS turbofan engine sensor telemetry. It combines machine learning, reliability engineering, and advanced data visualization to:

  • 🎯 Predict Remaining Useful Life (RUL) with LightGBM models
  • πŸ”΄ Detect Anomalies using IsolationForest unsupervised learning
  • πŸ“Š Analyze Reliability using Weibull failure distributions
  • πŸ“ˆ Forecast Spare Parts demand across your fleet
  • πŸ’¬ Answer Questions using LangGraph AI agent with RAG
  • ⏰ Automate Operations with APScheduler daily pipelines

πŸ› οΈ Tech Stack

Component Technology
Data Pipeline Python β€’ Pandas β€’ SQL (SQLite) β€’ APScheduler
ML Models LightGBM β€’ Scikit-learn β€’ IsolationForest
Reliability Weibull β€’ Statistical Analysis
Dashboard Streamlit β€’ Plotly β€’ Pandas
AI Agent LangChain β€’ LangGraph β€’ ChromaDB β€’ OpenAI/Groq
Dataset NASA CMAPSS (Turbofan Degradation)

✨ Features

πŸ”„ Data Pipeline

  • βœ… Automated ingestion & cleaning from NASA CMAPSS dataset
  • βœ… SQLite database with 160K+ sensor readings
  • βœ… Robust error handling and logging

πŸ—οΈ Feature Engineering

  • βœ… Rolling statistics (mean/std over windows [5, 10, 20])
  • βœ… Temporal lag features (lags [1, 3, 5])
  • βœ… Degradation index (composite sensor metric)
  • βœ… Cycle ratio (lifecycle position)
  • βœ… Anomaly scores & severity metrics

πŸ€– Machine Learning

  • βœ… LightGBM RUL prediction model
  • βœ… Train/validate/test split with proper evaluation
  • βœ… IsolationForest anomaly detection (contamination=5%)
  • βœ… Model persistence with joblib

🎯 Reliability Analysis

  • βœ… Weibull distribution fitting
  • βœ… MTTF (Mean Time To Failure) estimation
  • βœ… Hazard rate curves
  • βœ… Per-subset failure patterns

πŸ“Š Demand Forecasting

  • βœ… Spare parts replacement prediction
  • βœ… Critical/warning threshold-based demand
  • βœ… Weekly forecasting windows

πŸš€ Dashboard

  • πŸ“± Dashboard Page β€” Fleet KPIs, status breakdown, RUL distribution
  • πŸ” Data Exploration β€” EDA, feature distributions, correlations, time series
  • πŸ‘οΈ Unit Explorer β€” Per-unit deep dive with sensor data & anomalies
  • πŸ”΄ Anomaly Explorer β€” Heatmaps, top anomalous units, anomaly-RUL correlation
  • πŸ“ˆ Reliability Analysis β€” Weibull plots, MTTF, hazard rates
  • πŸ’¬ AI Agent β€” Natural language querying & automated reports

⏰ Scheduling

  • βœ… Daily automated pipeline runs at midnight
  • βœ… Full lifecycle: ingest β†’ features β†’ train β†’ vectorstore
  • βœ… Comprehensive logging with timestamps
  • βœ… Error handling & failure alerts

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • 2GB+ RAM (for feature engineering)
  • ~500MB disk space

Installation

# Clone repository
git clone https://github.com/divyat2605/failsight-predictive-maintenance
cd failsight-predictive-maintenance

# Create virtual environment
python -m venv myenv
source myenv/bin/activate  # On Windows: myenv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Pipeline Execution

# Option 1: Run pipeline steps manually
python pipelines/ingest.py           # Download & process CMAPSS data
python pipelines/features.py         # Engineer features + detect anomalies
python models/train_rul.py           # Train LightGBM model
python agent/build_vectorstore.py    # Build ChromaDB vector store

# Option 2: Run automated daily scheduler
python pipelines/scheduler.py        # Runs all steps daily at midnight

Launch Dashboard

streamlit run dashboard/app.py

Then visit http://localhost:8501 in your browser.


πŸ“Š Dashboard Overview

Page 1: Dashboard

  • 6 KPI Cards β€” Total units, critical/warning/healthy counts, avg RUL, units with anomalies
  • RUL Distribution β€” Histogram with threshold markers
  • Fleet Status Pie β€” Visual breakdown by status
  • Alerts Table β€” Critical units with action items

Page 2: Data Exploration

  • Dataset Overview β€” Statistics, subset distribution, feature breakdown
  • Feature Distributions β€” Histograms for sensors, engineered features, RUL
  • Correlation Analysis β€” Heatmaps, feature-RUL rankings, sensor correlations
  • Time Series β€” Select unit & visualize sensor trends + anomalies
  • Feature Engineering Impact β€” Raw vs smoothed signals, rolling statistics demo
  • Anomaly Insights β€” Anomaly rates, early warning indicators, anomalous sensor rankings

Page 3: Unit Explorer

  • Per-Unit Metrics β€” RUL, status, cycle count, anomaly rate
  • Sensor Time Series β€” Plot any sensor with anomaly overlays
  • Degradation Index β€” Composite health trend
  • Multi-Sensor Comparison β€” Plot multiple sensors simultaneously

Page 4: Anomaly Explorer

  • Heatmap β€” Anomaly rate across units Γ— subsets
  • Top 10 Table β€” Most anomalous units with first anomaly cycle
  • Scatter Plot β€” First anomaly cycle vs predicted RUL (early warning)

Page 5: Reliability Analysis

  • Weibull Fitting β€” Shape (Ξ²) and scale (Ξ±) parameters
  • MTTF Calculation β€” Mean time to failure by subset
  • Hazard Rate Curves β€” Failure probability over time
  • Per-Subset Analysis β€” FD001/FD002/FD003/FD004 comparisons

Page 6: AI Agent

  • Natural Language Chat β€” Ask questions about fleet health
  • Auto Reports β€” Generate failure summaries for critical units
  • Context-Aware β€” RAG integration with processed data
  • Multi-Turn Dialogue β€” Conversation history maintained

πŸ“ Project Structure

failsight-predictive-maintenance/
β”œβ”€β”€ config.py                    # Configuration & constants
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ README.md                    # This file
β”‚
β”œβ”€β”€ pipelines/
β”‚   β”œβ”€β”€ ingest.py               # CMAPSS download & preprocessing
β”‚   β”œβ”€β”€ features.py             # Feature engineering & anomaly detection
β”‚   └── scheduler.py            # Daily pipeline orchestrator (APScheduler)
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ train_rul.py            # LightGBM model training
β”‚   └── saved/                  # Saved models & artifacts
β”‚
β”œβ”€β”€ analysis/
β”‚   β”œβ”€β”€ weibull_analysis.py     # Reliability analysis
β”‚   β”œβ”€β”€ spare_parts.py          # Demand forecasting
β”‚   └── anomaly_detection.py    # IsolationForest anomaly detection
β”‚
β”œβ”€β”€ agent/
β”‚   β”œβ”€β”€ failsight_agent.py      # LangGraph AI agent
β”‚   β”œβ”€β”€ build_vectorstore.py    # ChromaDB vector store builder
β”‚   └── vectorstore/            # Persisted embeddings
β”‚
β”œβ”€β”€ dashboard/
β”‚   └── app.py                  # Streamlit multi-page dashboard
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ raw/                    # CMAPSS dataset
β”‚   └── processed/              # Features, models, database
β”‚
└── dags/
    └── failsight_dag.py        # Airflow DAG (reference)

βš™οΈ Configuration

Edit config.py to customize:

# Paths
DATA_RAW_DIR = "data/raw"
DATA_PROCESSED_DIR = "data/processed"
MODELS_DIR = "models/saved"

# Model parameters
RANDOM_STATE = 42
TEST_SIZE = 0.2
MAX_RUL = 125

# Thresholds
RUL_CRITICAL_THRESHOLD = 30
RUL_WARNING_THRESHOLD = 60

# Anomaly detection
CONTAMINATION_RATE = 0.05  # 5% of cycles flagged

πŸ”„ Pipeline Architecture

CMAPSS Download
    ↓
Ingest (ingest.py) β€” Clean sensors, add RUL
    ↓
Features (features.py) β€” Rolling stats, lags, degradation, anomalies
    ↓
Train (train_rul.py) β€” LightGBM model training & validation
    ↓
Vectorstore (build_vectorstore.py) β€” ChromaDB embeddings for AI agent
    ↓
Dashboard β€” Live monitoring & insights

Automated by: scheduler.py (runs daily at midnight)


πŸ“Š Sample Outputs

Model Performance

LightGBM RUL Prediction
Training samples: 128,287
Validation samples: 32,072
RMSE: 18.5 cycles
MAE: 12.3 cycles
RΒ² Score: 0.87

Anomaly Detection

Total Anomalies: 8,120 (5.06% of cycles)
Units Affected: 256/260 (98%)
Average Anomaly Rate: 5.1%
Most Anomalous Subset: FD003

πŸ”§ Advanced Usage

Run Specific Pipeline Step

python pipelines/ingest.py      # Just download & clean
python pipelines/features.py    # Just engineer features
python models/train_rul.py      # Just retrain model

Custom Analysis

import pandas as pd
from analysis.anomaly_detection import get_anomaly_summary

# Load processed data
df = pd.read_parquet("data/processed/features.parquet")

# Get anomaly stats
anomaly_summary = get_anomaly_summary(df)
print(anomaly_summary)

Schedule Custom Times

Edit pipelines/scheduler.py:

# Run at 6 AM instead of midnight
trigger = CronTrigger(hour=6, minute=0)

πŸ“ˆ Key Metrics

Metric Value
Dataset Size 160,359 sensor readings
Number of Units 260 turbofan engines
Subsets (Conditions) 4 (FD001-FD004)
Total Features 150+ engineered features
Model Accuracy 87% (RΒ² score)
Anomaly Detection Rate 5.1% (configurable)
Dashboard Response <2s (cached)

🀝 Contributing

Contributions welcome! Areas for enhancement:

  • Add LSTM/GRU models for RUL prediction
  • Implement XGBoost & CatBoost comparisons
  • Extended Kalman Filter for RUL
  • Multi-step ahead forecasting
  • Alert notification system (email/Slack)
  • Cloud deployment (AWS/Azure/GCP)
  • REST API for model inference
  • Unit tests & CI/CD pipeline

πŸ“„ License

Apache License Version 2.0


πŸ“ž Contact & Support

Repository: https://github.com/divyat2605/failsight-predictive-maintenance

Issues: GitHub Issues


Built with ❀️ for predictive maintenance

FailSight β€” Making engines reliable, systematically

About

End-to-end predictive maintenance system on NASA CMAPSS sensor data. ML-based Remaining Useful Life (RUL) estimation, Weibull reliability analysis, spare parts demand forecasting, automated Airflow pipelines, Streamlit dashboard with live KPIs, and a LangGraph AI agent for natural language fleet querying and failure report generation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages