2022-06-23 16:44:09 +08:00
|
|
|
from Utils.ObjUtil import SpecObject
|
|
|
|
from Utils.ValidateUtil import ValidateAttr, Validate
|
|
|
|
|
|
|
|
|
|
|
|
class ScoreModelObj(SpecObject):
|
|
|
|
"""打分模型"""
|
|
|
|
|
|
|
|
class Dimension(SpecObject):
|
|
|
|
"""维度"""
|
|
|
|
|
|
|
|
class FirstLevelIndex(SpecObject):
|
|
|
|
"""一级指标"""
|
|
|
|
|
|
|
|
class SecondaryIndex(SpecObject):
|
|
|
|
"""二级指标"""
|
|
|
|
|
|
|
|
class ScoreSetting(SpecObject):
|
|
|
|
"""打分设置"""
|
|
|
|
|
|
|
|
class Setting(SpecObject):
|
|
|
|
"""设置"""
|
|
|
|
|
|
|
|
class Interval(SpecObject):
|
|
|
|
"""区间"""
|
|
|
|
gt = ValidateAttr(field="", type=[int, float])
|
|
|
|
lte = ValidateAttr(field="", type=[int, float])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"gt": "最大值",
|
|
|
|
"lte": "最小值",
|
|
|
|
}
|
|
|
|
|
|
|
|
percentage = ValidateAttr(field="percentage", type=[int, float])
|
|
|
|
interval = ValidateAttr(field="interval", type=Interval)
|
|
|
|
gear = ValidateAttr(field="gear", type=str)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"percentage": "百分比(%)",
|
|
|
|
"interval": "区间",
|
|
|
|
"gear": "档位",
|
|
|
|
}
|
|
|
|
|
|
|
|
pattern = ValidateAttr(field="pattern", type=str)
|
|
|
|
setting = ValidateAttr(field="setting", instance_list=Setting)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"pattern": "模式",
|
|
|
|
"setting": "设置"
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
first_level_index = ValidateAttr(field="first_level_index", instance_list=FirstLevelIndex)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "维度名称",
|
|
|
|
"first_level_index": "一级指标"
|
|
|
|
}
|
|
|
|
|
|
|
|
model_name = ValidateAttr(field="model_name", type=str)
|
|
|
|
dimension = ValidateAttr(field="dimension", instance_list=Dimension)
|
|
|
|
author = ValidateAttr(field="", type=str)
|
|
|
|
date = ValidateAttr(field="", func=Validate.date_format)
|
|
|
|
tags = ValidateAttr(field="", type=list)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"model_name": "模型名称",
|
|
|
|
"dimension": "维度",
|
|
|
|
"author": "作者",
|
|
|
|
"date": "日期",
|
|
|
|
"tags": "标签"
|
|
|
|
}
|