docs: complete documentation system (250+ files)

- System architecture and design documentation
- Business module docs (ASL/AIA/PKB/RVW/DC/SSA/ST)
- ASL module complete design (quality assurance, tech selection)
- Platform layer and common capabilities docs
- Development standards and API specifications
- Deployment and operations guides
- Project management and milestone tracking
- Architecture implementation reports
- Documentation templates and guides
This commit is contained in:
2025-11-16 15:43:55 +08:00
parent 0fe6821a89
commit e52020409c
173 changed files with 46227 additions and 11964 deletions

View File

@@ -0,0 +1,349 @@
# 数据库全局视图
> **目的:** 提供所有Schema和表的快速索引便于查找和理解全局数据架构
> **详细设计:** 请查看各模块的 `01-数据库设计.md`
> **数据库:** PostgreSQL 15+
> **最后更新:** 2025-11-06
---
## 📊 Schema划分策略
### Schema隔离原则 ⭐
**为什么需要Schema隔离**
1.**模块独立性**每个业务模块有独立的Schema
2.**支持独立部署**:可以单独导出某个模块的数据
3.**权限隔离**可以为不同Schema设置不同权限
4.**避免命名冲突**:不同模块可以有相同的表名
**Schema命名规范**
```
platform_schema # 平台基础层(全局共享)
aia_schema # AI智能问答
asl_schema # AI智能文献
pkb_schema # 个人知识库
dc_schema # 数据清洗整理
ssa_schema # 智能统计分析
st_schema # 统计分析工具
rvw_schema # 稿件审查系统
admin_schema # 运营管理端可选可合并到platform_schema
```
---
## 📋 Schema一览表
| Schema | 说明 | 表数量 | 状态 | 详细设计 |
|--------|------|--------|------|---------|
| **platform_schema** | 平台基础层 | ~15个 | ✅ 使用中 | [查看](#platform_schema-平台基础层) |
| **aia_schema** | AI智能问答 | ~8个 | ✅ 使用中 | [查看](#aia_schema-ai智能问答) |
| **pkb_schema** | 个人知识库 | ~5个 | ✅ 使用中 | [查看](#pkb_schema-个人知识库) |
| **rvw_schema** | 稿件审查系统 | ~6个 | ✅ 使用中 | [查看](#rvw_schema-稿件审查系统) |
| **asl_schema** | AI智能文献 | ~10个 | ⏳ 设计中 | [ASL/01-数据库设计](../03-业务模块/ASL-AI智能文献/01-数据库设计.md) |
| **dc_schema** | 数据清洗整理 | ~8个 | ⏳ 规划中 | 待设计 |
| **ssa_schema** | 智能统计分析 | ~10个 | ⏳ 规划中 | 待设计 |
| **st_schema** | 统计分析工具 | ~5个 | ⏳ 规划中 | 待设计 |
**总表数:** ~70个预估
---
## 🔍 platform_schema平台基础层
**职责:** 存储全局共享的平台数据,所有业务模块都依赖
**详细设计:** [UAM/01-数据库设计](../01-平台基础层/01-用户与权限中心(UAM)/01-数据库设计.md)
### 核心表(用户与权限)
| 表名 | 说明 | 记录数预估 | 详细设计 |
|------|------|-----------|---------|
| **users** | 用户基础信息 | 10万/年 | [UAM/01-数据库设计](../01-平台基础层/01-用户与权限中心(UAM)/01-数据库设计.md) |
| **roles** | 角色定义 | <100 | 同上 |
| **permissions** | 权限定义 | <500 | 同上 |
| **user_roles** | 用户-角色关联 | 10万/年 | 同上 |
| **feature_flags** | Feature Flag配置 ⭐ | <100 | 同上 |
| **user_feature_flags** | 用户-Feature Flag关联 ⭐ | 10万/年 | 同上 |
### LLM相关表
| 表名 | 说明 | 记录数预估 | 详细设计 |
|------|------|-----------|---------|
| **llm_models** | LLM模型配置 | <20 | [LLM网关/01-数据库设计](../02-通用能力层/01-LLM大模型网关/01-数据库设计.md) |
| **llm_usage** | LLM使用记录 ⭐ | 1000万/年 | 同上 |
| **llm_quotas** | LLM配额管理 | 10万/年 | 同上 |
### 监控与日志
| 表名 | 说明 | 记录数预估 | 详细设计 |
|------|------|-----------|---------|
| **admin_logs** | 管理员操作日志 | 10万/年 | [监控与日志/01-数据库设计](../01-平台基础层/04-监控与日志/01-数据库设计.md) |
| **error_logs** | 错误日志 | 100万/年 | 同上 |
| **audit_logs** | 审计日志 | 100万/年 | 同上 |
### 系统配置
| 表名 | 说明 | 记录数预估 | 详细设计 |
|------|------|-----------|---------|
| **system_configs** | 系统配置 | <100 | [系统配置/01-数据库设计](../01-平台基础层/05-系统配置/01-数据库设计.md) |
| **prompt_templates** | Prompt模板 | <500 | 同上 |
| **announcements** | 系统公告 | <1000 | 同上 |
---
## 🤖 aia_schemaAI智能问答
**职责:** 存储AI智能问答相关数据12个智能体、对话历史
**状态:** ✅ 已实现
**详细设计:** [AIA/01-数据库设计](../03-业务模块/AIA-AI智能问答/01-数据库设计.md)(待创建)
### 核心表
| 表名 | 说明 | 记录数预估 |
|------|------|-----------|
| **conversations** | 对话会话 | 100万/年 |
| **messages** | 对话消息 | 1000万/年 |
| **agents** | 智能体配置 | <20 |
| **conversation_contexts** | 对话上下文 | 100万/年 |
---
## 📚 pkb_schema个人知识库
**职责:** 存储个人知识库、文档、RAG问答相关数据
**状态:** ✅ 已实现
**详细设计:** [PKB/01-数据库设计](../03-业务模块/PKB-个人知识库/01-数据库设计.md)(待创建)
### 核心表
| 表名 | 说明 | 记录数预估 |
|------|------|-----------|
| **knowledge_bases** | 知识库 | 30万/年 |
| **documents** | 文档 | 300万/年 |
| **document_chunks** | 文档分块(向量化) | 3000万/年 |
| **kb_conversations** | 知识库对话 | 100万/年 |
| **kb_messages** | 知识库对话消息 | 1000万/年 |
---
## 📄 rvw_schema稿件审查系统
**职责:** 存储稿件审查、评估报告相关数据
**状态:** ✅ 已实现(独立系统)
**详细设计:** [RVW/01-数据库设计](../03-业务模块/RVW-稿件审查系统/01-数据库设计.md)(待创建)
### 核心表
| 表名 | 说明 | 记录数预估 |
|------|------|-----------|
| **review_tasks** | 审查任务 | 10万/年 |
| **manuscripts** | 稿件信息 | 10万/年 |
| **review_results** | 审查结果 | 10万/年 |
| **methodology_assessments** | 方法学评估 | 10万/年 |
| **guideline_assessments** | 稿约规范性评估 | 10万/年 |
---
## 📖 asl_schemaAI智能文献
**职责:** 存储文献筛选、提取、分析相关数据
**状态:** ⏳ 设计中P0优先级
**详细设计:** [ASL/01-数据库设计](../03-业务模块/ASL-AI智能文献/01-数据库设计.md)
### 核心表(预览)
| 表名 | 说明 | 记录数预估 |
|------|------|-----------|
| **literature_projects** | 文献项目 | 10万/年 |
| **literature_items** | 文献条目 | 1000万/年 |
| **pico_configs** | PICO纳入排除标准 | 10万/年 |
| **screening_results** | 筛选结果 | 1000万/年 |
| **screening_history** | 筛选历史(可回溯) | 1000万/年 |
| **extraction_tasks** | 提取任务 | 100万/年 |
| **extraction_results** | 提取结果 | 100万/年 |
---
## 🧹 dc_schema数据清洗整理
**职责:** 存储数据清洗任务、ETL配置、NER结果
**状态:** ⏳ 规划中P1优先级
**详细设计:** 待设计
### 核心表(预览)
| 表名 | 说明 | 记录数预估 |
|------|------|-----------|
| **cleaning_projects** | 清洗项目 | 10万/年 |
| **data_sources** | 数据源 | 100万/年 |
| **etl_configs** | ETL配置 | 10万/年 |
| **ner_tasks** | NER任务 | 100万/年 |
| **ner_results** | NER结果 | 1000万/年 |
---
## 🔗 跨Schema依赖关系
### 依赖规则 ⭐ 重要
**允许的依赖:**
```
✅ 业务模块 → platform_schema允许外键
✅ 通用能力 → platform_schema允许外键
❌ 业务模块之间(禁止直接依赖)
❌ platform_schema → 业务模块(反向依赖)
```
### 依赖关系图
```
platform_schema.users (1)
↓ (N) 所有业务模块都依赖用户表
├── aia_schema.conversations
├── asl_schema.literature_projects
├── pkb_schema.knowledge_bases
├── dc_schema.cleaning_projects
├── ssa_schema.analysis_projects
├── st_schema.tool_usage
└── rvw_schema.review_tasks
platform_schema.llm_usage (独立)
- 记录所有模块的LLM调用
- 通过module字段区分'AIA', 'ASL', 'PKB'等
```
### 外键示例
```sql
-- ✅ 允许业务模块引用platform_schema
CREATE TABLE asl_schema.literature_projects (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES platform_schema.users(id) ON DELETE CASCADE
);
-- ❌ 禁止:业务模块之间互相引用
CREATE TABLE ssa_schema.analysis_projects (
id SERIAL PRIMARY KEY,
-- 错误:不能引用其他业务模块
literature_project_id INTEGER REFERENCES asl_schema.literature_projects(id)
);
-- ✅ 正确做法通过user_id关联
-- 在应用层处理跨模块关联,不在数据库层
```
---
## 📊 数据量统计(预估)
### 按Schema统计
| Schema | 表数量 | 年增长记录数 | 存储预估5年 |
|--------|--------|------------|---------------|
| platform_schema | 15 | 1000万 | 50GB |
| aia_schema | 8 | 1100万 | 30GB |
| pkb_schema | 5 | 3300万 | 200GB向量 |
| rvw_schema | 6 | 50万 | 5GB |
| asl_schema | 10 | 2100万 | 50GB |
| dc_schema | 8 | 1100万 | 100GB |
| ssa_schema | 10 | 500万 | 50GB |
| st_schema | 5 | 100万 | 10GB |
| **总计** | **~70** | **~4000万/年** | **~500GB5年** |
### 大表监控(年增长>100万
| 表名 | Schema | 年增长 | 索引策略 |
|------|--------|--------|---------|
| llm_usage | platform | 1000万 | 按月分区 |
| messages | aia | 1000万 | 按created_at索引 |
| document_chunks | pkb | 3000万 | 向量索引 |
| literature_items | asl | 1000万 | 按project_id索引 |
| screening_results | asl | 1000万 | 复合索引 |
---
## 🔍 快速查找指南
### 场景1我要开发某个模块
1. 在上面的表格中找到对应的Schema
2. 点击"详细设计"链接
3. 查看该模块的完整表结构
### 场景2我要查看某个表的结构
1. 先确定表属于哪个Schema根据功能判断
2. 转到对应模块的数据库设计文档
3. 搜索表名
### 场景3我要设计跨模块功能
1. 查看本文档的"跨Schema依赖关系"
2. 遵循依赖规则
3. 在应用层处理跨模块关联,不在数据库层
### 场景4我要查看全局数据架构
1. 阅读本文档快速了解所有Schema
2. 查看[架构设计全景图](../00-系统总体设计/08-架构设计全景图.md)
---
## ⚠️ 重要提醒
### Schema隔离的注意事项
**✅ 正确做法:**
- 业务模块只引用 `platform_schema.users`
- 跨模块数据关联在应用层处理
- 使用 `user_id + 业务ID` 的方式
**❌ 错误做法:**
- 业务模块之间直接外键关联
-`platform_schema` 中存储业务数据
- 不同模块使用相同的表名虽然Schema隔离了但容易混淆
### 性能优化建议
1. **大表必须分页查询**(如 `llm_usage``messages`
2. **热点字段必须加索引**(如 `user_id``created_at`
3. **考虑表分区**(按月/按年,如 `llm_usage`
4. **定期归档历史数据**如1年前的日志
---
## 🔗 相关文档
**规范:**
- [数据库设计规范](./01-数据库设计规范.md) ⭐ 必读
- [数据库架构说明](../00-系统总体设计/03-数据库架构说明.md)
**模块设计:**
- [平台基础层](../01-平台基础层/README.md)
- [通用能力层](../02-通用能力层/README.md)
- [业务模块层](../03-业务模块/README.md)
**模板:**
- [数据库设计模板](../_templates/数据库设计-模板.md)
---
**最后更新:** 2025-11-06
**维护人:** 技术架构师
**版本:** v1.0