feat(iit): Complete CRA Agent V3.0 P0 milestone - autonomous QC pipeline

P0-1: Variable list sync from REDCap metadata
P0-2: QC rule configuration with JSON Logic + AI suggestion
P0-3: Scheduled QC + report generation + eQuery closed loop
P0-4: Unified dashboard + AI stream timeline + critical events

Backend:
- Add IitEquery, IitCriticalEvent Prisma models + migration
- Add cronEnabled/cronExpression to IitProject
- Implement eQuery service/controller/routes (CRUD + respond/review/close)
- Implement DailyQcOrchestrator (report -> eQuery -> critical events -> notify)
- Add AI rule suggestion service
- Register daily QC cron worker and eQuery auto-review worker
- Extend QC cockpit with timeline, trend, critical events APIs
- Fix timeline issues field compat (object vs array format)

Frontend:
- Create IIT business module with 6 pages (Dashboard, AI Stream, eQuery,
  Reports, Variable List + project config pages)
- Migrate IIT config from admin panel to business module
- Implement health score, risk heatmap, trend chart, critical event alerts
- Register IIT module in App router and top navigation

Testing:
- Add E2E API test script covering 7 modules (46 assertions, all passing)

Tested: E2E API tests 46/46 passed, backend and frontend verified
Made-with: Cursor
This commit is contained in:
2026-02-26 13:28:08 +08:00
parent 31b0433195
commit 203846968c
35 changed files with 7353 additions and 22 deletions

View File

@@ -0,0 +1,26 @@
/**
* eQuery 路由
*/
import { FastifyInstance } from 'fastify';
import * as controller from './iitEqueryController.js';
export async function iitEqueryRoutes(fastify: FastifyInstance) {
// 获取项目的 eQuery 列表
fastify.get('/:projectId/equeries', controller.listEqueries);
// 获取 eQuery 统计
fastify.get('/:projectId/equeries/stats', controller.getEqueryStats);
// 获取单条 eQuery
fastify.get('/:projectId/equeries/:equeryId', controller.getEquery);
// CRC 回复 eQuery
fastify.post('/:projectId/equeries/:equeryId/respond', controller.respondEquery);
// AI 复核 eQuery
fastify.post('/:projectId/equeries/:equeryId/review', controller.reviewEquery);
// 手动关闭 eQuery
fastify.post('/:projectId/equeries/:equeryId/close', controller.closeEquery);
}