本仓库为远程超声诊断平台的统一代码仓库,包含前端、后端、AI质控模块以及专网实时通信中间件。 采用 Monorepo 结构管理,方便统一版本控制,支持针对不同医院/客户进行定制化开发。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

70 lines
2.2 KiB

import asyncio
import sys
import os
import re
# Add the current directory to path so we can import qc_engine
sys.path.append(os.path.dirname(__file__))
from qc_engine import qc_manager
async def test_local_report():
report_text = """
姓名:郭翠
性别:男
年龄:47
检查部位:子宫,卵巢
检查所见:
膀胱充盈良好,子宫前位,体积大笑如常,宫区光点分布均匀,内膜厚约0.9cm,宫颈厚约3.5cm,于左侧附件区探及一大小约2.2x1.8cm的无回声区,边界清晰,后方回声增强,余未见其他明显异常回声。彩色多普勒未探及异常血流信号。
诊断结论:
1.宫颈肥厚
2.右侧附件区囊肿
"""
mock_report_data = {
"report": report_text,
"examinePart": "子宫,卵巢",
"patient_info": {
"sex": "",
"patientName": "郭翠",
"age": "47"
},
"model": "consensus" # 使用交叉验证进行一致性测试
}
print("="*50)
print("🚀 开始本地质控一致性测试 (运行3次)")
print("="*50)
all_results = []
for i in range(3):
print(f"\n[第 {i+1} 次运行] 分析中...")
try:
result = await qc_manager.run_qc(mock_report_data)
all_results.append(result)
print(f"✅ 第 {i+1} 次运行完成")
except Exception as e:
print(f"❌ 第 {i+1} 次运行失败: {e}")
print("\n" + "="*50)
print("📊 一致性分析总结")
print("="*50)
# 改进的评分提取正则
for idx, res in enumerate(all_results):
# 尝试匹配各种可能的评分格式
score_match = re.search(r"(?:总计得分|最终评分)[::]\D*(\d+)/100", res)
score = score_match.group(1) if score_match else "未知"
print(f"运行 {idx+1}: 评分={score}, 结果长度={len(res)}")
if score == "未知":
print(f"--- 运行 {idx+1} 未提取到评分,内容片段: {res[-200:].strip()} ---")
print("\n【第 3 次运行的完整输出文本】:")
print("-" * 20)
print(all_results[-1])
print("-" * 20)
if __name__ == "__main__":
asyncio.run(test_local_report())