Files
AIclinicalresearch/docs/03-业务模块/DC-数据清洗整理/01-需求分析/PRD:智能数据清洗工作台 (The Data Cleaning Portal).md
HaHafeng 66255368b7 feat(admin): Add user management and upgrade to module permission system
Features - User Management (Phase 4.1):
- Database: Add user_modules table for fine-grained module permissions
- Database: Add 4 user permissions (view/create/edit/delete) to role_permissions
- Backend: UserService (780 lines) - CRUD with tenant isolation
- Backend: UserController + UserRoutes (648 lines) - 13 API endpoints
- Backend: Batch import users from Excel
- Frontend: UserListPage (412 lines) - list/filter/search/pagination
- Frontend: UserFormPage (341 lines) - create/edit with module config
- Frontend: UserDetailPage (393 lines) - details/tenant/module management
- Frontend: 3 modal components (592 lines) - import/assign/configure
- API: GET/POST/PUT/DELETE /api/admin/users/* endpoints

Architecture Upgrade - Module Permission System:
- Backend: Add getUserModules() method in auth.service
- Backend: Login API returns modules array in user object
- Frontend: AuthContext adds hasModule() method
- Frontend: Navigation filters modules based on user.modules
- Frontend: RouteGuard checks requiredModule instead of requiredVersion
- Frontend: Remove deprecated version-based permission system
- UX: Only show accessible modules in navigation (clean UI)
- UX: Smart redirect after login (avoid 403 for regular users)

Fixes:
- Fix UTF-8 encoding corruption in ~100 docs files
- Fix pageSize type conversion in userService (String to Number)
- Fix authUser undefined error in TopNavigation
- Fix login redirect logic with role-based access check
- Update Git commit guidelines v1.2 with UTF-8 safety rules

Database Changes:
- CREATE TABLE user_modules (user_id, tenant_id, module_code, is_enabled)
- ADD UNIQUE CONSTRAINT (user_id, tenant_id, module_code)
- INSERT 4 permissions + role assignments
- UPDATE PUBLIC tenant with 8 module subscriptions

Technical:
- Backend: 5 new files (~2400 lines)
- Frontend: 10 new files (~2500 lines)
- Docs: 1 development record + 2 status updates + 1 guideline update
- Total: ~4900 lines of code

Status: User management 100% complete, module permission system operational
2026-01-16 13:42:10 +08:00

89 lines
4.5 KiB
Markdown
Raw Permalink 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.
# **PRD智能数据清洗工作台 (The Data Cleaning Portal)**
| 文档版本 | V1.0 (基于原型 V2) |
| :---- | :---- |
| **产品形态** | Web 端综合仪表盘 (Dashboard) |
| **核心价值** | 作为数据清洗模块的统一入口,提供工具启动、异步任务监控、数据资产管理及跨工具流转能力。 |
| **目标用户** | 临床医生、科研助理 |
## **一、 产品架构图 (Product Architecture)**
工作台处于系统的二级导航位置,向下连接三个具体工具,横向连接任务与数据。
全局导航 \-\> **工作台 (本PRD)** \-\> (工具 A, 工具 B, 工具 C)
## **二、 核心功能需求 (Functional Requirements)**
### **1\. 全局导航集成 (Global Navigation)**
* **P0:** 必须无缝嵌入现有系统顶部导航栏。
* **位置:** 位于 知识库 与 智能数据分析 之间。
* **状态:** 点击后高亮显示“智能数据清洗”。
### **2\. 工具启动区 (The Launcher)**
* **P0:** **三卡片入口:** 醒目展示三个核心工具的入口卡片。
* **工具 A (超级合并器):** 强调“多源数据合并、ID对齐”。
* **工具 B (病历结构化机器人):** 强调“AI 提取、非结构化转结构化”。
* **工具 C (科研数据编辑器):** 强调“在线清洗、缺失值处理”。
* **交互:** 点击卡片,以**全屏模态框**或**新页面**形式打开对应工具。
### **3\. 任务流转中心 (Task Flow Hub) —— 核心交互**
* **P0:** **最近任务列表:** 展示用户最近发起的 10 条任务。
* **字段定义:** 任务名称 | 所属工具(A/B/C) | 状态(处理中/完成/失败) | 进度条 | 操作。
* **P0:** **状态实时更新:**
* **处理中:** 显示动态进度条(如 45%)。
* **失败:** 显示红色警告,支持查看错误日志。
* **P0:** **智能流转操作 (Smart Action)**
* 基于任务类型,动态推荐下一步操作:
* **工具 A 完成后:** 显示按钮 \[下载\] 和 \[去 AI 提取\] (跳转工具 B)。
* **工具 B 完成后:** 显示按钮 \[下载\] 和 \[去清洗\] (跳转工具 C)。
* **工具 C 完成后:** 显示按钮 \[下载\]。
### **4\. 数据资产库 (Data Asset Library) —— V2 核心升级**
* **P0:** **Tab 分栏视图:**
* **\[全部\]**
* **\[处理结果\] (Outputs):** 存放工具 A/B/C 生成的最终文件。图标使用绿色/蓝色区分。
* **\[原始上传\] (Inputs):** 存放用户直接上传的底表。图标使用灰色区分。
* **P0:** **资产卡片信息:**
* 文件名、标签(如“已清洗”、“已脱敏”)、行数、修改时间。
* **P0:** **快捷操作 (Hover Actions):**
* 鼠标悬停在卡片上时,显示操作按钮:
* \[下载\]: 下载到本地。
* \[去处理\]: 如果是原始文件,点击跳转到工具选择页(或默认工具 A
* \[分析\]: 如果是处理结果,点击跳转到“智能数据分析”模块(未来规划)。
* **P0:** **原始文件上传入口:**
* 底部固定按钮 \[+ 上传原始文件到库\],允许用户将本地 Excel 存入云端备用。
## **三、 界面原型参考 (UI Reference)**
请严格参考 智能数据清洗工作台\_原型演示\_V2.html。
* **布局:** 顶部为 Launcher下方分为左右两栏左 2/3 为任务,右 1/3 为资产)。
* **视觉风格:**
* 工具 A蓝色系 (Blue)
* 工具 B紫色系 (Purple)
* 工具 C翠绿色系 (Emerald)
* 状态色:处理中(蓝)、成功(绿)、失败(红)、警告(橙)。
## **四、 数据交互逻辑 (Data Logic)**
1. **任务轮询 (Polling):**
* 工作台加载时,调用 GET /api/tasks/recent。
* 若列表中有状态为 processing 的任务,每隔 5 秒轮询一次状态更新,直到完成。
2. **跨工具流转 (Handoff):**
* 当用户点击 \[去 AI 提取\] 时:
* 前端获取该任务的 resultFileId。
* 跳转路由至 /tools/b?sourceFileId={resultFileId}。
* 工具 B 初始化时,自动加载该文件,无需用户重新上传。
3. **资产管理:**
* 工具 A/B/C 产生的最终结果,需自动注册到 DataAsset 表中,并标记 type='output'。
* 用户手动上传的文件,注册为 type='input'。
## **五、 埋点与统计需求**
* **UV/PV:** 工作台访问量。
* **CTR:** 三个工具卡片的点击率(判断哪个工具最常用)。
* **流转率:** 用户点击“去 AI 提取”等流转按钮的比例(判断工作流是否顺畅)。