2022-06-23 16:44:09 +08:00
|
|
|
from Utils.ObjUtil import SpecObject
|
|
|
|
from Utils.ValidateUtil import ValidateAttr, Validate
|
|
|
|
|
|
|
|
|
|
|
|
class ScoreModelObj(SpecObject):
|
|
|
|
"""打分模型"""
|
|
|
|
|
2022-07-01 14:36:02 +08:00
|
|
|
class LevelSetting(SpecObject):
|
|
|
|
"""级别设置"""
|
|
|
|
level = ValidateAttr(field='level', type=str)
|
|
|
|
score = ValidateAttr(field='score', type=[int, float])
|
|
|
|
position = ValidateAttr(field='position', type=[int, float])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"level": "级别",
|
|
|
|
"score": "得分",
|
|
|
|
"position": "分位"
|
|
|
|
}
|
|
|
|
|
2022-06-23 16:44:09 +08:00
|
|
|
class Dimension(SpecObject):
|
|
|
|
"""维度"""
|
|
|
|
|
2022-07-01 14:36:02 +08:00
|
|
|
class FirstIndex(SpecObject):
|
2022-06-23 16:44:09 +08:00
|
|
|
"""一级指标"""
|
|
|
|
|
|
|
|
class SecondaryIndex(SpecObject):
|
|
|
|
"""二级指标"""
|
|
|
|
|
|
|
|
class ScoreSetting(SpecObject):
|
|
|
|
"""打分设置"""
|
|
|
|
pattern = ValidateAttr(field="pattern", type=str)
|
2022-07-01 14:36:02 +08:00
|
|
|
interval = ValidateAttr(field="interval", type=list)
|
|
|
|
score_position = ValidateAttr(field="score_position", type=list)
|
2022-06-23 16:44:09 +08:00
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"pattern": "模式",
|
2022-07-01 14:36:02 +08:00
|
|
|
"interval": "区间",
|
|
|
|
"score_position": "打分位"
|
2022-06-23 16:44:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
standard_score = ValidateAttr(field="standard_score", type=str)
|
|
|
|
score_setting = ValidateAttr(field="score_setting", type=ScoreSetting)
|
|
|
|
name = ValidateAttr(field="name", type=str)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"standard_score": "标准分",
|
|
|
|
"score_setting": "打分设置",
|
2022-06-27 16:08:03 +08:00
|
|
|
"name": "指标名称"
|
2022-06-23 16:44:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
name = ValidateAttr(field="name", type=str)
|
|
|
|
secondary_index = ValidateAttr(field="secondary_index", instance_list=SecondaryIndex)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "指标名称",
|
2022-06-27 16:08:03 +08:00
|
|
|
"secondary_index": "二级指标"
|
2022-06-23 16:44:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
name = ValidateAttr(field="name", type=str)
|
2022-07-01 14:36:02 +08:00
|
|
|
first_index = ValidateAttr(field="first_index", instance_list=FirstIndex)
|
2022-06-23 16:44:09 +08:00
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "维度名称",
|
2022-07-01 14:36:02 +08:00
|
|
|
"first_index": "一级指标"
|
2022-06-23 16:44:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
model_name = ValidateAttr(field="model_name", type=str)
|
2022-07-01 14:36:02 +08:00
|
|
|
level_setting = ValidateAttr(field="level_setting", instance_list=LevelSetting)
|
2022-06-23 16:44:09 +08:00
|
|
|
dimension = ValidateAttr(field="dimension", instance_list=Dimension)
|
2022-07-01 14:36:02 +08:00
|
|
|
author = ValidateAttr(field="author", type=str)
|
|
|
|
edit_date = ValidateAttr(field="edit_date", func=Validate.date_format)
|
|
|
|
tags = ValidateAttr(field="tags", type=list)
|
|
|
|
status = ValidateAttr(field="status", type=str, in_list=['normal', 'lock'])
|
2022-06-23 16:44:09 +08:00
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"model_name": "模型名称",
|
2022-07-01 14:36:02 +08:00
|
|
|
"level_setting": "级别设置",
|
2022-06-23 16:44:09 +08:00
|
|
|
"dimension": "维度",
|
|
|
|
"author": "作者",
|
|
|
|
"date": "日期",
|
2022-07-01 14:36:02 +08:00
|
|
|
"tags": "标签",
|
|
|
|
"status": "状态"
|
2022-06-23 16:44:09 +08:00
|
|
|
}
|
2022-07-01 14:36:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ScoreIndexObj(SpecObject):
|
|
|
|
"""打分指标"""
|
|
|
|
class BindSet(SpecObject):
|
2022-07-04 10:13:52 +08:00
|
|
|
"""绑定设置"""
|
2022-07-01 14:36:02 +08:00
|
|
|
class Params(SpecObject):
|
|
|
|
"""传入参数"""
|
2022-07-04 10:13:52 +08:00
|
|
|
class DataBind(SpecObject):
|
|
|
|
"""数据绑定"""
|
|
|
|
data_base = ValidateAttr(field="data_base", type=str)
|
|
|
|
data_sheet = ValidateAttr(field="data_sheet", type=str)
|
|
|
|
data_field = ValidateAttr(field="data_field", type=str)
|
|
|
|
dispose_none_string = ValidateAttr(field="dispose_none_string", type=[int, float, str, None])
|
|
|
|
dispose_none_value = ValidateAttr(field="dispose_none_value", type=[int, float, str, None])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"data_base": "数据库",
|
|
|
|
"data_sheet": "数据表",
|
|
|
|
"data_field": "字段",
|
|
|
|
"dispose_none_string": "处理空字符串",
|
|
|
|
"dispose_none_value": "处理空值"
|
|
|
|
}
|
|
|
|
|
2022-07-01 14:36:02 +08:00
|
|
|
param = ValidateAttr(field="param", type=str)
|
|
|
|
describe = ValidateAttr(field="describe", type=str)
|
2022-07-04 10:13:52 +08:00
|
|
|
data_bind = ValidateAttr(field="data_bind", type=DataBind)
|
2022-07-01 14:36:02 +08:00
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"param": "参数",
|
|
|
|
"describe": "说明",
|
|
|
|
"data_bind": "数据绑定"
|
|
|
|
}
|
|
|
|
|
|
|
|
type = ValidateAttr(field='type', type=str)
|
|
|
|
name = ValidateAttr(field='name', type=str)
|
|
|
|
params = ValidateAttr(field='params', type=Params)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"type": "类型",
|
|
|
|
"name": "名称",
|
|
|
|
"params": "传入参数"
|
|
|
|
}
|
|
|
|
|
|
|
|
index_name = ValidateAttr(field="index_name", type=str)
|
|
|
|
bind_set = ValidateAttr(field="bind_set", type=BindSet)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"index_name": "指标名称",
|
|
|
|
"bind_set": "绑定设置"
|
|
|
|
}
|