|
|
@@ -274,7 +274,8 @@ class CatalogCheckProcessor:
|
|
|
'index': catalog['index'],
|
|
|
'title': catalog['title'],
|
|
|
'chapter_classification': label,
|
|
|
- 'missing_items': f"未找到标签 '{label}' 的规范要求"
|
|
|
+ 'missing_items': f"未找到标签 '{label}' 的规范要求",
|
|
|
+ 'specification_items': []
|
|
|
})
|
|
|
continue
|
|
|
|
|
|
@@ -298,7 +299,8 @@ class CatalogCheckProcessor:
|
|
|
'index': catalog['index'],
|
|
|
'title': catalog['title'],
|
|
|
'chapter_classification': label,
|
|
|
- 'missing_items': missing_items
|
|
|
+ 'missing_items': missing_items,
|
|
|
+ 'specification_items': spec["二级目录"]
|
|
|
})
|
|
|
|
|
|
logger.info(f"审查结果: {missing_items}")
|
|
|
@@ -371,7 +373,7 @@ class CatalogCheckProcessor:
|
|
|
logger.info(f"保存审查结果到: {output_file}")
|
|
|
|
|
|
with open(output_file, 'w', encoding='utf-8-sig', newline='') as f:
|
|
|
- writer = csv.DictWriter(f, fieldnames=['index', 'title', 'chapter_classification', 'missing_items'])
|
|
|
+ writer = csv.DictWriter(f, fieldnames=['index', 'title', 'chapter_classification', 'missing_items', 'specification_items'])
|
|
|
writer.writeheader()
|
|
|
writer.writerows(results)
|
|
|
|
|
|
@@ -451,6 +453,7 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
- chapter_classification: 章节分类
|
|
|
- missing_items: 目录缺失项(列表或字符串)
|
|
|
- miss_outline: 大纲缺失项(列表或字符串)
|
|
|
+ - specification_items: 规范项(列表或字符串)
|
|
|
|
|
|
Returns:
|
|
|
List[Dict[str, Any]]: 审查项列表,每个项包含:
|
|
|
@@ -469,6 +472,29 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
chapter_label = row.get('chapter_label', '')
|
|
|
chapter_classification = row.get('chapter_classification', '')
|
|
|
|
|
|
+ # 解析 specification_items 列(规范项)
|
|
|
+ specification_items_str = row.get('specification_items', '')
|
|
|
+ specification_items_list = []
|
|
|
+ try:
|
|
|
+ # 先检查是否为列表类型(避免 pd.isna 对列表返回 True)
|
|
|
+ if isinstance(specification_items_str, list):
|
|
|
+ specification_items_list = specification_items_str
|
|
|
+ elif pd.isna(specification_items_str) or specification_items_str == '':
|
|
|
+ specification_items_list = []
|
|
|
+ else:
|
|
|
+ # 尝试使用 ast.literal_eval 解析
|
|
|
+ specification_items_list = ast.literal_eval(specification_items_str)
|
|
|
+ except (ValueError, SyntaxError):
|
|
|
+ try:
|
|
|
+ # 尝试使用 json.loads 解析
|
|
|
+ specification_items_list = json.loads(specification_items_str)
|
|
|
+ except (json.JSONDecodeError, TypeError):
|
|
|
+ logger.warning(f"第 {index} 行无法解析specification_items: {specification_items_str}")
|
|
|
+ specification_items_list = []
|
|
|
+
|
|
|
+ # 将规范项列表拼接为字符串(用、号连接)
|
|
|
+ specification_items_text = '、'.join(specification_items_list) if specification_items_list else ''
|
|
|
+
|
|
|
# 解析 missing_items 列(目录缺失)
|
|
|
missing_items_str = row.get('missing_items', '')
|
|
|
try:
|
|
|
@@ -512,7 +538,7 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
"issue_point": f"{missing_item}缺失",
|
|
|
"location": title if title else chapter_label,
|
|
|
"suggestion": f"目录缺失(missing_items):在待审查目录中未找到与'{missing_item}'对应的章节;当前章节仅涉及'{title if title else chapter_label}',未涵盖'{missing_item}'相关内容;整改建议:建议在本章或前序章节中增设'{missing_item}'相关内容,确保与审查规范要求一致。",
|
|
|
- "reason": "",
|
|
|
+ "reason": f"该章节应具备要点:{specification_items_text}" if specification_items_text else "",
|
|
|
"risk_level": "高风险",
|
|
|
"reference_source": '《桥梁公司危险性较大工程管理实施细则(2025版)》',
|
|
|
}
|
|
|
@@ -525,7 +551,7 @@ def process_catalog_review_list(catogues_df: pd.DataFrame) -> List[Dict[str, Any
|
|
|
"issue_point": f"{miss_outline}缺失",
|
|
|
"location": title if title else chapter_label,
|
|
|
"suggestion": f"大纲缺失(miss_outline):在待审查大纲中未找到与'{miss_outline}'对应的章节;当前章节仅涉及'{title if title else chapter_label}',未涵盖'{miss_outline}'相关内容;整改建议:建议在本章或前序章节中增设'{miss_outline}'相关内容,确保与审查规范要求一致。",
|
|
|
- "reason": "",
|
|
|
+ "reason": f"该章节应具备要点:{specification_items_text}" if specification_items_text else "",
|
|
|
"risk_level": "高风险",
|
|
|
"reference_source": '《桥梁公司危险性较大工程管理实施细则(2025版)》',
|
|
|
}
|