Major features: 1. Missing value imputation (6 simple methods + MICE): - Mean/Median/Mode/Constant imputation - Forward fill (ffill) and Backward fill (bfill) for time series - MICE multivariate imputation (in progress, shape issue to fix) 2. Auto precision detection: - Automatically match decimal places of original data - Prevent false precision (e.g. 13.57 instead of 13.566716417910449) 3. Categorical variable detection: - Auto-detect and skip categorical columns in MICE - Show warnings for unsuitable columns - Suggest mode imputation for categorical data 4. UI improvements: - Rename button: "Delete Missing" to "Missing Value Handling" - Remove standalone "Dedup" and "MICE" buttons - 3-tab dialog: Delete / Fill / Advanced Fill - Display column statistics and recommended methods - Extended warning messages (8 seconds for skipped columns) 5. Bug fixes: - Fix sessionService.updateSessionData -> saveProcessedData - Fix OperationResult interface (add message and stats) - Fix Toolbar button labels and removal Modified files: Python: operations/fillna.py (new, 556 lines), main.py (3 new endpoints) Backend: QuickActionService.ts, QuickActionController.ts, routes/index.ts Frontend: MissingValueDialog.tsx (new, 437 lines), Toolbar.tsx, index.tsx Tests: test_fillna_operations.py (774 lines), test scripts and docs Docs: 5 documentation files updated Known issues: - MICE imputation has DataFrame shape mismatch issue (under debugging) - Workaround: Use 6 simple imputation methods first Status: Development complete, MICE debugging in progress Lines added: ~2000 lines across 3 tiers
AI临床研究平台 - 后端服务
🏠 导航
快速开始
1. 环境要求
- Node.js >= 18
- PostgreSQL 15+
- Redis 7+
2. 安装依赖
npm install
3. 配置环境变量
复制.env.example到.env并配置:
cp .env.example .env
4. 初始化数据库
# 生成Prisma Client
npm run prisma:generate
# 执行数据库迁移
npm run prisma:migrate
# (可选)打开Prisma Studio查看数据
npm run prisma:studio
5. 启动开发服务器
npm run dev
服务器将在 http://localhost:3001 启动
6. 验证服务
访问以下端点验证服务是否正常:
- 健康检查: http://localhost:3001/health
- API入口: http://localhost:3001/api/v1
项目结构
backend/
├── prisma/
│ └── schema.prisma # 数据库模型定义
├── src/
│ ├── config/
│ │ ├── env.ts # 环境变量配置
│ │ └── database.ts # 数据库连接
│ ├── controllers/ # 控制器层
│ ├── services/ # 业务逻辑层
│ ├── routes/ # 路由定义
│ ├── types/ # TypeScript类型定义
│ ├── utils/ # 工具函数
│ └── index.ts # 应用入口
├── .env # 环境变量(不提交到Git)
├── .env.example # 环境变量模板
├── package.json # 项目配置
└── tsconfig.json # TypeScript配置
NPM Scripts
npm run dev- 启动开发服务器(hot reload)npm run build- 构建生产版本npm run start- 启动生产服务器npm run prisma:generate- 生成Prisma Clientnpm run prisma:migrate- 执行数据库迁移npm run prisma:studio- 打开Prisma Studio
数据库设计
详见:../docs/01-设计文档/数据库设计文档.md
API文档
详见:../docs/01-设计文档/API设计规范.md
技术栈
- 框架: Fastify
- ORM: Prisma
- 数据库: PostgreSQL
- 缓存: Redis
- 语言: TypeScript
- 日志: Pino
Day 5 完成情况
✅ 初始化后端项目(Node.js + TypeScript) ✅ 配置Fastify框架 ✅ 配置Prisma ORM ✅ 创建数据库表(执行迁移) ✅ 数据库连接测试通过
所有核心功能已完成!🎉