Files
AIclinicalresearch/backend/src/modules/admin/iit-projects/iitQcRuleRoutes.ts
HaHafeng 203846968c 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
2026-02-26 13:28:08 +08:00

36 lines
1.0 KiB
TypeScript
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.
/**
* IIT 质控规则管理路由
*/
import { FastifyInstance } from 'fastify';
import * as controller from './iitQcRuleController.js';
export async function iitQcRuleRoutes(fastify: FastifyInstance) {
// 获取项目的所有质控规则
fastify.get('/:projectId/rules', controller.listRules);
// 获取规则统计
fastify.get('/:projectId/rules/stats', controller.getRuleStats);
// 获取单条规则
fastify.get('/:projectId/rules/:ruleId', controller.getRule);
// 添加规则
fastify.post('/:projectId/rules', controller.addRule);
// 更新规则
fastify.put('/:projectId/rules/:ruleId', controller.updateRule);
// 删除规则
fastify.delete('/:projectId/rules/:ruleId', controller.deleteRule);
// 批量导入规则
fastify.post('/:projectId/rules/import', controller.importRules);
// AI 规则建议
fastify.post('/:projectId/rules/suggest', controller.suggestRules);
// 测试规则逻辑(不需要项目 ID
fastify.post('/rules/test', controller.testRule);
}