How vanshcloud/predictive-maintenance-genai works
This is a predictive-maintenance product: sensor data is validated and transformed into time windows, an LSTM estimates 24-hour failure risk, and a report layer explains predictions as technician-facing maintenance guidance. Users reach predictions and reports through the REST API or dashboard. The README documents the training/data pipeline and dashboard capabilities; source excerpts show API startup, inference preprocessing, and report generation. Some subsystem links rely on README statements or the source index rather than inspected implementations.
Main entry points: main.py API Application · service.py Shared Service State · predictor.py Failure Predictor · predict.py Prediction Routes
Components 22
Telemetry and Features
- Sensor Tables
- Data Ingestion
src/data/ingestion.py - Data Validation
src/data/validation.py - Feature Pipeline
src/data/preprocessing.py
Model and Inference
- Model Trainer
src/models/trainer.py - LSTM Model
src/models/lstm_model.py - Model Evaluation
src/models/evaluator.py - Failure Predictor
src/prediction/predictor.py
Service API
- API Application
src/api/main.py - Shared Service State
src/api/service.py - Request Schemas
src/api/schemas.py - Prediction Routes
src/api/routes/predict.py - Machine Routes
src/api/routes/machines.py - Health Routes
src/api/routes/health.py - Report Routes
src/api/routes/reports.py
Maintenance Guidance
- Report Generator
src/genai/chains.py - Grounded Prompts
src/genai/prompts.py
Technician Dashboard
- Dashboard
dashboard/app.py - API Client
dashboard/api_client.py - Risk Display
dashboard/risk.py
Other components
- Technician
- LLM Provider
Connections 28
- Technician → Dashboard: views risk
README.md - Dashboard → API Client: uses client
dashboard/app.py - Dashboard → Risk Display: renders risk
dashboard/app.py - API Client → API Application: calls REST API
README.md - Technician → API Application: requests predictions
README.md - API Application → Health Routes: registers route
src/api/main.py - API Application → Machine Routes: registers route
src/api/main.py - API Application → Prediction Routes: registers route
src/api/main.py - API Application → Report Routes: registers route
src/api/main.py - API Application → Shared Service State: starts state
src/api/main.py - Prediction Routes → Request Schemas: validates requests
src/api/routes/predict.py - Prediction Routes → Shared Service State: requests scoring
src/api/routes/predict.py - Machine Routes → Shared Service State: requests machine data
src/api/routes/machines.py - Health Routes → Shared Service State: checks readiness
src/api/routes/health.py - Report Routes → Shared Service State: gets prediction
src/api/routes/reports.py - Report Routes → Report Generator: generates report
src/api/routes/reports.py - Shared Service State → Failure Predictor: scores machines
src/api/service.py - Shared Service State → Data Validation: validates data
src/api/service.py - Sensor Tables → Data Ingestion: supplies tables
src/data/ingestion.py - Data Ingestion → Data Validation: loads for checks
- Data Validation → Feature Pipeline: validates before features
- Feature Pipeline → Model Trainer: builds training features
README.md - Model Trainer → LSTM Model: trains model
src/models/trainer.py - Model Evaluation → LSTM Model: evaluates model
src/models/evaluator.py - Failure Predictor → Feature Pipeline: reuses features
src/prediction/predictor.py - Failure Predictor → LSTM Model: scores windows
src/prediction/predictor.py - Report Generator → Grounded Prompts: formats context
src/genai/chains.py - Report Generator → LLM Provider: invokes model
src/genai/chains.py