{"id":26954513,"url":"https://github.com/midascreed-cic/ai-predictive-maintenance-hydro","last_synced_at":"2026-04-01T22:02:22.819Z","repository":{"id":284375628,"uuid":"954580309","full_name":"midascreed-cic/AI-Predictive-Maintenance-Hydro","owner":"midascreed-cic","description":"AI-Predictive-Maintenance-Hydro is a full-stack project that simulates sensor data for hydro station maintenance, leveraging AI to detect faults early, optimize operations, and reduce downtime.","archived":false,"fork":false,"pushed_at":"2025-04-02T08:48:54.000Z","size":2222,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-03T02:17:27.541Z","etag":null,"topics":["cursorai","docker","git","grafana","influxdb2","kubernetes","linux","nodered-nodes","python","random-forest","react"],"latest_commit_sha":null,"homepage":"https://v0-midas-site.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/midascreed-cic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-25T09:52:11.000Z","updated_at":"2025-04-02T08:48:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"d29b55c3-7747-4396-b1b8-d0dd0f5c937d","html_url":"https://github.com/midascreed-cic/AI-Predictive-Maintenance-Hydro","commit_stats":null,"previous_names":["midasceed-cic/ai-predictive-maintenance-hydro","midascreed-cic/ai-predictive-maintenance-hydro"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midascreed-cic%2FAI-Predictive-Maintenance-Hydro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midascreed-cic%2FAI-Predictive-Maintenance-Hydro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midascreed-cic%2FAI-Predictive-Maintenance-Hydro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midascreed-cic%2FAI-Predictive-Maintenance-Hydro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/midascreed-cic","download_url":"https://codeload.github.com/midascreed-cic/AI-Predictive-Maintenance-Hydro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922243,"owners_count":20855345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cursorai","docker","git","grafana","influxdb2","kubernetes","linux","nodered-nodes","python","random-forest","react"],"created_at":"2025-04-03T02:17:41.459Z","updated_at":"2025-12-30T19:03:37.051Z","avatar_url":"https://github.com/midascreed-cic.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI-Predictive-Maintenance-Hydro\n\n## Project Overview\nAI-Predictive-Maintenance-Hydro is an end-to-end industrial IoT solution designed for predictive maintenance in hydroelectric power stations. The system simulates SCADA sensor data, processes it through a robust data pipeline, and provides real-time monitoring and predictive analytics through Grafana dashboards.\n\n### Key Capabilities\n- Real-time sensor data simulation and monitoring\n- Predictive maintenance using machine learning\n- Automated anomaly detection\n- Performance optimization recommendations\n- Cost reduction through preventive maintenance\n- Historical data analysis and trend prediction\n\n### System Architecture\nThe project implements a modern microservices architecture:\n1. **Data Generation Layer**: Python-based sensor simulation\n2. **Data Processing Layer**: Node-RED for data transformation and routing\n3. **Storage Layer**: InfluxDB for time-series data management\n4. **Visualization Layer**: Grafana for data visualization and monitoring\n5. **Integration Layer**: Proposed Next.js frontend for enhanced dashboard access\n\n## 1. Prerequisites\nTo successfully deploy and run this project, ensure you have the following tools installed:\n\n- **Docker**: For containerizing and running services\n- **WSL (Windows Subsystem for Linux)**: A Linux environment on Windows\n- **Python 3.8+**: For simulating sensor data and preprocessing\n- **Node.js 18+**: For the proposed frontend (optional)\n- **pnpm**: A fast package manager for JavaScript projects (optional)\n\nNote: Grafana, InfluxDB, and Node-RED are not prerequisites as they are provided as Docker containers.\n\n## 2. Project Structure\n```\n.\n├── frontend/              # Proposed Next.js web interface (under development)\n│   ├── app/              # Next.js pages and API routes\n│   ├── components/       # Reusable React components\n│   ├── hooks/            # Custom React hooks\n│   ├── lib/              # Utility functions\n│   ├── public/           # Static assets\n│   ├── styles/           # Global styles\n│   └── next.config.js    # Next.js configuration file\n│\n├── python_scripts/       # Sensor simulation scripts\n│   ├── simulate_sensors.py    # Main simulation script\n│   ├── data_preprocessing.py  # Data preprocessing utilities\n│   └── model_training.py      # AI model training script\n│\n├── node_red/             # Node-RED flows and configurations\n│   ├── flows.json        # Node-RED flow definitions\n│   └── function_nodes/   # Custom function nodes\n│\n├── config/               # Service configurations and environment variables\n│   ├── mosquitto.conf    # MQTT broker configuration\n│   ├── influxdb.conf     # InfluxDB configuration\n│   └── grafana/          # Grafana dashboard configurations\n│\n├── docker/               # Docker-related files and instructions\n├── requirements/         # Python dependency files\n├── data/                 # Persistent data storage\n│   ├── influxdb/         # InfluxDB time-series data\n│   ├── mosquitto/        # MQTT broker data\n│   └── grafana/          # Grafana dashboards and data\n│\n├── logs/                 # Application and error logs\n├── docker-compose.yml    # Docker services configuration\n└── predictive_maintenance.csv  # AI model training dataset\n```\n\n## 3. Setting Up the Environment\n\n### Core Services Setup\n1. **Start Core Services with Docker Compose:**\n   ```bash\n   docker-compose up -d\n   ```\n   This will start the following services:\n   - **MQTT Broker (Mosquitto)** on port 1883 (for message queuing)\n   - **InfluxDB** on port 8086 (for time-series data storage)\n   - **Node-RED** on port 1880 (for data processing)\n   - **Grafana** on port 3000 (primary visualization platform)\n\n2. **Configure Core Services:**\n\n   a. **InfluxDB Setup:**\n   - Access InfluxDB UI at `http://localhost:8086`\n   - Login with default credentials (admin/admin123)\n   - Create a new bucket named \"hydro_data\"\n   - Generate an API token for Node-RED integration\n   - Configure data retention policies\n   - Set up data explorer queries for sensor data\n   - Configure data downsampling for long-term storage\n   - Set up continuous queries for data aggregation\n\n   b. **Node-RED Configuration:**\n   - Access Node-RED UI at `http://localhost:1880`\n   - Import the provided flows from `node_red/flows.json`\n   - Configure MQTT nodes to subscribe to sensor topics\n   - Set up InfluxDB output nodes with your API token\n   - Configure function nodes for data transformation\n   - Set up debug nodes for monitoring data flow\n   - Configure error handling and retry mechanisms\n   - Set up data validation and cleaning nodes\n\n   c. **Grafana Setup:**\n   - Access Grafana at `http://localhost:3000`\n   - Login with default credentials (admin/admin123)\n   - Add InfluxDB as a data source\n   - Import dashboards from `data/grafana`\n   - Configure alert rules for predictive maintenance\n   - Set up user authentication and permissions\n   - Configure dashboard variables and templates\n   - Set up notification channels for alerts\n\n3. **Set Up Python Environment for Sensor Simulation:**\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # On Windows: .\\venv\\Scripts\\activate\n   pip install -r requirements/requirements.txt\n   ```\n\n4. **Run the Sensor Simulation Script:**\n   ```bash\n   python python_scripts/simulate_sensors.py\n   ```\n   This script simulates SCADA system sensor data including:\n   - Temperature readings (°C)\n   - Pressure measurements (bar)\n   - Vibration levels (mm/s)\n   - Flow rates (m³/s)\n   - Power output (MW)\n   - Equipment status (operational/standby/maintenance)\n   - Water level (m)\n   - Turbine efficiency (%)\n   - Generator voltage (kV)\n   - Oil temperature (°C)\n\n   Note: The Kaggle dataset (`predictive_maintenance.csv`) is optional and can be used for training the AI model, but the simulation script provides real-time data for testing and development.\n\n### AI Model Integration\nThe project implements a comprehensive predictive maintenance model that can be trained using either:\n1. **Simulated Data**: Real-time sensor data from the simulation script\n2. **Historical Data**: The provided Kaggle dataset\n\n#### Model Architecture\n- **Input Layer**: Time-series sensor data\n- **Processing Layer**: \n  - LSTM for temporal pattern recognition\n  - Random Forest for feature importance\n  - Isolation Forest for anomaly detection\n- **Output Layer**: \n  - Failure probability prediction\n  - Maintenance recommendations\n  - Performance degradation metrics\n\n#### Model Features\n- Time-series forecasting\n- Pattern recognition\n- Threshold-based alerts\n- Confidence scoring\n- Automated retraining\n- Feature importance analysis\n- Anomaly detection\n- Maintenance scheduling optimization\n\n#### Model Training\n```python\n# Example of model training configuration\nmodel_config = {\n    'lstm_layers': [64, 32],\n    'forecast_horizon': 24,  # hours\n    'confidence_threshold': 0.85,\n    'retraining_interval': '1d',\n    'features': [\n        'temperature',\n        'pressure',\n        'vibration',\n        'flow_rate',\n        'power_output'\n    ]\n}\n```\n\n### Optional: Frontend Setup (Under Development)\nThe frontend is designed to integrate with Grafana dashboards, providing:\n- Custom navigation and layout\n- User authentication and authorization\n- Additional UI components and interactions\n- Mobile-responsive design\n\n#### Grafana Integration Methods:\n1. **Iframe Embedding:**\n   ```javascript\n   // Example of embedding Grafana dashboard\n   \u003ciframe\n     src=\"http://localhost:3000/d/your-dashboard-id\"\n     width=\"100%\"\n     height=\"600px\"\n     frameBorder=\"0\"\n     allowFullScreen\n   /\u003e\n   ```\n\n2. **Grafana API Integration:**\n```javascript\n   // Example of fetching dashboard data\n   const fetchDashboardData = async () =\u003e {\n     const response = await fetch('http://localhost:3000/api/dashboards/db/your-dashboard-id', {\n       headers: {\n         'Authorization': `Bearer ${GRAFANA_API_KEY}`\n       }\n     });\n     return response.json();\n   };\n   ```\n\n3. **Custom Dashboard Components:**\n   - Create wrapper components for Grafana panels\n   - Implement custom navigation\n   - Add additional UI elements\n\nTo set up the frontend (optional):\n1. **Navigate to the Frontend Directory:**\n   ```bash\n   cd frontend\n   ```\n\n2. **Install Dependencies:**\n   ```bash\n   pnpm install\n   ```\n\n3. **Configure Environment Variables:**\n   ```env\n   NEXT_PUBLIC_GRAFANA_URL=http://localhost:3000\n   NEXT_PUBLIC_GRAFANA_API_KEY=your_api_key\n   ```\n\n4. **Run the Development Server:**\n   ```bash\n   pnpm dev\n   ```\n\nNote: The frontend is still in development and not required for the core functionality of the system.\n\n## 4. Features\n\n### Core System\n- **Sensor Data Simulation:** Python scripts generate realistic data streams\n- **Message Brokering:** Mosquitto MQTT handles communication between services\n- **Time-Series Database:** InfluxDB stores and manages sensor data\n- **Node-RED Workflows:** For efficient data routing and processing\n- **Grafana Dashboards:** Primary visualization platform with:\n  - Real-time sensor data monitoring\n  - Historical data analysis\n  - Custom alerts and notifications\n  - Predictive maintenance insights\n  - Mobile-responsive dashboards\n  - Automated report generation\n  - Custom plugin integration\n  - Role-based access control\n\n### Proposed Frontend (Under Development)\n- **Grafana Integration:** Seamless embedding of Grafana dashboards\n- **Modern UI:** Built with Next.js 15 and Tailwind CSS\n- **Type Safety:** Ensures code quality with TypeScript\n- **Dark Mode Support:** Seamless theme toggling\n- **Custom Navigation:** Enhanced user experience for dashboard navigation\n- **User Management:** Role-based access control\n- **API Integration:** RESTful endpoints for data access\n- **Real-time Updates:** WebSocket integration for live data\n\n## 5. Data Flow\n\nThe system follows a streamlined data flow for predictive maintenance:\n\n1. **Sensor Data Simulation:** Python scripts simulate hydro station sensor readings\n2. **Data Ingestion:** Mosquitto MQTT broker collects and forwards data\n3. **Processing:** Node-RED processes and routes data to InfluxDB\n4. **Storage:** InfluxDB manages time-series data for efficient querying\n5. **Visualization:** Grafana provides primary visualization through dashboards\n6. **AI Predictions:** Predictive maintenance models forecast potential equipment failures\n7. **Frontend Integration:** (Under Development) Next.js interface for enhanced Grafana dashboard access\n\n## 6. Technologies Used\n\n### Core Services\n- **Data Processing:** Node-RED\n- **Time-Series Database:** InfluxDB v2.6\n- **Message Broker:** Mosquitto MQTT v2.0.15\n- **Visualization:** Grafana v10.0.0\n\n### Data Simulation\n- **Language:** Python 3.8+\n- **Libraries:** \n  - Pandas for data manipulation\n  - NumPy for numerical operations\n  - Paho-MQTT for MQTT communication\n  - Scikit-learn for machine learning\n\n### Containerization\n- **Platform:** Docker\n- **Orchestration:** Docker Compose\n- **Networking:** Custom bridge network\n\n### Proposed Frontend\n- **Framework:** Next.js 15\n- **UI Library:** React 19\n- **Styling:** Tailwind CSS\n- **Type System:** TypeScript\n- **State Management:** React Hooks\n- **API Client:** Axios/Fetch\n\n### Development Tools\n- **Package Manager:** pnpm\n- **Linting:** ESLint\n- **CSS Processing:** PostCSS\n- **Version Control:** Git\n- **CI/CD:** GitHub Actions (planned)\n\n## 7. Deployment\n\nFor production deployment, consider using DigitalOcean, AWS, or Azure for hosting the Docker containers. Follow these steps for deployment:\n\n1. **Deploy Core Services:**\n   ```bash\n   docker-compose up -d\n   ```\n\n2. **Configure Grafana:**\n   - Set up authentication\n   - Import dashboards\n   - Configure data sources\n   - Set up alerts\n\n3. **Optional: Deploy Frontend (When Ready)**\n   ```bash\n   cd frontend\n   pnpm build\n   pnpm start\n   ```\n\nNote: The frontend deployment is optional and can be added once development is complete.\n\n## 8. Contact\nFor assistance or inquiries, contact Us\n\n## 9. Acknowledgments\n- Special thanks to the open-source community for invaluable resources\n- Gratitude to Kaggle for the predictive maintenance dataset\n- Appreciation to all contributors and maintainers of the open-source tools used in this project\n- Recognition to the industrial IoT community for best practices and standards\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidascreed-cic%2Fai-predictive-maintenance-hydro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidascreed-cic%2Fai-predictive-maintenance-hydro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidascreed-cic%2Fai-predictive-maintenance-hydro/lists"}