IndustriSense transforms factory maintenance from reactive firefighting into proactive optimization through real-time monitoring, intelligent anomaly detection, and predictive analytics. Built for modern manufacturing, it provides complete machine health tracking, automated work order management, and maintenance recommendations.
Production-Ready Factory Maintenance Solution
Predict breakdowns, prevent losses with intelligent maintenance management
- π― Features
- ποΈ Architecture
- β‘ Quick Start
- βοΈ Configuration
- π» Usage
- π§ Technical Innovation
- π License
- Real-Time Monitoring: Live machine health tracking with temperature, vibration, and pressure sensors
- Anomaly Detection: Statistical analysis using Isolation Forest algorithms for early failure detection
- Predictive Maintenance: ML-powered health scoring predicts maintenance needs before breakdowns
- Work Order Management: Complete lifecycle tracking from creation to completion with cost analysis
- QR Code Integration: Quick machine identification and reading logging via QR scanning
- Spare Parts Inventory: Automated low-stock alerts and restock management
- AI Assistant: Google Gemini-powered chatbot for maintenance troubleshooting and guidance
- Analytics Dashboard: Comprehensive insights with charts, trends, and performance metrics
- PDF Reports: Automated maintenance reports with reading history and cost analysis
- Role-Based Access: Admin, Supervisor, and Technician roles with appropriate permissions
- Mobile Responsive: Full functionality across desktop, tablet, and mobile devices
flowchart LR
%% Styling
classDef ui fill:#111827,stroke:#374151,stroke-width:1px,color:#F9FAFB;
classDef api fill:#0EA5E9,stroke:#075985,stroke-width:1px,color:#FFFFFF;
classDef core fill:#10B981,stroke:#065F46,stroke-width:1px,color:#FFFFFF;
classDef db fill:#334155,stroke:#0F172A,stroke-width:1px,color:#E2E8F0;
classDef ml fill:#6366F1,stroke:#312E81,stroke-width:1px,color:#EEF2FF;
classDef ext fill:#F59E0B,stroke:#92400E,stroke-width:1px,color:#111827;
%% Client
User[User]:::ui --> UI[Next.js Web UI<br/>Dashboard β’ Machines β’ Analytics]:::ui
%% API Layer
UI -->|HTTP/REST| API[(Django REST API<br/>JWT Auth β’ CRUD β’ Analytics)]:::api
%% Core Services
API --> ME[Machine Engine<br/>Health Status β’ Maintenance Scheduling]:::core
API --> AD[Anomaly Detector<br/>Statistical Analysis β’ Alerts]:::ml
API --> WO[Work Order System<br/>Assignment β’ Tracking β’ Completion]:::core
API --> AI[AI Assistant<br/>Google Gemini β’ Streaming Responses]:::ml
API --> RP[Report Generator<br/>PDF β’ QR Codes β’ Analytics]:::core
%% Machine Learning
AD --> IF[Isolation Forest<br/>Scikit-learn]:::ml
AI --> GEM[Gemini 2.0<br/>Factory Maintenance Expert]:::ext
%% Database
ME --> DB[(PostgreSQL 17<br/>Machines β’ Readings β’ Work Orders)]:::db
AD --> DB
WO --> DB
RP --> DB
%% Authentication
API --> AUTH[JWT Authentication<br/>Simple JWT]:::core
AUTH --> DB
This project demonstrates integration between:
- Django REST Framework for robust backend API with authentication and permissions
- Next.js 16 with React 19 for modern, performant frontend with server-side rendering
- PostgreSQL for reliable relational data storage with complex queries
- Scikit-learn for machine learning-powered anomaly detection and health scoring
- Google Gemini AI for intelligent maintenance assistance and troubleshooting
- ReportLab for automated PDF report generation with charts and tables
- Python 3.11+
- PostgreSQL 17+
- Node.js 18+
- npm or pnpm
- Docker
-
Clone the repository:
git clone https://github.com/AvishkarPatil/IndustriSense.git cd IndustriSense -
Configure environment:
cp .env.docker .env
-
Start all services:
docker-compose up -d
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000/api
- Database: localhost:5432
-
Stop services:
docker-compose down
-
Clone the repository:
git clone https://github.com/AvishkarPatil/IndustriSense.git cd IndustriSense/backend -
Install Python dependencies:
pip install -r requirements.txt
-
Configure database in
.env:DB_NAME=factory_maintenance_db DB_USER=postgres DB_PASSWORD=postgres DB_HOST=localhost DB_PORT=5432 SECRET_KEY=your-secret-key
-
Run migrations:
python manage.py migrate
-
Load sample data:
python load_sample_data.py
-
Start the API server:
python manage.py runserver
API will be available at: http://localhost:8000/api
-
Navigate to frontend directory:
cd ../frontend -
Install dependencies:
npm install
-
Configure API endpoint in
.env.local:NEXT_PUBLIC_API_URL=http://localhost:8000/api NEXT_PUBLIC_GEMINI_API_KEY=your-gemini-api-key
-
Start development server:
npm run dev
Frontend will be available at: http://localhost:3000
Admin:
Username: admin
Password: HueHueHue#69
Supervisor:
Username: supervisor
Password: pass
Technician:
Username: tech
Password: pass
| Variable | Description | Default |
|---|---|---|
| DB_NAME | Database name | factory_maintenance_db |
| DB_USER | Database username | postgres |
| DB_PASSWORD | Database password | postgres |
| DB_HOST | Database hostname | localhost |
| DB_PORT | Database port | 5432 |
| SECRET_KEY | Django secret key | (required) |
| DEBUG | Debug mode | True |
| ALLOWED_HOSTS | Allowed hosts | localhost,127.0.0.1 |
| CORS_ALLOWED_ORIGINS | CORS origins | http://localhost:3000 |
| Variable | Description | Default |
|---|---|---|
| NEXT_PUBLIC_API_URL | Backend API URL | http://localhost:8000/api |
| NEXT_PUBLIC_GEMINI_API_KEY | Google Gemini API key | (required) |
The main dashboard provides:
- Machine Overview: Real-time health status of all machines with color-coded indicators
- Health Distribution: Visual breakdown of machines by health status (Green/Yellow/Red/Critical)
- Work Order Summary: Pending, in-progress, and completed work orders
- Recent Alerts: Latest anomalies and maintenance notifications
- Quick Actions: Fast access to log readings, create work orders, and view analytics
List Machines: View all machines with search, filter, and sort capabilities
GET /api/machines/
Machine Details: Complete machine information with 4 tabs:
- Overview: Basic info, health status, maintenance schedule
- Readings: Historical sensor data with anomaly highlighting
- Work Orders: Associated maintenance tasks and history
- Analytics: Health score trends and predictive insights
Add Machine: Register new equipment with:
- Machine ID, name, type, location
- Installation date, warranty information
- Maintenance frequency and schedule
- Specifications and documentation
QR Code Generation: Automatic QR code creation for quick machine identification
Create Work Order:
- Select machine and assign technician
- Set priority (Low/Medium/High/Critical)
- Schedule maintenance date
- Add description and requirements
Track Progress:
- Start work order (changes machine status to "Under Maintenance")
- Log parts used and labor hours
- Add completion notes and costs
- Complete work order (updates machine maintenance date)
Cost Analysis: Automatic calculation of labor costs, parts costs, and total expenses
The AI chatbot provides:
- Equipment Troubleshooting: Diagnose issues based on symptoms
- Maintenance Guidance: Step-by-step repair instructions
- Error Code Lookup: Explain error codes and solutions
- Best Practices: Maintenance tips and preventive measures
- Parts Information: Identify required spare parts
Access via the floating chat button in the bottom-right corner.
Core Algorithm: Statistical analysis using Isolation Forest with 2-sigma threshold
- Data Collection: Temperature, vibration, oil pressure readings
- Historical Analysis: Compare against 30-day rolling average
- Statistical Validation: Z-score calculation with 2-sigma threshold
- Anomaly Classification: Automatic flagging of outliers
- Alert Generation: Real-time notifications for critical anomalies
Implementation:
# backend/machines/utils.py
def detect_anomaly(machine, new_reading):
recent_readings = machine.readings.filter(
timestamp__gte=timezone.now() - timedelta(days=30),
is_anomaly=False
).order_by('-timestamp')[:50]
# Calculate mean and std for each metric
# Apply 2-sigma threshold
# Return anomaly status and reasonHealth Score Algorithm: ML-powered prediction using Isolation Forest
- Feature Engineering: Extract temperature, vibration, pressure patterns
- Model Training: Isolation Forest with 10% contamination rate
- Score Calculation: Normalize decision function to 0-100 scale
- Trend Analysis: Compare first half vs second half of data
- Prediction: Estimate days until maintenance needed
Health Status Classification:
- Critical (<60): Immediate maintenance required (3 days)
- Warning (60-80): Schedule maintenance soon (7 days)
- Healthy (>80): Normal operation (30 days)
Technology: Google Gemini 2.0 Flash with streaming responses
System Instructions:
You are an expert factory maintenance assistant specializing in:
- Industrial equipment troubleshooting
- Preventive maintenance procedures
- Error code diagnostics
- Spare parts identification
- Safety protocols
Features:
- Real-time streaming responses
- Context-aware conversations
- Factory-specific knowledge base
- No markdown formatting (plain text)
π API Documentation - Complete REST API reference with all endpoints, request/response examples, and authentication details
This project is licensed under the MIT License - see the LICENSE file for details.