Files
AIclinicalresearch/frontend-v2/src/modules/aia/constants.ts
HaHafeng 71d32d11ee feat(iit): V3.2 data consistency + project isolation + admin config redesign + Chinese labels
Summary:
- Refactor timeline API to read from qc_field_status (SSOT) instead of qc_logs
- Add field-issues paginated API with severity/dimension/recordId filters
- Add LEFT JOIN field_metadata + qc_event_status for Chinese display names
- Implement per-project ChatOrchestrator cache and SessionMemory isolation
- Redesign admin IIT config tabs (REDCap -> Fields -> KB -> Rules -> Members)
- Add AI-powered QC rule generation (D3 programmatic + D1/D5/D6 LLM-based)
- Add clickable warning/critical detail Modal in ReportsPage
- Auto-dispatch eQuery after batch QC via DailyQcOrchestrator
- Update module status documentation to v3.2

Backend changes:
- iitQcCockpitController: rewrite getTimeline from qc_field_status, add getFieldIssues
- iitQcCockpitRoutes: add field-issues route
- ChatOrchestrator: per-projectId cached instances
- SessionMemory: keyed by userId::projectId
- WechatCallbackController: resolve projectId from iitUserMapping
- iitRuleSuggestionService: dimension-based suggest + generateD3Rules
- iitBatchController: call DailyQcOrchestrator after batch QC

Frontend changes:
- AiStreamPage: adapt to new timeline structure with dimension tags
- ReportsPage: clickable stats cards with issue detail Modal
- IitProjectDetailPage: reorder tabs, add AI rule generation UI
- iitProjectApi: add TimelineIssue, FieldIssueItem types and APIs

Status: TypeScript compilation verified, no new lint errors
Made-with: Cursor
2026-03-02 14:29:59 +08:00

