An AI-powered maintenance planning system that uses Deep Q-Learning to optimize equipment maintenance scheduling.
- System Overview
- Project Structure
- Architecture
- Installation & Setup
- Data Model
- AI Model
- Key Features
- Usage Guide
- API Reference
- Deployment Instructions
The Maintenance Scheduler is an intelligent system that helps optimize maintenance planning by considering multiple factors including:
- Equipment condition and history
- Current issues and priorities
- Resource availability
- Cost constraints
- Risk factors
The system uses Deep Q-Learning to make optimal maintenance decisions while balancing preventive and corrective maintenance needs.
maintenance-scheduler/
├── data/ # Data files and templates
│ ├── data_dictionary.md # Data field definitions
│ ├── maintenance_schedule.xlsx
│ ├── training_history.csv
│ ├── sample_data/ # Sample datasets
│ └── uploads/ # User uploaded files
├── models/ # ML model implementations
│ ├── dqn_agent.py # Deep Q-Network agent
│ ├── maintenance_env.py # Maintenance environment
│ └── saved/ # Saved model weights
├── tests/ # Test files
├── ui/ # Frontend application
│ └── webapp/ # UI5 web application
├── utils/ # Utility functions
├── server.py # Backend Flask server
├── train.py # Model training script
└── requirements.txt # Python dependencies
The backend provides REST APIs for:
- Issue management
- Schedule generation
- Data export/import
- Model inference
Key endpoints:
POST /api/upload_issues
: Process new maintenance issuesPOST /api/generate_schedule
: Create optimized schedulesGET /api/download_template
: Get issue reporting templateGET /api/download_schedule
: Export maintenance schedules
Web-based interface featuring:
- Issue upload interface
- Schedule visualization
- Template downloads
- Schedule exports
Deep Q-Learning implementation with:
-
State space (8 dimensions):
- Days since maintenance (normalized)
- Equipment age
- Criticality score
- Maintenance cycle completion
- Cost ratio
- Breakdown risk
- Issue priority
- Workload factor
-
Actions:
- Schedule maintenance
- Postpone maintenance
- Clone the repository
- Install Python dependencies:
pip install -r requirements.txt
- Install UI dependencies:
cd ui/webapp
npm install
- Start the backend server:
python server.py
- Start the UI development server:
cd ui/webapp
ui5 serve
- Equipment identification and specifications
- Location and technical details
- Criticality ratings:
- A: Critical (1.0) - Severe impact
- B: Medium (0.6) - Moderate impact
- C: Lower (0.3) - Lesser impact
- Cost and maintenance parameters
- Past maintenance records
- Maintenance types:
- PM01: Regular maintenance
- PM02: Major maintenance
- PM03: Emergency maintenance
- Performance metrics and costs
- Active maintenance notifications
- Priority levels (1-4)
- Issue types:
- PERF: Performance
- ELEC: Electrical
- HYDR: Hydraulic
- MECH: Mechanical
- Impact categories:
- Production Stop
- Performance Degradation
- Quality Impact
- Safety Risk
The DQN agent makes maintenance decisions by considering:
- Equipment condition and age
- Historical maintenance patterns
- Current issues and priorities
- Resource availability
- Cost implications
Risk calculation incorporates:
- Equipment age and criticality
- Maintenance history
- Current issues
- Historical performance
- Cost factors
The model optimizes for:
- Timely maintenance
- Cost efficiency
- Risk minimization
- Resource utilization
- Issue priority handling
- AI-driven maintenance timing
- Risk-based prioritization
- Balanced maintenance approach
- Workload distribution
- Budget management
- Priority-based allocation
- Budget tracking
- Cost estimation
- Optimization for efficiency
- Download the issue template (
/api/download_template
) - Fill in required information:
- Equipment ID
- Issue type
- Priority
- Description
- Upload completed template
- Review generated schedule
- Upload current issues file
- System processes equipment states
- AI model generates recommendations
- Review generated schedule
- Export schedule as Excel file
-
PM01 (Regular)
- Lower priority issues
- Preventive maintenance
- 7-30 days scheduling window
-
PM02 (Major)
- Priority 2 issues
- Mechanical/Electrical issues
- 2-3 days scheduling window
-
PM03 (Emergency)
- Priority 1 issues
- Hydraulic issues
- Next-day maintenance
Upload current issues for processing
Request:
- Method: POST
- Content-Type: multipart/form-data
- Body: CSV file
Response:
{
"equipment_id": "string",
"maintenance_type": "string",
"suggested_date": "string",
"priority": "string",
"confidence": "number",
"breakdown_risk": "number"
}
Download issue reporting template
Response:
- Content-Type: text/csv
- File: current_issues_template.csv
Download generated maintenance schedule
Response:
- Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
- File: maintenance_schedule.xlsx
- Create an account on PythonAnywhere (https://www.pythonanywhere.com)
- Go to the Web tab and create a new web app
- Choose Manual Configuration and Python 3.9
- In the Code section:
- Upload all project files
- Set the working directory to your project root
- Set the WSGI configuration file path to wsgi.py
- Set up a virtual environment and install requirements:
mkvirtualenv maintenance-env --python=/usr/bin/python3.9 pip install -r requirements.txt
- Set up environment variables in the web app configuration:
- FLASK_ENV=production
- DATABASE_URL=(your database URL)
- CORS_ORIGINS=https://[your-github-username].github.io
- Create a new GitHub repository
- Push your code to the repository:
git init git add . git commit -m "Initial commit" git remote add origin https://github.com/[your-username]/maintenance-scheduler.git git push -u origin main
- Enable GitHub Pages:
- Go to repository Settings > Pages
- Select 'gh-pages' branch and '/root' folder
- Save the configuration
The frontend will be available at: https://[your-github-username].github.io/maintenance-scheduler/ The backend will be available at: https://[your-pythonanywhere-username].pythonanywhere.com/
- Clone the repository
- Install backend dependencies:
pip install -r requirements.txt
- Install frontend dependencies:
cd ui/webapp npm install
- Start the development servers:
- Backend:
python server.py
- Frontend:
cd ui/webapp && ui5 serve
- Backend: