A modern, intelligent web application for predictive maintenance in manufacturing environments. This system uses machine learning to predict equipment failures and provides real-time monitoring through an interactive dashboard with specific failure detection and immediate service request capabilities.
- π― Specific Failure Detection: Shows exact issues like "Nozzle Clog", "Pump Wear", "Heater Element Degradation" instead of generic messages
- β‘ Immediate Service Requests: Click "Request Service" β Select specific parts β Get instant confirmation with time estimates
- π Interactive Dashboard: Real-time machine health monitoring with clickable sensor graphs
- π€ Intelligent ML System: Supports different machine types with varying sensor configurations
- π Predictive Analytics: Failure prediction and remaining useful life estimation
- π Real-time Updates: Live data streaming with WebSocket support
- π± Responsive Design: Mobile-friendly sidebar with dropdown navigation
- π¨ Anomaly Detection: Statistical analysis with configurable thresholds
- π§ Maintenance Scheduling: Professional service request workflow
- Backend: Flask 3.0 with SQLAlchemy
- Machine Learning: TensorFlow 2.15 with dual-output GRU models
- Frontend: Modern JavaScript with Chart.js and Tailwind CSS
- Real-time: Flask-SocketIO for live updates
- Database: SQLite (PostgreSQL ready)
- Architecture: Centralized package management with clean structure
pip install -r requirements.txtpython -c "from app import create_app; app = create_app(); print('β
Database initialized')"python scripts/create_basic_models.pypython run.pyOpen http://localhost:5000 in your browser
PDM/
βββ app/
β βββ packages.py # Centralized package definitions
β βββ __init__.py # Application factory
β βββ api/ # API endpoints
β β βββ routes.py # Main API routes
β β βββ machine_management.py
β βββ config/ # Configuration files
β β βββ machine_config.py
β βββ models/ # Database models
β β βββ company.py
β β βββ sensor_data.py
β βββ services/ # Business logic
β β βββ predictor.py # ML prediction service
β β βββ simulator.py # Data simulation
β βββ templates/
β βββ dashboard.html # Interactive dashboard
βββ scripts/ # Utility scripts
βββ models/ # Trained ML models
βββ .gitignore # Git ignore rules
βββ requirements.txt # Python dependencies
βββ run.py # Application entry point
The system provides exact failure information instead of generic messages:
- FILLING: "Nozzle Clog", "Pump Pressure Fault", "Bearing Wear"
- SHRINK: "Heater Failure", "Conveyor Jam", "Humidity Sensor Fault"
- PILLOW: "Seal Heater Failure", "Pressure Drop", "Alignment Error"
- BOXING: "Pneumatic Leak", "Box Jam", "Feed Mechanism Fault"
- FILLING: "Nozzle Clog", "Pump Wear", "Seal Deterioration"
- SHRINK: "Heater Element Degradation", "Temperature Sensor Drift", "Insulation Failure"
- PILLOW: "Seal Heater Wear", "Pressure Regulator Drift", "Jaw Misalignment"
- BOXING: "Pneumatic Seal Wear", "Conveyor Belt Stretch", "Sensor Calibration Drift"
- Click "Request Service" on any machine
- Select specific parts from machine-specific list
- See time estimates for each part (15-70 minutes)
- Get instant confirmation with notification
- Track service progress with real-time updates
- Nozzle Assembly (30 min) - Clean/replace nozzles
- Pump System (45 min) - Service pump and seals
- Fill Volume Sensor (15 min) - Calibrate/clean sensor
- Vibration Sensor (10 min) - Check mounting and calibration
- General Maintenance (60 min) - Full system inspection
- Heating Elements (40 min) - Replace/repair heating elements
- Conveyor Belt (35 min) - Adjust/replace belt
- Temperature Sensor (20 min) - Calibrate temperature sensor
- Humidity Control (25 min) - Service humidity system
- General Maintenance (70 min) - Full system inspection
- Sealing Jaws (50 min) - Replace/align sealing jaws
- Pressure System (30 min) - Service pneumatic system
- Alignment Mechanism (40 min) - Calibrate alignment system
- Temperature Control (25 min) - Service heating system
- General Maintenance (65 min) - Full system inspection
- Pneumatic System (35 min) - Service air compressor and lines
- Conveyor Belt (30 min) - Adjust/replace conveyor
- Box Feed Mechanism (45 min) - Service box handling system
- Pressure Sensors (15 min) - Calibrate pressure sensors
- General Maintenance (60 min) - Full system inspection
- Machine Cards: Live sensor readings with color-coded status
- Clickable Charts: Interactive sensor graphs with threshold indicators
- Status Badges: Visual indicators for Normal/Degrading/Maintenance states
- RUL Display: Remaining Useful Life predictions in hours
- Desktop: Traditional tabs (Watchlist, Event Log)
- Mobile: Dropdown menu with icons for better usability
- Watchlist: Critical failures with specific part information
- Event Log: Real-time system events and maintenance history
- Success Notifications: Green notifications for completed actions
- Error Notifications: Red notifications for failed operations
- Service Confirmations: Detailed service request confirmations
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Main dashboard |
/dashboard |
GET | Interactive dashboard |
/api/latest-states |
GET | Current machine states and predictions |
/api/history |
GET | Historical sensor data with charts |
/api/request-maintenance |
POST | Professional service request |
/api/machine-mgmt/* |
GET/POST | Machine management operations |
SECRET_KEY=your-secret-key
DATABASE_URL=sqlite:///maintenance.db
MODEL_BASE_DIR=./models
SIMULATOR_UPDATE_INTERVAL=1
WINDOW_SIZE=24
ANOMALY_Z_SCORE_THRESHOLD=4.0Add new machine types in app/config/machine_config.py:
MACHINES = {
'YOUR_MACHINE': {
'sensors': ['Sensor1', 'Sensor2', 'Sensor3'],
'failures': ['Failure1', 'Failure2', 'Failure3']
}
}The project includes comprehensive cleanup tools:
# Remove all __pycache__ directories
Get-ChildItem -Path . -Recurse -Directory -Name "__pycache__" | ForEach-Object { Remove-Item -Path $_ -Recurse -Force }
# Or use Python
python -c "import os; [os.system(f'rm -rf {root}/{dir}') for root, dirs, files in os.walk('.') for dir in dirs if dir == '__pycache__']"The project includes a comprehensive .gitignore file that prevents:
__pycache__/directories- Python compiled files (
*.pyc,*.pyo) - Environment files (
.env,venv/) - IDE files (
.vscode/,.idea/) - OS files (
.DS_Store,Thumbs.db) - Database files (
*.db,*.sqlite) - ML model files (
*.h5,*.pkl)
docker build -t maintenance-platform .
docker run -d -p 5000:5000 maintenance-platformexport FLASK_ENV=production
export DATABASE_URL=postgresql://user:pass@localhost/db
python run.py- Debug Mode: Disabled for production (
debug=False) - Connection Pooling: Configured for high-traffic environments
- Model Caching: ML models loaded once and cached
- Database Indexing: Optimized queries for sensor data
The system supports continuous learning from new data:
- Automatic Model Updates: Models retrain on new sensor data
- Failure Pattern Learning: System learns from new failure modes
- Performance Adaptation: Thresholds adjust based on historical data
- Input Validation: All API inputs validated and sanitized
- SQL Injection Protection: SQLAlchemy ORM prevents SQL injection
- CORS Configuration: Properly configured for production
- Error Handling: Comprehensive error handling without information leakage
- Response Time: < 100ms for dashboard updates
- Memory Usage: Optimized for 24/7 operation
- Database Performance: Indexed queries for fast sensor data retrieval
- ML Inference: < 50ms per prediction
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 style guidelines
- Add comprehensive docstrings
- Include unit tests for new features
- Update documentation for API changes
MIT License - see LICENSE file for details.
Server won't start:
# Check if port 5000 is available
netstat -an | findstr :5000
# Kill existing Python processes
taskkill /f /im python.exeDatabase errors:
# Recreate database
rm maintenance.db
python -c "from app import create_app; app = create_app()"ML model errors:
# Recreate basic models
python scripts/create_basic_models.pypycache cleanup:
# Remove all cache directories
Get-ChildItem -Path . -Recurse -Directory -Name "__pycache__" | Remove-Item -Recurse -ForceFor issues and questions:
- Check the troubleshooting section above
- Review the API documentation
- Check the console for error messages
- Ensure all dependencies are installed correctly
Built with β€οΈ for modern manufacturing environments