提交模板修改

This commit is contained in:
王思川 2021-12-15 09:56:29 +08:00
parent c3d4516f7a
commit 11d85079dd
4 changed files with 14 additions and 53 deletions

View File

@ -90,7 +90,7 @@ class RatingModel:
score dict 分数 score dict 分数
""" """
# main # main
level_1_industry = self.industry.split('-')[0] level_1_industry = self.industry[0]
if level_1_industry == '制造业': if level_1_industry == '制造业':
score = manufacturing(self.questionnaire) score = manufacturing(self.questionnaire)
else: else:
@ -109,7 +109,7 @@ class RatingModel:
""" """
# Parameters # Parameters
elements = copy.deepcopy(self.financial_indicators[0]) elements = copy.deepcopy(self.financial_indicators[0])
industry = self.industry industry = self.industry[1]
# main # main
elements.pop('年报期') # 计算指标分数前移除年报期字段 elements.pop('年报期') # 计算指标分数前移除年报期字段
@ -203,4 +203,4 @@ class RatingModel:
if __name__ == '__main__': if __name__ == '__main__':
data = read_json_file(file_path('/static/test_data/demo01.json')) data = read_json_file(file_path('/static/test_data/demo01.json'))
model = RatingModel(data) model = RatingModel(data)
model.save_result() # model.save_result()

View File

@ -2,11 +2,11 @@ from Rating.db import find_threshold
from common.scripts import file_path, read_json_file from common.scripts import file_path, read_json_file
def financial_score(param1, param2): def financial_score(level_1_industry, param2):
""" """
财务要素进行打分 财务要素进行打分
Parameters: Parameters:
param1 string 完整行业 param1 string 一级行业
param2 dict 财务指标 param2 dict 财务指标
weights dict 财务指标权重 weights dict 财务指标权重
industry string 一级行业 industry string 一级行业
@ -17,8 +17,7 @@ def financial_score(param1, param2):
""" """
# Parameters # Parameters
weights = read_json_file(file_path('/Rating/static/weights.json')) weights = read_json_file(file_path('/Rating/static/weights.json'))
industry = param1.split("-")[1] refers = find_threshold(level_1_industry)[0]
refers = find_threshold(industry)[0]
# Returns # Returns
scores = dict() scores = dict()

View File

@ -283,13 +283,12 @@ def calculation_19(param):
""" """
A~E选择2项及以上得1分选择1项得0.5选F项不得分选G得1分 A~E选择2项及以上得1分选择1项得0.5选F项不得分选G得1分
""" """
param_list = list(param)
if 'F' in param_list: if 'F' in param:
score = 0 score = 0
elif 'G' in param_list: elif 'G' in param:
score = 1 score = 1
elif len(param_list) >= 2: elif len(param) >= 2:
score = 1 score = 1
else: else:
score = 0.5 score = 0.5
@ -532,8 +531,8 @@ def manufacturing(questionnaire):
score float 得分 score float 得分
""" """
score = dict() score = dict()
score['环境'] = ea(questionnaire['环境部分']) score['环境'] = ea(questionnaire[0:10])
score['社会责任'] = sre(questionnaire['社会责任']) score['社会责任'] = sre(questionnaire[10:20])
score['公司治理'] = cge(questionnaire['公司治理']) score['公司治理'] = cge(questionnaire[20:30])
score['合计'] = sum(score.values()) score['合计'] = sum(score.values())
return score return score

View File

@ -2,46 +2,9 @@
"评价ID": "kSVoCeJ1", "评价ID": "kSVoCeJ1",
"企业ID": "mKJreZRw", "企业ID": "mKJreZRw",
"企业名称": "远东资信评估有限公司", "企业名称": "远东资信评估有限公司",
"行业": "制造业-电子工业", "行业": ["制造业", "电子工业"],
"评价年度": "2021年", "评价年度": "2021年",
"经营问卷": { "经营问卷": ["A","C","C","15.9","7.3","14.3","A","A","B","B","E","1.25","C","B","B","A","612","B",["A", "B"],"B","B","A","A","B","C","B","12.7","B","B","B"],
"环境部分": [
"A",
"C",
"C",
"15.9",
"7.3",
"14.3",
"A",
"A",
"B",
"B"
],
"社会责任": [
"E",
"1.25",
"C",
"B",
"B",
"A",
"612",
"B",
"G",
"B"
],
"公司治理": [
"B",
"A",
"A",
"B",
"C",
"B",
"12.7",
"B",
"B",
"B"
]
},
"财务填报": { "财务填报": {
"资产负债表": [ "资产负债表": [
{ {