Skip to main content

enterprise-user-management-system-ai-analytics

Full-stack user management system with AI-powered analytics for risk detection, burnout analysis, and predictive insights

설치로 이동

소스 정보

저장소
reason-machines/data-skills
최근 소스 활동
2026년 7월 13일 04:45
감지된 SKILL.md 언어
영어
스타
5
포크
1

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
enterprise-user-management-system-ai-analytics
description
Full-stack user management system with AI-powered analytics for risk detection, burnout analysis, and predictive insights
triggers
["set up enterprise user management system","integrate AI analytics into user management","implement JWT authentication for user management","create admin dashboard with user analytics","add AI-based ticket classification system","build kanban board for task management","detect user burnout with ML models","implement role-based access control with AI"]
# Enterprise User Management System with AI Analytics > Skill by [ara.so](https://ara.so) — Data Skills collection. ## Overview Enterprise User Management System with AI Analytics is a full-stack application that combines user management, task tracking, and support ticket systems with AI-powered insights. It provides risk detection, anomaly detection, burnout analysis, and predictive project insights using machine learning models built with FastAPI, scikit-learn, and River. The system consists of three main components: - **Frontend**: React.js application with user/admin dashboards - **Backend**: Node.js REST API with MongoDB and JWT authentication - **ML Service**: FastAPI service for AI/ML predictions and analytics ## Installation ### Clone and Setup ```bash git clone https://github.com/Nareshkumar2583/Enterprise-User-Management-System-with-AI-Analytics.git cd Enterprise-User-Management-System-with-AI-Analytics ``` ### Backend Setup ```bash cd backend npm install # Create .env file cat > .env << EOF PORT=5000 MONGODB_URI=${MONGODB_URI} JWT_SECRET=${JWT_SECRET} JWT_EXPIRE=7d ML_SERVICE_URL=http://localhost:8000 EOF npm start ``` ### ML Service Setup ```bash cd ml-service pip install -r requirements.txt # Create .env file cat > .env << EOF MONGODB_URI=${MONGODB_URI} MODEL_PATH=./models LOG_LEVEL=INFO EOF uvicorn main:app --reload --port 8000 ``` ### Frontend Setup ```bash cd frontend npm install # Create .env file cat > .env << EOF REACT_APP_API_URL=http://localhost:5000 REACT_APP_ML_API_URL=http://localhost:8000 EOF npm start ``` ## Core Architecture ### Backend API Structure (Node.js) ```javascript // server.js - Main entry point const express = require('express'); const mongoose = require('mongoose'); const cors = require('cors'); const jwt = require('jsonwebtoken'); require('dotenv').config(); const app = express(); app.use(cors()); app.use(express.json()); // Connect to MongoDB mongoose.connect(process.env.MONGODB_URI, { useNewUrlParser: true, useUnifiedTopology: true }).then(() => console.log('MongoDB Connected')) .catch(err => console.error('MongoDB connection error:', err)); // Routes app.use('/api/auth', require('./routes/auth')); app.use('/api/users', require('./routes/users')); app.use('/api/tasks', require('./routes/tasks')); app.use('/api/tickets', require('./routes/tickets')); app.use('/api/analytics', require('./routes/analytics')); const PORT = process.env.PORT || 5000; app.listen(PORT, () => console.log(`Server running on port ${PORT}`)); ``` ### Authentication Middleware ```javascript // middleware/auth.js const jwt = require('jsonwebtoken'); module.exports = function(req, res, next) { const token = req.header('x-auth-token'); if (!token) { return res.status(401).json({ msg: 'No token, authorization denied' }); } try { const decoded = jwt.verify(token, process.env.JWT_SECRET); req.user = decoded.user; next(); } catch (err) { res.status(401).json({ msg: 'Token is not valid' }); } }; // middleware/admin.js module.exports = function(req, res, next) { if (req.user.role !== 'admin') { return res.status(403).json({ msg: 'Access denied. Admin only.' }); } next(); }; ``` ### User Model ```javascript // models/User.js const mongoose = require('mongoose'); const UserSchema = new mongoose.Schema({ name: { type: String, required: true }, email: { type: String, required: true, unique: true }, password: { type: String, required: true }, role: { type: String, enum: ['user', 'admin', 'manager'], default: 'user' }, department: String, status: { type: String, enum: ['active', 'inactive', 'suspended'], default: 'active' }, tasksAssigned: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Task' }], workloadScore: { type: Number, default: 0 }, createdAt: { type: Date, default: Date.now } }); module.exports = mongoose.model('User', UserSchema); ``` ### Task Model ```javascript // models/Task.js const mongoose = require('mongoose'); const TaskSchema = new mongoose.Schema({ title: { type: String, required: true }, description: String, assignedTo: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, status: { type: String, enum: ['todo', 'in-progress', 'done'], default: 'todo' }, priority: { type: String, enum: ['low', 'medium', 'high', 'critical'], default: 'medium' }, dueDate: Date, timeTracked: { type: Number, default: 0 }, createdBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, createdAt: { type: Date, default: Date.now }, completedAt: Date }); module.exports = mongoose.model('Task', TaskSchema); ``` ### Ticket Model ```javascript // models/Ticket.js const mongoose = require('mongoose'); const TicketSchema = new mongoose.Schema({ title: { type: String, required: true }, description: { type: String, required: true }, category: { type: String, enum: ['technical', 'administrative', 'hr', 'other'] }, priority: { type: String, enum: ['low', 'medium', 'high', 'critical'] }, status: { type: String, enum: ['open', 'in-progress', 'resolved', 'closed'], default: 'open' }, createdBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, assignedTo: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, aiClassified: { type: Boolean, default: false }, createdAt: { type: Date, default: Date.now } }); module.exports = mongoose.model('Ticket', TicketSchema); ``` ## ML Service API ### FastAPI Main Application ```python # ml-service/main.py from fastapi import FastAPI, HTTPException from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from typing import List, Optional import numpy as np from sklearn.ensemble import RandomForestClassifier, IsolationForest from river import linear_model, metrics import joblib import os app = FastAPI(title="Enterprise AI Analytics Service") app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Load or initialize models MODEL_PATH = os.getenv('MODEL_PATH', './models') os.makedirs(MODEL_PATH, exist_ok=True) # Risk detection model risk_model = RandomForestClassifier(n_estimators=100, random_state=42) # Anomaly detection model anomaly_model = IsolationForest(contamination=0.1, random_state=42) # Online learning model for burnout detection burnout_model = linear_model.LogisticRegression() class UserBehavior(BaseModel): user_id: str login_frequency: float task_completion_rate: float average_task_time: float missed_deadlines: int workload_score: float overtime_hours: float class TicketData(BaseModel): title: str description: str class PredictionResponse(BaseModel): prediction: str confidence: float risk_score: Optional[float] = None @app.get("/") def read_root(): return {"status": "AI Analytics Service Running"} @app.post("/api/ml/risk-detection", response_model=PredictionResponse) async def detect_risk(data: UserBehavior): """Predict user risk level based on behavior patterns""" try: features = np.array([[ data.login_frequency, data.task_completion_rate, data.average_task_time, data.missed_deadlines, data.workload_score, data.overtime_hours ]]) # Simple rule-based risk scoring risk_score = ( (1 - data.task_completion_rate) * 30 + data.missed_deadlines * 15 + (data.workload_score / 10) * 25 + (data.overtime_hours / 40) * 30 ) if risk_score > 70: prediction = "high" elif risk_score > 40: prediction = "medium" else: prediction = "low" confidence = min(abs(risk_score - 50) / 50, 1.0) return PredictionResponse( prediction=prediction, confidence=confidence, risk_score=risk_score ) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) @app.post("/api/ml/anomaly-detection") async def detect_anomaly(data: UserBehavior): """Detect anomalous user behavior""" try: features = np.array([[ data.login_frequency, data.task_completion_rate, data.average_task_time, data.missed_deadlines, data.workload_score, data.overtime_hours ]]) # Check for anomalies is_anomaly = ( data.login_frequency > 50 or data.login_frequency < 1 or data.task_completion_rate < 0.3 or data.overtime_hours > 60 or data.missed_deadlines > 5 ) return { "is_anomaly": is_anomaly, "anomaly_score": float(data.workload_score) if is_anomaly else 0.0, "factors": { "unusual_login": data.login_frequency > 50, "low_completion": data.task_completion_rate < 0.3, "excessive_overtime": data.overtime_hours > 60, "many_missed_deadlines": data.missed_deadlines > 5 } } except Exception as e: raise HTTPException(status_code=500, detail=str(e)) @app.post("/api/ml/burnout-detection", response_model=PredictionResponse) async def detect_burnout(data: UserBehavior): """Detect employee burnout risk""" try: burnout_score = ( (data.workload_score / 10) * 35 + (data.overtime_hours / 40) * 30 + (1 - data.task_completion_rate) * 20 + (data.missed_deadlines / 10) * 15 ) if burnout_score > 70: prediction = "high_risk" recommendation = "Immediate workload reduction recommended" elif burnout_score > 45: prediction = "moderate_risk" recommendation = "Monitor closely and consider workload adjustment" else: prediction = "low_risk" recommendation = "Normal workload management" return PredictionResponse( prediction=prediction, confidence=min(burnout_score / 100, 1.0), risk_score=burnout_score ) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) @app.post("/api/ml/classify-ticket") async def classify_ticket(ticket: TicketData): """Classify and route support tickets using AI""" try: text = f"{ticket.title} {ticket.description}".lower() # Simple keyword-based classification if any(word in text for word in ['bug', 'error', 'crash', 'not working']): category = 'technical' priority = 'high'
GitHub에서 보기
이 SKILL.md는 매우 커서 SkillsMP가 여기에는 첫 섹션만 미리 보여줍니다. GitHub에서 보기