205 lines
6.1 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.
/**
* AIA 模块常量配置
*
* 12个智能体模块配置100%还原原型图V11
*/
import type { AgentConfig, PhaseConfig } from './types';
/**
* 阶段配置
*/
export const PHASES: PhaseConfig[] = [
{ phase: 0, name: '全流程研究方案制定', theme: 'indigo', isProtocolAgent: true },
{ phase: 1, name: '选题优化智能体', theme: 'blue' },
{ phase: 2, name: '方案设计智能体', theme: 'blue' },
{ phase: 3, name: '方案预评审', theme: 'yellow' },
{ phase: 4, name: '数据处理与统计分析', theme: 'teal', isTool: true },
{ phase: 5, name: '写作助手', theme: 'purple' },
];
/**
* Protocol Agent 配置(全流程研究方案制定)
*/
export const PROTOCOL_AGENT: AgentConfig = {
id: 'PROTOCOL_AGENT',
name: '全流程研究方案制定',
icon: 'workflow',
description: '一站式完成研究方案核心要素科学问题→PICO→研究设计→样本量→观察指标支持一键生成完整方案。',
theme: 'indigo',
phase: 0,
order: 0,
isProtocolAgent: true,
};
/**
* 12个智能体配置
*/
export const AGENTS: AgentConfig[] = [
// Phase 0: Protocol Agent全流程
PROTOCOL_AGENT,
// Phase 1: 选题优化智能体 (3个每行3个)
{
id: 'TOPIC_01',
name: '科学问题梳理',
icon: 'list-tree',
description: '从科学问题的清晰度、系统性、可验证性等角度使用科学理论对您的科学问题进行全面的评价。',
theme: 'blue',
phase: 1,
order: 1,
},
{
id: 'TOPIC_02',
name: 'PICO 梳理',
icon: 'target',
description: '基于科学问题梳理研究对象、干预(暴露)、对照和结局指标,并评价并给出合理化的建议。',
theme: 'blue',
phase: 1,
order: 2,
},
{
id: 'TOPIC_03',
name: '选题评价',
icon: 'clipboard-check',
description: '从创新性、临床价值、科学性和可行性等方面使用科学理论对您的临床问题进行全面的评价。',
theme: 'blue',
phase: 1,
order: 3,
},
// Phase 2: 方案设计智能体 (4个每行3个)
{
id: 'DESIGN_04',
name: '观察指标设计',
icon: 'eye',
description: '基于研究设计和因果关系提供可能的观察指标集。',
theme: 'blue',
phase: 2,
order: 4,
},
{
id: 'DESIGN_05',
name: '病例报告表设计',
icon: 'table',
description: '基于研究方案设计梳理观察指标集并给出建议的病例报告表框架。',
theme: 'blue',
phase: 2,
order: 5,
},
{
id: 'DESIGN_06',
name: '样本量计算',
icon: 'calculator',
description: '基于研究阶段和研究设计为研究提供科学合理的样本量估算结果。',
theme: 'blue',
phase: 2,
order: 6,
},
{
id: 'DESIGN_07',
name: '临床研究方案撰写',
icon: 'file-text',
description: '基于科学问题、PICOS等信息给出一个初步的临床研究设计方案请尽量多给一些信息和需求。',
theme: 'blue',
phase: 2,
order: 7,
},
// Phase 3: 方案预评审 (1个)
{
id: 'REVIEW_08',
name: '方法学评审智能体',
icon: 'shield-check',
description: '从研究问题、研究方案和临床意义方面,对研究进行临床研究方法学的全面评价。',
theme: 'yellow',
phase: 3,
order: 8,
},
// Phase 4: 数据处理与统计分析 (2个工具类)
{
id: 'TOOL_09',
name: '数据评价与预处理',
icon: 'database',
description: '对现有数据的质量进行自动评价,并给出数据质量报告,包括缺失值、异常值、定量分析等。',
theme: 'teal',
phase: 4,
order: 9,
isTool: true,
toolUrl: '/research-management',
},
{
id: 'TOOL_10',
name: '智能统计分析',
icon: 'bar-chart-2',
description: '内置3条智能研究路径队列研究、预测模型、RCT研究以及近百种统计分析工具。',
theme: 'teal',
phase: 4,
order: 10,
isTool: true,
toolUrl: '/research-management',
},
// Phase 5: 写作助手 (2个)
{
id: 'WRITING_11',
name: '论文润色',
icon: 'pen-tool',
description: '结合目标杂志,提供专业化的润色服务,给出合理化的修改建议。',
theme: 'purple',
phase: 5,
order: 11,
},
{
id: 'WRITING_12',
name: '论文翻译',
icon: 'languages',
description: '结合目标杂志,提供专业化的翻译并进行润色,给出合理化的修改建议。',
theme: 'purple',
phase: 5,
order: 12,
},
];
/**
* 智能体欢迎语配置
*/
export const AGENT_PROMPTS: Record<string, string> = {
'TOPIC_01': '你好!我是**科学问题梳理助手**。请告诉我你感兴趣的研究方向,我将从科学性、创新性等维度帮你梳理。',
'TOPIC_02': '你好!我是**PICO梳理助手**。请描述你的研究想法,我来帮你拆解为 P (人群)、I (干预)、C (对照)、O (结局)。',
'TOPIC_03': '你好!我是**选题评价助手**。请提供你的初步选题,我将从创新性、临床价值等方面进行评估。',
'DESIGN_04': '你好!我是**观察指标设计助手**。请告诉我你的研究目的,我来帮你推荐主要和次要观察指标。',
'DESIGN_05': '你好!我是**CRF设计助手**。我可以帮你构建病例报告表的框架。',
'DESIGN_06': '你好需要计算样本量吗请告诉我研究类型如RCT、队列研究和主要指标的预期值。',
'DESIGN_07': '你好!欢迎来到**方案设计工作台**。我们将基于科学问题和PICOS信息共同撰写一份完整的临床研究方案。',
'REVIEW_08': '你好!我是**方法学评审助手**。请上传你的方案草稿,我将模拟审稿人视角进行方法学审查。',
'WRITING_11': 'Please paste the text you want to polish. I will check grammar, flow, and academic tone.',
'WRITING_12': '你好!请贴入需要翻译的段落,我将为你提供地道的学术英语翻译。',
};
/**
* 品牌配色
*/
export const BRAND_COLORS = {
blue: '#4F6EF2',
teal: '#0D9488',
purple: '#9333EA',
yellow: '#CA8A04',
} as const;