|
@@ -475,7 +475,8 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
"""
|
|
"""
|
|
|
start_time = time.time()
|
|
start_time = time.time()
|
|
|
catogues_reciew_list = []
|
|
catogues_reciew_list = []
|
|
|
-
|
|
|
|
|
|
|
+ # catogues_df.to_csv('temp/document_temp/catogues_df-1.csv', mode="a", encoding='utf-8-sig', index=False)
|
|
|
|
|
+
|
|
|
for index, row in catogues_df.iterrows():
|
|
for index, row in catogues_df.iterrows():
|
|
|
title = row.get('title', '')
|
|
title = row.get('title', '')
|
|
|
chapter_label = row.get('chapter_label', '')
|
|
chapter_label = row.get('chapter_label', '')
|
|
@@ -507,13 +508,10 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
# 解析 missing_items 列(目录缺失但大纲存在)
|
|
# 解析 missing_items 列(目录缺失但大纲存在)
|
|
|
missing_items_str = row.get('missing_items', '')
|
|
missing_items_str = row.get('missing_items', '')
|
|
|
try:
|
|
try:
|
|
|
- if pd.isna(missing_items_str) or missing_items_str == '':
|
|
|
|
|
- missing_items_list = []
|
|
|
|
|
- elif isinstance(missing_items_str, list):
|
|
|
|
|
- missing_items_list = missing_items_str
|
|
|
|
|
- else:
|
|
|
|
|
- # 尝试使用 ast.literal_eval 解析
|
|
|
|
|
|
|
+ if type(missing_items_str)==str:
|
|
|
missing_items_list = ast.literal_eval(missing_items_str)
|
|
missing_items_list = ast.literal_eval(missing_items_str)
|
|
|
|
|
+ else:
|
|
|
|
|
+ missing_items_list = missing_items_str
|
|
|
except (ValueError, SyntaxError):
|
|
except (ValueError, SyntaxError):
|
|
|
try:
|
|
try:
|
|
|
# 尝试使用 json.loads 解析
|
|
# 尝试使用 json.loads 解析
|
|
@@ -525,13 +523,10 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
# 解析 common_elements_list 列(目录与大纲都缺失)
|
|
# 解析 common_elements_list 列(目录与大纲都缺失)
|
|
|
common_elements_str = row.get('common_elements_list', '')
|
|
common_elements_str = row.get('common_elements_list', '')
|
|
|
try:
|
|
try:
|
|
|
- if pd.isna(common_elements_str) or common_elements_str == '':
|
|
|
|
|
- common_elements_list = []
|
|
|
|
|
- elif isinstance(common_elements_str, list):
|
|
|
|
|
- common_elements_list = common_elements_str
|
|
|
|
|
- else:
|
|
|
|
|
- # 尝试使用 ast.literal_eval 解析
|
|
|
|
|
|
|
+ if type(common_elements_str)==str:
|
|
|
common_elements_list = ast.literal_eval(common_elements_str)
|
|
common_elements_list = ast.literal_eval(common_elements_str)
|
|
|
|
|
+ else:
|
|
|
|
|
+ common_elements_list = common_elements_str
|
|
|
except (ValueError, SyntaxError):
|
|
except (ValueError, SyntaxError):
|
|
|
try:
|
|
try:
|
|
|
# 尝试使用 json.loads 解析
|
|
# 尝试使用 json.loads 解析
|
|
@@ -543,13 +538,10 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
# 解析 miss_outline 列(大纲缺失)
|
|
# 解析 miss_outline 列(大纲缺失)
|
|
|
miss_outline_str = row.get('miss_outline', '')
|
|
miss_outline_str = row.get('miss_outline', '')
|
|
|
try:
|
|
try:
|
|
|
- if pd.isna(miss_outline_str) or miss_outline_str == '':
|
|
|
|
|
- miss_outline_list = []
|
|
|
|
|
- elif isinstance(miss_outline_str, list):
|
|
|
|
|
- miss_outline_list = miss_outline_str
|
|
|
|
|
- else:
|
|
|
|
|
- # 尝试使用 ast.literal_eval 解析
|
|
|
|
|
|
|
+ if type(miss_outline_str)==str:
|
|
|
miss_outline_list = ast.literal_eval(miss_outline_str)
|
|
miss_outline_list = ast.literal_eval(miss_outline_str)
|
|
|
|
|
+ else:
|
|
|
|
|
+ miss_outline_list = miss_outline_str
|
|
|
except (ValueError, SyntaxError):
|
|
except (ValueError, SyntaxError):
|
|
|
try:
|
|
try:
|
|
|
# 尝试使用 json.loads 解析
|
|
# 尝试使用 json.loads 解析
|
|
@@ -564,7 +556,7 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
catalog_item = {
|
|
catalog_item = {
|
|
|
"issue_point": f"{missing_item}缺失",
|
|
"issue_point": f"{missing_item}缺失",
|
|
|
"location": title if title else chapter_label,
|
|
"location": title if title else chapter_label,
|
|
|
- "suggestion": f"目录缺失:要点目录中缺失'{missing_item}'这个小节,但大纲中存在该小节;当前章节仅涉及'{title if title else chapter_label}',目录中未体现'{missing_item}'相关内容;整改建议:建议在目录中补充'{missing_item}'相关内容,确保目录与大纲一致。",
|
|
|
|
|
|
|
+ "suggestion": f"目录缺失:目录中缺失'{missing_item}'这个小节;当前章节仅涉及'{title if title else chapter_label}',目录中未体现'{missing_item}'相关内容;整改建议:建议在目录中补充'{missing_item}'相关内容,确保目录完整性。",
|
|
|
"reason": f"该章节应具备要点:{specification_items_text}" if specification_items_text else "",
|
|
"reason": f"该章节应具备要点:{specification_items_text}" if specification_items_text else "",
|
|
|
"risk_level": "高风险",
|
|
"risk_level": "高风险",
|
|
|
"reference_source": '《桥梁公司危险性较大工程管理实施细则(2025版)》',
|
|
"reference_source": '《桥梁公司危险性较大工程管理实施细则(2025版)》',
|
|
@@ -577,7 +569,7 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
common_item = {
|
|
common_item = {
|
|
|
"issue_point": f"{common_element}缺失",
|
|
"issue_point": f"{common_element}缺失",
|
|
|
"location": title if title else chapter_label,
|
|
"location": title if title else chapter_label,
|
|
|
- "suggestion": f"目录与大纲都缺失:要点目录和大纲中都缺失'{common_element}'这个小节;当前章节仅涉及'{title if title else chapter_label}',目录和大纲均未涵盖'{common_element}'相关内容;整改建议:建议在本章或前序章节中增设'{common_element}'相关内容,确保目录和大纲都包含该小节。",
|
|
|
|
|
|
|
+ "suggestion": f"目录与大纲都缺失:目录和大纲中都缺失'{common_element}'这个小节;当前章节仅涉及'{title if title else chapter_label}',目录和大纲均未涵盖'{common_element}'相关内容;整改建议:建议在本章或前序章节中增设'{common_element}'相关内容,确保目录和大纲都包含该小节。",
|
|
|
"reason": f"该章节应具备要点:{specification_items_text}" if specification_items_text else "",
|
|
"reason": f"该章节应具备要点:{specification_items_text}" if specification_items_text else "",
|
|
|
"risk_level": "高风险",
|
|
"risk_level": "高风险",
|
|
|
"reference_source": '《桥梁公司危险性较大工程管理实施细则(2025版)》',
|
|
"reference_source": '《桥梁公司危险性较大工程管理实施细则(2025版)》',
|