68 lines
3.4 KiB
Python
68 lines
3.4 KiB
Python
|
from sqlalchemy.orm import Session
|
||
|
from database import SessionLocal, engine, Base
|
||
|
import models
|
||
|
import crud
|
||
|
|
||
|
def init_dimensions():
|
||
|
# 创建会话
|
||
|
db = SessionLocal()
|
||
|
try:
|
||
|
# 检查是否已经存在维度数据
|
||
|
existing_dimensions = db.query(models.Dimension).count()
|
||
|
|
||
|
if existing_dimensions == 0:
|
||
|
print("初始化维度数据...")
|
||
|
|
||
|
# 教师科研人才评估维度
|
||
|
talent_dimensions = [
|
||
|
{"name": "教育和工作经历", "weight": 10, "category": "talent", "description": "教育背景和工作经历评估"},
|
||
|
{"name": "研究方向前沿性", "weight": 8, "category": "talent", "description": "研究是否处于学科前沿"},
|
||
|
{"name": "主持科研项目情况", "weight": 12, "category": "talent", "description": "项目规模、数量及影响力"},
|
||
|
{"name": "科研成果质量", "weight": 16, "category": "talent", "description": "论文、专利等成果的质量与影响"},
|
||
|
{"name": "教学能力与效果", "weight": 14, "category": "talent", "description": "教学水平及学生评价"},
|
||
|
{"name": "学术服务与影响力", "weight": 40, "category": "talent", "description": "学术服务与社会影响力"}
|
||
|
]
|
||
|
|
||
|
# 工程研究中心评估维度
|
||
|
lab_dimensions = [
|
||
|
{"name": "工程技术研发能力与水平", "weight": 30, "category": "lab", "description": "工程研究中心整体工程技术研发水平"},
|
||
|
{"name": "创新水平", "weight": 10, "category": "lab", "description": "工程研究中心科研创新程度"},
|
||
|
{"name": "人才与队伍", "weight": 10, "category": "lab", "description": "工程研究中心人才梯队建设情况"},
|
||
|
{"name": "装备与场地", "weight": 10, "category": "lab", "description": "工程研究中心设备和场地条件"},
|
||
|
{"name": "成果转化与行业贡献", "weight": 30, "category": "lab", "description": "成果产业化情况与行业贡献"},
|
||
|
{"name": "学科发展与人才培养", "weight": 20, "category": "lab", "description": "对学科发展与人才培养的贡献"},
|
||
|
{"name": "开放与运行管理", "weight": 20, "category": "lab", "description": "工程研究中心开放程度与管理水平"}
|
||
|
]
|
||
|
|
||
|
# 添加教师科研人才评估维度
|
||
|
for dim in talent_dimensions:
|
||
|
crud.create_dimension(
|
||
|
db,
|
||
|
name=dim["name"],
|
||
|
weight=dim["weight"],
|
||
|
category=dim["category"],
|
||
|
description=dim["description"]
|
||
|
)
|
||
|
|
||
|
# 添加工程研究中心评估维度
|
||
|
for dim in lab_dimensions:
|
||
|
crud.create_dimension(
|
||
|
db,
|
||
|
name=dim["name"],
|
||
|
weight=dim["weight"],
|
||
|
category=dim["category"],
|
||
|
description=dim["description"]
|
||
|
)
|
||
|
|
||
|
print("维度数据初始化完成!")
|
||
|
else:
|
||
|
print("数据库中已存在维度数据,跳过初始化。")
|
||
|
|
||
|
finally:
|
||
|
db.close()
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
# 确保表已创建
|
||
|
Base.metadata.create_all(bind=engine)
|
||
|
# 初始化维度数据
|
||
|
init_dimensions()
|