How 2abet/predictive-maintenance works
Project type and purpose
• This is a single-page Streamlit application (“Predictive Maintenance Dashboard – AI vs Threshold”) for demonstrating real-time comparison between:
• Rule-based threshold alerts
• AI-powered Random Forest predictions
• Its goal is to simulate sensor data, inject borderline failures, display live risk sliders and confusion-matrix metrics, and showcase AI’s advantage in industrial predictive maintenance scenarios.
File structure
• Top-level files:
• .devcontainer/ – Development container configuration
• README.md – Project overview, setup, tech stack
• predictive_dashboard.py – Main Streamlit app entrypoint
• requirements.txt – Python dependencies
• No separate frontend/back-end folders; everything is in one Streamlit script.
• External services: none. Data is simulated in-app.
Key insights from the README
• Tech stack: Python, Streamlit, Pandas, NumPy, scikit-learn
• Architecture is simple:
1. Data generation
2. Rule-based logic
3. AI model inference
4. UI rendering & interaction
5. Performance comparison
Main components
a. Streamlit UI Layer
• Interactive sliders & display panels
• Trigger for (re)running the pipeline on user input
b. Data Simulator
• Generates synthetic sensor streams (vibration, temperature, current)
• Injects borderline/failure cases
c. Rule-Based Engine
• Applies fixed thresholds to simulated data
• Outputs boolean alerts
d. AI Prediction Engine
• Pre-trained Random Forest model (loaded at startup)
• Consumes same simulated data, outputs failure probability
e. Comparison & Metrics Module
• Builds confusion matrices for both approaches
• Calculates precision, recall, F1-score
f. Environment Configuration
• .devcontainer for reproducible dev setup
• requirements.txt lists Pandas, NumPy, scikit-learn, Streamlit
Relationships and data flow
• User adjusts sliders in UI Layer → triggers data regeneration.
• Data Simulator emits data → feeds into Rule-Based Engine and AI Prediction Engine in parallel.
• Both outputs go to Comparison Module → metrics computed.
• UI Layer renders sensor charts, alert flags, risk scores, and confusion matrices side by side.
Architectural patterns & design principles
• Separation of concerns:
• UI vs data generation vs logic vs metrics
• Parallel processing of two pipelines (threshold vs AI) for comparison
• Modularity: each logical unit resides in a function/block within the script
• Containerized dev environment via .devcontainer