- 后端新增 JD-R(工作要求-资源)理论维度数据生成,包含工作要求、工作资源、
个人资源、中介变量共 16 个新特征列
- 新增 JD-R 分析服务与 API(维度统计、倦怠投入分析、双路径中介分析、
分组轮廓、风险分布)
- 新增 SHAP 可解释性分析模块(全局重要性、局部解释、特征交互、依赖图)
- 预测服务增加风险分类模型加载与概率预测能力
- 前端新增 JD-R 分析页面(JDRAnalysis.vue),含雷达图、散点图、路径分析等可视化
- 预测页面增加风险概率展示与 SHAP 特征解释
- 路由与导航菜单同步更新
82 lines
2.3 KiB
Python
82 lines
2.3 KiB
Python
from flask import Flask
|
|
from flask_cors import CORS
|
|
|
|
from api import register_blueprints
|
|
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
|
|
CORS(app)
|
|
|
|
register_blueprints(app)
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return {
|
|
'code': 200,
|
|
'message': 'China Enterprise Absence Analysis System API',
|
|
'data': {
|
|
'version': '1.0.0',
|
|
'endpoints': {
|
|
'overview': [
|
|
'/api/overview/stats',
|
|
'/api/overview/trend',
|
|
'/api/overview/weekday',
|
|
'/api/overview/reasons',
|
|
'/api/overview/seasons'
|
|
],
|
|
'analysis': [
|
|
'/api/analysis/importance',
|
|
'/api/analysis/correlation',
|
|
'/api/analysis/compare'
|
|
],
|
|
'predict': [
|
|
'/api/predict/single',
|
|
'/api/predict/model-info'
|
|
],
|
|
'cluster': [
|
|
'/api/cluster/result',
|
|
'/api/cluster/profile',
|
|
'/api/cluster/scatter'
|
|
],
|
|
'jdr': [
|
|
'/api/jdr/dimensions',
|
|
'/api/jdr/burnout-engagement',
|
|
'/api/jdr/path-analysis',
|
|
'/api/jdr/profile',
|
|
'/api/jdr/risk-distribution'
|
|
],
|
|
'shap': [
|
|
'/api/shap/global',
|
|
'/api/shap/local',
|
|
'/api/shap/interaction',
|
|
'/api/shap/dependence'
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
@app.errorhandler(404)
|
|
def not_found(e):
|
|
return {
|
|
'code': 404,
|
|
'message': 'Resource not found',
|
|
'data': None
|
|
}, 404
|
|
|
|
@app.errorhandler(500)
|
|
def server_error(e):
|
|
return {
|
|
'code': 500,
|
|
'message': 'Internal server error',
|
|
'data': None
|
|
}, 500
|
|
|
|
return app
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = create_app()
|
|
app.run(host='0.0.0.0', port=5000, debug=True)
|