feat(ssa): Complete T-test end-to-end testing with 9 bug fixes - Phase 1 core 85% complete. R service: missing value auto-filter. Backend: error handling, variable matching, dynamic filename. Frontend: module activation, session isolation, error propagation. Full flow verified.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -283,6 +283,7 @@ model ReviewTask {
|
||||
methodologyScore Float? @map("methodology_score")
|
||||
methodologyStatus String? @map("methodology_status")
|
||||
picoExtract Json? @map("pico_extract")
|
||||
contextData Json? @map("context_data") /// Skills V2.0 执行上下文数据
|
||||
isArchived Boolean @default(false) @map("is_archived")
|
||||
archivedAt DateTime? @map("archived_at")
|
||||
modelUsed String? @map("model_used")
|
||||
@@ -2138,3 +2139,170 @@ model ProtocolGeneration {
|
||||
@@map("protocol_generations")
|
||||
@@schema("protocol_schema")
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// SSA Schema (ssa_schema)
|
||||
// 智能统计分析模块
|
||||
// ============================================================
|
||||
|
||||
/// SSA 分析会话
|
||||
model SsaSession {
|
||||
id String @id @default(uuid())
|
||||
userId String @map("user_id")
|
||||
title String?
|
||||
dataSchema Json? @map("data_schema") /// 数据结构(LLM可见)
|
||||
dataPayload Json? @map("data_payload") /// 真实数据(仅R可见)
|
||||
dataOssKey String? @map("data_oss_key") /// OSS 存储 key(大数据)
|
||||
status String @default("active") /// active | consult | completed | error
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
messages SsaMessage[]
|
||||
executionLogs SsaExecutionLog[]
|
||||
|
||||
@@index([userId], map: "idx_ssa_session_user")
|
||||
@@index([status], map: "idx_ssa_session_status")
|
||||
@@map("ssa_sessions")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 消息记录
|
||||
model SsaMessage {
|
||||
id String @id @default(uuid())
|
||||
sessionId String @map("session_id")
|
||||
role String /// user | assistant | system
|
||||
contentType String @map("content_type") /// text | plan | result
|
||||
content Json
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
session SsaSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([sessionId], map: "idx_ssa_message_session")
|
||||
@@map("ssa_messages")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 工具库
|
||||
model SsaTool {
|
||||
id String @id @default(uuid())
|
||||
toolCode String @unique @map("tool_code")
|
||||
name String
|
||||
version String @default("1.0.0")
|
||||
description String
|
||||
usageContext String? @map("usage_context")
|
||||
paramsSchema Json @map("params_schema")
|
||||
guardrails Json?
|
||||
searchText String @map("search_text")
|
||||
embedding Unsupported("vector(1024)")?
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@map("ssa_tools_library")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 执行日志
|
||||
model SsaExecutionLog {
|
||||
id String @id @default(uuid())
|
||||
sessionId String @map("session_id")
|
||||
messageId String? @map("message_id")
|
||||
toolCode String @map("tool_code")
|
||||
inputParams Json @map("input_params")
|
||||
outputStatus String @map("output_status")
|
||||
outputResult Json? @map("output_result")
|
||||
traceLog String[] @map("trace_log")
|
||||
executionMs Int? @map("execution_ms")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
session SsaSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([sessionId], map: "idx_ssa_exec_log_session")
|
||||
@@index([toolCode], map: "idx_ssa_exec_log_tool")
|
||||
@@map("ssa_execution_logs")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 统计决策表
|
||||
model SsaDecisionTable {
|
||||
id String @id @default(uuid())
|
||||
goalType String @map("goal_type") /// 分析目标
|
||||
yType String @map("y_type") /// 因变量类型
|
||||
xType String? @map("x_type") /// 自变量类型
|
||||
designType String @map("design_type") /// 设计类型
|
||||
toolCode String @map("tool_code") /// 推荐工具
|
||||
altToolCode String? @map("alt_tool_code") /// 备选工具(降级)
|
||||
priority Int @default(0) /// 优先级
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@unique([goalType, yType, xType, designType], map: "uq_ssa_decision_table")
|
||||
@@map("ssa_decision_table")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA R 代码库
|
||||
model SsaRCodeLibrary {
|
||||
id String @id @default(uuid())
|
||||
toolCode String @map("tool_code") /// 关联工具代码
|
||||
version String @default("1.0.0")
|
||||
fileName String @map("file_name") /// R 脚本文件名
|
||||
codeContent String @map("code_content") @db.Text /// R 代码内容
|
||||
entryFunc String @default("run_analysis") @map("entry_func")
|
||||
description String?
|
||||
dependencies String[] @default([]) /// 依赖包列表
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@index([toolCode], map: "idx_ssa_rcode_tool")
|
||||
@@map("ssa_r_code_library")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 参数映射配置
|
||||
model SsaParamMapping {
|
||||
id String @id @default(uuid())
|
||||
toolCode String @map("tool_code")
|
||||
jsonKey String @map("json_key") /// 前端传入的 JSON Key
|
||||
rParamName String @map("r_param_name") /// R 函数参数名
|
||||
dataType String @map("data_type") /// string | number | boolean
|
||||
isRequired Boolean @default(false) @map("is_required")
|
||||
defaultValue String? @map("default_value")
|
||||
validationRule String? @map("validation_rule")
|
||||
description String?
|
||||
|
||||
@@unique([toolCode, jsonKey], map: "uq_ssa_param_mapping")
|
||||
@@map("ssa_param_mapping")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 护栏规则配置
|
||||
model SsaGuardrailConfig {
|
||||
id String @id @default(uuid())
|
||||
toolCode String @map("tool_code")
|
||||
checkName String @map("check_name") /// 检查名称
|
||||
checkOrder Int @default(0) @map("check_order")
|
||||
checkCode String @map("check_code") /// R 函数名
|
||||
threshold String? /// 阈值条件
|
||||
actionType String @map("action_type") /// Block | Warn | Switch
|
||||
actionTarget String? @map("action_target") /// Switch 时的目标工具
|
||||
isEnabled Boolean @default(true) @map("is_enabled")
|
||||
|
||||
@@index([toolCode], map: "idx_ssa_guardrail_tool")
|
||||
@@map("ssa_guardrail_config")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
/// SSA 结果解读模板
|
||||
model SsaInterpretation {
|
||||
id String @id @default(uuid())
|
||||
toolCode String @map("tool_code")
|
||||
scenarioKey String @map("scenario_key") /// significant | not_significant
|
||||
template String @db.Text /// 解读模板(含占位符)
|
||||
placeholders String[] @default([]) /// 占位符列表
|
||||
|
||||
@@unique([toolCode, scenarioKey], map: "uq_ssa_interpretation")
|
||||
@@map("ssa_interpretation_templates")
|
||||
@@schema("ssa_schema")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user