How adityapotdar23/predictive-maintenance works
Project type and purpose
• This is a full-stack predictive-maintenance web application (“AI Kavach”) that combines:
• A React.js frontend
• A Python Flask microservice (app.py) hosting the ML model (XGBoost, Random Forest, etc.)
• A Node.js/Express backend for authentication, user/feedback data handling, and alerts
• A MongoDB database
• External integration with the Telegram API
File structure
• Top-level:
• app.py, merged.csv, xgb.pkl → Flask service + serialized ML model + raw dataset
• backend/ (Node.js microservice)
• app.js, auth.js, index.js → Express routes for login/register, feedback, scheduling
• db/ → connection logic (dbConnect.js) and Mongoose models (userModel.js, questionModel.js)
• frontend/ (React SPA)
• public/ → static assets and index.html
• src/ → React components (Login, Register, Dashboard, Charts, Calendar, Feedback, Reports, Sidebar, etc.)
• Uses Tailwind CSS + Chart.js for styling and data visualization
README
• Confirms architecture: React frontend, Flask API, Node.js API, MongoDB, Telegram notifications
• Key features: real-time sensor data visualization, RUL (Remaining Useful Life) prediction, calendar scheduling, alerts
Main components & interactions
a. Components:
1. React Frontend (frontend/src)
2. Flask ML Service (app.py + xgb.pkl)
3. Node.js/Express Service (backend/app.js, auth.js, index.js)
4. MongoDB (backend/db)
5. Telegram API (external)
b. Relationships:
• Frontend ↔ Node.js API: user authentication, profile, feedback, scheduling (HTTP/REST)
• Frontend ↔ Flask API: sensor data push & RUL prediction (HTTP/REST)
• Node.js API ↔ MongoDB: persistent storage of users, feedback, reports, schedule entries
• Node.js API ↔ Telegram API: send alerts/notifications
• Flask API reads merged.csv if needed for batch jobs, loads xgb.pkl for predictions
c. Architectural patterns & principles:
• Microservices: separate ML logic (Flask) from business/auth logic (Node.js)
• SPA (Single-Page Application) for responsive UI
• RESTful APIs for clear separation of concerns
• MVC pattern in Node.js (models in backend/db, controllers in auth.js/app.js)
d. Key technologies/libraries:
• Frontend: React.js, Tailwind CSS, React Chart.js
• Flask: pandas (for merged.csv), scikit-learn / xgboost
• Node.js: Express, Mongoose, dotenv
• Database: MongoDB
• External: Telegram Bot API