Files
AIclinicalresearch/backend/scripts/get-test-projects.mjs
HaHafeng beb7f7f559 feat(asl): Implement full-text screening core LLM service and validation system (Day 1-3)
Core Components:
- PDFStorageService with Dify/OSS adapters
- LLM12FieldsService with Nougat-first + dual-model + 3-layer JSON parsing
- PromptBuilder for dynamic prompt assembly
- MedicalLogicValidator with 5 rules + fault tolerance
- EvidenceChainValidator for citation integrity
- ConflictDetectionService for dual-model comparison

Prompt Engineering:
- System Prompt (6601 chars, Section-Aware strategy)
- User Prompt template (PICOS context injection)
- JSON Schema (12 fields constraints)
- Cochrane standards (not loaded in MVP)

Key Innovations:
- 3-layer JSON parsing (JSON.parse + json-repair + code block extraction)
- Promise.allSettled for dual-model fault tolerance
- safeGetFieldValue for robust field extraction
- Mixed CN/EN token calculation

Integration Tests:
- integration-test.ts (full test)
- quick-test.ts (quick test)
- cached-result-test.ts (fault tolerance test)

Documentation Updates:
- Development record (Day 2-3 summary)
- Quality assurance strategy (full-text screening)
- Development plan (progress update)
- Module status (v1.1 update)
- Technical debt (10 new items)

Test Results:
- JSON parsing success rate: 100%
- Medical logic validation: 5/5 passed
- Dual-model parallel processing: OK
- Cost per PDF: CNY 0.10

Files: 238 changed, 14383 insertions(+), 32 deletions(-)
Docs: docs/03-涓氬姟妯″潡/ASL-AI鏅鸿兘鏂囩尞/05-寮€鍙戣褰?2025-11-22_Day2-Day3_LLM鏈嶅姟涓庨獙璇佺郴缁熷紑鍙?md
2025-11-22 22:21:12 +08:00

87 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 快速测试脚本 - 获取已有项目ID
*
* 用途快速找到数据库中已有的项目ID方便测试结果统计页面
* 使用方法node scripts/get-test-projects.mjs
*/
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function getProjects() {
console.log('\n🔍 查询已有项目...\n');
try {
// 查询所有项目
const projects = await prisma.aslScreeningProject.findMany({
orderBy: { createdAt: 'desc' },
take: 10,
select: {
id: true,
projectName: true,
createdAt: true,
status: true,
_count: {
select: {
literatures: true,
screeningResults: true,
}
}
}
});
if (projects.length === 0) {
console.log('❌ 没有找到任何项目');
console.log('\n💡 提示:请先访问"设置与启动"页面上传Excel并启动筛选\n');
return;
}
console.log(`✅ 找到 ${projects.length} 个项目:\n`);
projects.forEach((project, index) => {
console.log(`${index + 1}. 项目名称: ${project.projectName}`);
console.log(` 项目ID: ${project.id}`);
console.log(` 状态: ${project.status}`);
console.log(` 文献数: ${project._count.literatures}`);
console.log(` 筛选结果数: ${project._count.screeningResults}`);
console.log(` 创建时间: ${project.createdAt.toLocaleString('zh-CN')}`);
console.log('');
});
// 推荐一个有数据的项目
const validProject = projects.find(p => p._count.screeningResults > 0);
if (validProject) {
console.log('🎯 推荐测试项目(有筛选结果):');
console.log(` 项目ID: ${validProject.id}`);
console.log(` 文献数: ${validProject._count.literatures}`);
console.log(` 筛选结果数: ${validProject._count.screeningResults}`);
console.log('\n📝 快速测试方法:');
console.log(`\n1. 访问审核工作台:`);
console.log(` http://localhost:3000/literature/screening/title/workbench?projectId=${validProject.id}`);
console.log(`\n2. 点击页面右上角的"查看结果统计"按钮`);
console.log(`\n3. 或直接访问结果统计页:`);
console.log(` http://localhost:3000/literature/screening/title/results?projectId=${validProject.id}\n`);
} else {
console.log('⚠️ 所有项目都没有筛选结果');
console.log('\n💡 提示:请选择一个项目,等待筛选完成后再查看结果\n');
if (projects.length > 0) {
console.log(`📝 测试URL待筛选完成后访问`);
console.log(` http://localhost:3000/literature/screening/title/workbench?projectId=${projects[0].id}\n`);
}
}
} catch (error) {
console.error('❌ 查询失败:', error);
} finally {
await prisma.$disconnect();
}
}
getProjects();