feat: 初始化员工缺勤分析系统项目
搭建完整的前后端分离架构,实现数据概览、预测分析、聚类分析等核心功能模块 详细版: feat: 初始化员工缺勤分析系统项目 - 后端:基于 Flask 搭建 RESTful API,包含数据概览、特征分析、预测模型、聚类分析四大模块 - 前端:基于 Vue.js 构建单页应用,实现 Dashboard、预测、聚类、因子分析等页面 - 模型:集成随机森林、XGBoost、LightGBM、Stacking 等多种机器学习模型 - 文档:完成需求规格说明、系统架构设计、接口设计、数据设计、UI原型设计等文档
This commit is contained in:
90
backend/api/overview_routes.py
Normal file
90
backend/api/overview_routes.py
Normal file
@@ -0,0 +1,90 @@
|
||||
from flask import Blueprint, jsonify
|
||||
|
||||
from services.data_service import data_service
|
||||
|
||||
overview_bp = Blueprint('overview', __name__, url_prefix='/api/overview')
|
||||
|
||||
|
||||
@overview_bp.route('/stats', methods=['GET'])
|
||||
def get_stats():
|
||||
try:
|
||||
stats = data_service.get_basic_stats()
|
||||
return jsonify({
|
||||
'code': 200,
|
||||
'message': 'success',
|
||||
'data': stats
|
||||
})
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
'code': 500,
|
||||
'message': str(e),
|
||||
'data': None
|
||||
}), 500
|
||||
|
||||
|
||||
@overview_bp.route('/trend', methods=['GET'])
|
||||
def get_trend():
|
||||
try:
|
||||
trend = data_service.get_monthly_trend()
|
||||
return jsonify({
|
||||
'code': 200,
|
||||
'message': 'success',
|
||||
'data': trend
|
||||
})
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
'code': 500,
|
||||
'message': str(e),
|
||||
'data': None
|
||||
}), 500
|
||||
|
||||
|
||||
@overview_bp.route('/weekday', methods=['GET'])
|
||||
def get_weekday():
|
||||
try:
|
||||
weekday = data_service.get_weekday_distribution()
|
||||
return jsonify({
|
||||
'code': 200,
|
||||
'message': 'success',
|
||||
'data': weekday
|
||||
})
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
'code': 500,
|
||||
'message': str(e),
|
||||
'data': None
|
||||
}), 500
|
||||
|
||||
|
||||
@overview_bp.route('/reasons', methods=['GET'])
|
||||
def get_reasons():
|
||||
try:
|
||||
reasons = data_service.get_reason_distribution()
|
||||
return jsonify({
|
||||
'code': 200,
|
||||
'message': 'success',
|
||||
'data': reasons
|
||||
})
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
'code': 500,
|
||||
'message': str(e),
|
||||
'data': None
|
||||
}), 500
|
||||
|
||||
|
||||
@overview_bp.route('/seasons', methods=['GET'])
|
||||
def get_seasons():
|
||||
try:
|
||||
seasons = data_service.get_season_distribution()
|
||||
return jsonify({
|
||||
'code': 200,
|
||||
'message': 'success',
|
||||
'data': seasons
|
||||
})
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
'code': 500,
|
||||
'message': str(e),
|
||||
'data': None
|
||||
}), 500
|
||||
Reference in New Issue
Block a user