98d862dbd4
feat(aia): Complete AIA V2.0 and sync all changes
...
AIA V2.0 Major Updates:
- Add StreamingService with OpenAI Compatible format (backend/common/streaming)
- Upgrade Chat component V2 with Ant Design X deep integration
- Implement 12 intelligent agents (5 phases: topic/design/review/data/writing)
- Create AgentHub with 100% prototype V11 restoration
- Create ChatWorkspace with fullscreen immersive experience
- Add ThinkingBlock for deep thinking display
- Add useAIStream Hook for stream handling
- Add ConversationList for conversation management
Backend (~1300 lines):
- common/streaming: OpenAI adapter and streaming service
- modules/aia: 12 agents config, conversation service, attachment service
- Unified API routes to /api/v1 (RVW, PKB, AIA modules)
- Update authentication and permission helpers
Frontend (~3500 lines):
- modules/aia: AgentHub + ChatWorkspace + AgentCard components
- shared/Chat: AIStreamChat, ThinkingBlock, useAIStream, useConversations
- Update all modules API endpoints to v1
- Modern design with theme colors (blue/yellow/teal/purple)
Documentation (~2500 lines):
- AIA module status and development guide
- Universal capabilities catalog (11 services)
- Quick reference card
- System overview updates
- All module documentation synchronization
Other Updates:
- DC Tool C: Python operations and frontend components
- IIT Manager: session memory and wechat service
- PKB/RVW/ASL: API route updates
- Docker configs and deployment scripts
- Database migrations and scripts
- Test files and documentation
Tested: AIA streaming verified, authentication working, core features functional
Status: AIA V2.0 completed (85%), all changes synchronized
2026-01-14 19:19:00 +08:00
1b53ab9d52
feat(aia): Complete AIA V2.0 with universal streaming capabilities
...
Major Changes:
- Add StreamingService with OpenAI Compatible format
- Upgrade Chat component V2 with Ant Design X integration
- Implement AIA module with 12 intelligent agents
- Update API routes to unified /api/v1 prefix
- Update system documentation
Backend (~1300 lines):
- common/streaming: OpenAI Compatible adapter
- modules/aia: 12 agents, conversation service, streaming integration
- Update route versions (RVW, PKB to v1)
Frontend (~3500 lines):
- modules/aia: AgentHub + ChatWorkspace (100% prototype restoration)
- shared/Chat: AIStreamChat, ThinkingBlock, useAIStream Hook
- Update API endpoints to v1
Documentation:
- AIA module status guide
- Universal capabilities catalog
- System overview updates
- All module documentation sync
Tested: Stream response verified, authentication working
Status: AIA V2.0 core completed (85%)
2026-01-14 19:15:01 +08:00
3d35e9c58b
feat(aia): Complete AIA V2.0 with universal streaming capabilities
...
Major Updates:
- Add StreamingService with OpenAI Compatible format (backend/common/streaming)
- Upgrade Chat component V2 with Ant Design X integration
- Implement AIA module with 12 intelligent agents
- Create AgentHub with 100% prototype V11 restoration
- Create ChatWorkspace with streaming response support
- Add ThinkingBlock for deep thinking display
- Add useAIStream Hook for OpenAI Compatible stream handling
Backend Common Capabilities (~400 lines):
- OpenAIStreamAdapter: SSE adapter with OpenAI format
- StreamingService: unified streaming service
- Support content and reasoning_content dual streams
- Deep thinking tag processing (<think>...</think>)
Frontend Common Capabilities (~2000 lines):
- AIStreamChat: modern streaming chat component
- ThinkingBlock: collapsible deep thinking display
- ConversationList: conversation management with grouping
- useAIStream: OpenAI Compatible stream handler Hook
- useConversations: conversation state management Hook
- Modern design styles (Ultramodern theme)
AIA Module Frontend (~1500 lines):
- AgentHub: 12 agent cards with timeline design
- ChatWorkspace: fullscreen immersive chat interface
- AgentCard: theme-colored cards (blue/yellow/teal/purple)
- 5 phases, 12 agents configuration
- Responsive layout (desktop + mobile)
AIA Module Backend (~900 lines):
- agentService: 12 agents config with system prompts
- conversationService: refactored with StreamingService
- attachmentService: file upload skeleton (30k token limit)
- 12 API endpoints with authentication
- Full CRUD for conversations and messages
Documentation:
- AIA module status and development guide
- Universal capabilities catalog (11 services)
- Quick reference card for developers
- System overview updates
Testing:
- Stream response verified (HTTP 200)
- Authentication working correctly
- Auto conversation creation working
- Deep thinking display working
- Message input and send working
Status: Core features completed (85%), attachment and history loading pending
2026-01-14 19:09:28 +08:00
4ed67a8846
fix(admin): Fix Prompt management list not showing version info and add debug diagnostics
...
Summary:
- Fix Prompt list API response schema missing activeVersion and draftVersion fields
- Fastify was filtering out undefined schema fields, causing version columns to show empty
- Add detailed diagnostic logging for Prompt debug mode troubleshooting
- Verify debug mode works correctly (DRAFT version is used when debug enabled)
Changes:
- backend/src/common/prompt/prompt.routes.ts: Add activeVersion and draftVersion to response schema
- backend/src/common/prompt/prompt.service.ts: Add diagnostic logs for setDebugMode and get methods
- PKB module: Various authentication and document handling fixes from previous session
Tested: Debug mode verified working - v2 DRAFT version correctly loaded when debug enabled
2026-01-13 22:22:10 +08:00
4088275290
fix(pkb): fix create KB and upload issues - remove simulated upload, fix department mapping, add upload modal
...
Fixed issues:
- Remove simulateUpload function from DashboardPage Step 3
- Map department to description field when creating KB
- Add upload modal in WorkspacePage knowledge assets tab
- Fix DocumentUpload import path (../../stores to ../stores)
Known issue: Dify API validation error during document upload (file uploaded but DB record failed, needs investigation)
Testing: KB creation works, upload dialog opens correctly
2026-01-13 13:17:20 +08:00
d595037316
feat(admin): Complete tenant management and module access control system
...
Major Features:
- Tenant management CRUD (list, create, edit, delete, module configuration)
- Dynamic module management system (modules table with 8 modules)
- Multi-tenant module permission merging (ModuleService)
- Module access control middleware (requireModule)
- User module permission API (GET /api/v1/auth/me/modules)
- Frontend module permission filtering (HomePage + TopNavigation)
Module Integration:
- RVW module integrated with PromptService (editorial + methodology)
- All modules (RVW/PKB/ASL/DC) added authenticate + requireModule middleware
- Fixed ReviewTask foreign key constraint (cross-schema issue)
- Removed all MOCK_USER_ID, unified to request.user?.userId
Prompt Management Enhancements:
- Module names displayed in Chinese (RVW -> 智能审稿)
- Enhanced version history with view content and rollback features
- List page shows both activeVersion and draftVersion columns
Database Changes:
- Added platform_schema.modules table
- Modified tenant_modules table (added index and UUID)
- Removed ReviewTask foreign key to public.users (cross-schema fix)
- Seeded 8 modules: RVW, PKB, ASL, DC, IIT, AIA, SSA, ST
Documentation Updates:
- Updated ADMIN module development status
- Updated TODO checklist (89% progress)
- Updated Prompt management plan (Phase 3.5.5 completed)
- Added module authentication specification
Files Changed: 80+
Status: All features tested and verified locally
Next: User management module development
2026-01-13 07:34:30 +08:00
5523ef36ea
feat(admin): Complete Phase 3.5.1-3.5.4 Prompt Management System (83%)
...
Summary:
- Implement Prompt management infrastructure and core services
- Build admin portal frontend with light theme
- Integrate CodeMirror 6 editor for non-technical users
Phase 3.5.1: Infrastructure Setup
- Create capability_schema for Prompt storage
- Add prompt_templates and prompt_versions tables
- Add prompt:view/edit/debug/publish permissions
- Migrate RVW prompts to database (RVW_EDITORIAL, RVW_METHODOLOGY)
Phase 3.5.2: PromptService Core
- Implement gray preview logic (DRAFT for debuggers, ACTIVE for users)
- Module-level debug control (setDebugMode)
- Handlebars template rendering
- Variable extraction and validation (extractVariables, validateVariables)
- Three-level disaster recovery (database -> cache -> hardcoded fallback)
Phase 3.5.3: Management API
- 8 RESTful endpoints (/api/admin/prompts/*)
- Permission control (PROMPT_ENGINEER can edit, SUPER_ADMIN can publish)
Phase 3.5.4: Frontend Management UI
- Build admin portal architecture (AdminLayout, OrgLayout)
- Add route system (/admin/*, /org/*)
- Implement PromptListPage (filter, search, debug switch)
- Implement PromptEditor (CodeMirror 6 simplified for clinical users)
- Implement PromptEditorPage (edit, save, publish, test, version history)
Technical Details:
- Backend: 6 files, ~2044 lines (prompt.service.ts 596 lines)
- Frontend: 9 files, ~1735 lines (PromptEditorPage.tsx 399 lines)
- CodeMirror 6: Line numbers, auto-wrap, variable highlight, search, undo/redo
- Chinese-friendly: 15px font, 1.8 line-height, system fonts
Next Step: Phase 3.5.5 - Integrate RVW module with PromptService
Tested: Backend API tests passed (8/8), Frontend pending user testing
Status: Ready for Phase 3.5.5 RVW integration
2026-01-11 21:25:16 +08:00
6ae0dc8304
chore(rvw): Migrate review_tasks table to rvw_schema
...
Database migration:
- Move review_tasks table from public to rvw_schema
- Update Prisma schema @@schema directive
- Regenerate Prisma Client
Verified:
- Table location: rvw_schema
- Prisma ORM queries: working
- Data integrity: 40 records preserved
- User relation: working
Documentation updated to reflect schema migration complete.
2026-01-10 23:09:14 +08:00
440f75255e
feat(rvw): Complete Phase 4-5 - Bug fixes and Word export
...
Summary:
- Fix methodology score display issue in task list (show score instead of 'warn')
- Add methodology_score field to database schema
- Fix report display when only methodology agent is selected
- Implement Word document export using docx library
- Update documentation to v3.0/v3.1
Backend changes:
- Add methodologyScore to Prisma schema and TaskSummary type
- Update reviewWorker to save methodologyScore
- Update getTaskList to return methodologyScore
Frontend changes:
- Install docx and file-saver libraries
- Implement handleExportReport with Word generation
- Fix activeTab auto-selection based on available data
- Add proper imports for docx components
Documentation:
- Update RVW module status to 90% (Phase 1-5 complete)
- Update system status document to v3.0
Tested: All review workflows verified, Word export functional
2026-01-10 22:52:15 +08:00
179afa2c6b
feat(rvw): Complete RVW module development Phase 1-3
...
Summary:
- Migrate backend to modules/rvw with v2 API routes (/api/v2/rvw)
- Add new database fields: selectedAgents, editorialScore, methodologyStatus, picoExtract, isArchived
- Create frontend module in frontend-v2/src/modules/rvw
- Implement Dashboard with task list, filtering, batch operations
- Implement ReportDetail with dual tabs (editorial/methodology)
- Implement AgentModal for intelligent agent selection
- Register RVW module in moduleRegistry.ts
- Add navigation entry in TopNavigation
- Update documentation for RVW module status (v3.0)
- Update system status document (v2.9)
Features:
- User can select agents: editorial, methodology, or both
- Support batch task execution
- Task status filtering
- Replace console.log with logger service
- Maintain v1 API backward compatibility
Tested: Frontend and backend verified locally
Status: 85% complete (Phase 1-3 done)
2026-01-07 22:39:08 +08:00
06028c6952
feat(pkb): implement complete batch processing workflow and frontend optimization
...
- Frontend V3 architecture migration to modules/pkb
- Implement three work modes: full-text reading, deep reading, batch processing
- Complete batch processing: template selection, progress display, result export (CSV)
- Integrate Ant Design X Chat component with streaming support
- Add document upload modal with drag-and-drop support
- Optimize UI: multi-line table display, citation formatting, auto-scroll
- Fix 10+ technical issues: API mapping, state sync, form clearing
- Update documentation: development records and module status
Performance: 3 docs batch processing ~17-28s
Status: PKB module now production-ready (90% complete)
2026-01-07 18:23:43 +08:00
e59676342a
docs(pkb): Add development records and update system status
...
Summary:
- Add PKB module development record for 2026-01-07
- Create PKB module status document (00-模块当前状态与开发指南.md)
- Update system status document to v2.7
Documents added:
- docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07_PKB模块前端V3设计实现.md
- docs/03-业务模块/PKB-个人知识库/00-模块当前状态与开发指南.md
Documents updated:
- docs/00-系统总体设计/00-系统当前状态与开发指南.md
PKB module progress: 75% complete
- Frontend Dashboard: 90%
- Frontend Workspace: 85%
- 3 work modes implemented
- Batch processing API pending debug
2026-01-07 10:35:03 +08:00
5a17d096a7
feat(pkb): Complete PKB module frontend migration with V3 design
...
Summary:
- Implement PKB Dashboard and Workspace pages based on V3 prototype
- Add single-layer header with integrated Tab navigation
- Implement 3 work modes: Full Text, Deep Read, Batch Processing
- Integrate Ant Design X Chat component for AI conversations
- Create BatchModeComplete with template selection and document processing
- Add compact work mode selector with dropdown design
Backend:
- Migrate PKB controllers and services to /modules/pkb structure
- Register v2 API routes at /api/v2/pkb/knowledge
- Maintain dual API routes for backward compatibility
Technical details:
- Use Zustand for state management
- Handle SSE streaming responses for AI chat
- Support document selection for Deep Read mode
- Implement batch processing with progress tracking
Known issues:
- Batch processing API integration pending
- Knowledge assets page navigation needs optimization
Status: Frontend functional, pending refinement
2026-01-06 22:15:42 +08:00
b31255031e
feat(iit-manager): Add WeChat Official Account integration for patient notifications
...
Features:
- PatientWechatCallbackController for URL verification and message handling
- PatientWechatService for template and customer messages
- Support for secure mode (message encryption/decryption)
- Simplified route /wechat/patient/callback for WeChat config
- Event handlers for subscribe/unsubscribe/text messages
- Template message for visit reminders
Technical details:
- Reuse @wecom/crypto for encryption (compatible with Official Account)
- Relaxed Fastify schema validation to prevent early request blocking
- Access token caching (7000s with 5min pre-refresh)
- Comprehensive logging for debugging
Testing: Local URL verification passed, ready for SAE deployment
Status: Code complete, waiting for WeChat platform configuration
2026-01-04 22:53:42 +08:00
dfc472810b
feat(iit-manager): Integrate Dify knowledge base for hybrid retrieval
...
Completed features:
- Created Dify dataset (Dify_test0102) with 2 processed documents
- Linked test0102 project with Dify dataset ID
- Extended intent detection to recognize query_protocol intent
- Implemented queryDifyKnowledge method (semantic search Top 5)
- Integrated hybrid retrieval (REDCap data + Dify documents)
- Fixed AI hallucination bugs (intent detection + API field path)
- Developed debugging scripts
- Completed end-to-end testing (5 scenarios passed)
- Generated comprehensive documentation (600+ lines)
- Updated development plans and module status
Technical highlights:
- Single project single knowledge base architecture
- Smart routing based on user intent
- Prevent AI hallucination by injecting real data/documents
- Session memory for multi-turn conversations
- Reused LLMFactory for DeepSeek-V3 integration
Bug fixes:
- Fixed intent detection missing keywords
- Fixed Dify API response field path error
Testing: All scenarios verified in WeChat production environment
Status: Fully tested and deployed
2026-01-04 15:44:11 +08:00
b47079b387
feat(iit): Phase 1.5 AI对话集成REDCap真实数据完成
...
- feat: ChatService集成DeepSeek-V3实现AI对话(390行)
- feat: SessionMemory实现上下文记忆(最近3轮对话,170行)
- feat: 意图识别支持REDCap数据查询(关键词匹配)
- feat: REDCap数据注入LLM(queryRedcapRecord, countRedcapRecords, getProjectInfo)
- feat: 解决LLM幻觉问题(基于真实数据回答,明确system prompt)
- feat: 即时反馈(正在查询...提示)
- test: REDCap查询测试通过(test0102项目,10条记录,ID 7患者详情)
- docs: 创建Phase1.5开发完成记录(313行)
- docs: 更新Phase1.5开发计划(标记完成)
- docs: 更新MVP开发任务清单(Phase 1.5完成)
- docs: 更新模块当前状态(60%完成度)
- docs: 更新系统总体设计文档(v2.6)
- chore: 删除测试脚本(test-redcap-query-for-ai.ts, check-env-config.ts)
- chore: 移除REDCap测试环境变量(REDCAP_TEST_*)
技术亮点:
- AI基于REDCap真实数据对话,不编造信息
- 从数据库读取项目配置,不使用环境变量
- 企业微信端测试通过,用户体验良好
测试通过:
- 查询项目记录总数(10条)
- 查询特定患者详情(ID 7)
- 项目信息查询
- 上下文记忆(3轮对话)
- 即时反馈提示
影响范围:IIT Manager Agent模块
2026-01-03 22:48:10 +08:00
4794640f5d
feat(iit): Phase 1.5 AI对话能力集成 - 复用通用能力层LLMFactory
...
新增功能
- SessionMemory: 会话记忆管理器(存储最近3轮对话)
- ChatService: AI对话服务(复用LLMFactory,支持DeepSeek-V3)
- WechatCallbackController: 集成AI对话 + '正在查询'即时反馈
技术亮点
- 复用通用能力层LLMFactory(零配置,单例模式)
- 上下文记忆(SessionMemory,Node.js内存,自动清理过期会话)
- 即时反馈(立即回复'正在查询,请稍候...',规避5秒超时)
- 极简MVP(<300行代码,1天完成)
文档更新
- Phase1.5开发计划文档(反映通用能力层复用优势)
完成度
- Phase 1.5核心功能:100%
- 预估工作量:2-3天 实际:1天(LLM调用层已完善)
Scope: iit-manager
2026-01-03 16:42:46 +08:00
6a567f028f
feat(iit-manager): 完成MVP闭环 - 企业微信集成与端到端测试
...
核心交付物:
- WechatService (314行): Access Token缓存 + 消息推送
- WechatCallbackController (501行): URL验证 + 消息接收
- 质控Worker完善: 质控逻辑 + 企业微信推送 + 审计日志
- Worker注册修复: initIitManager() 在启动时调用
- 数据库字段修复: action -> action_type
- 端到端测试通过: <2秒延迟, 100%成功率
性能指标:
- Webhook响应: 5.8ms (目标<10ms)
- Worker执行: ~50ms (目标<100ms)
- 端到端延迟: <2秒 (目标<5秒)
- 消息成功率: 100% (测试5次)
临时措施:
- UserID从环境变量获取 (Phase 2改进)
- 定时轮询暂时禁用 (Phase 2添加)
- 质控逻辑简化 (Phase 1.5集成Dify)
Closes #IIT-MVP-Day3
2026-01-03 14:19:08 +08:00
5f089516cb
feat(iit-manager): Day 3 企业微信集成开发完成
...
- 新增WechatService(企业微信推送服务,支持文本/卡片/Markdown消息)
- 新增WechatCallbackController(异步回复模式,5秒内响应)
- 完善iit_quality_check Worker(调用WechatService推送通知)
- 新增企业微信回调路由(GET验证+POST接收消息)
- 实现LLM意图识别(query_weekly_summary/query_patient_info等)
- 安装依赖:@wecom/crypto, xml2js
- 更新开发记录文档和MVP开发计划
技术要点:
- 使用异步回复模式规避企业微信5秒超时限制
- 使用@wecom/crypto官方库处理XML加解密
- 使用setImmediate实现后台异步处理
- 支持主动推送消息返回LLM处理结果
- 完善审计日志记录(WECHAT_NOTIFICATION_SENT/WECHAT_INTERACTION)
相关文档:
- docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成开发完成记录.md
- docs/03-业务模块/IIT Manager Agent/04-开发计划/最小MVP闭环开发计划.md
- docs/03-业务模块/IIT Manager Agent/00-模块当前状态与开发指南.md
2026-01-03 09:39:39 +08:00
36ce1bbcb2
feat(iit): Complete Day 3 - WeChat Work integration and URL verification
...
Summary:
- Implement WechatService (314 lines, push notifications)
- Implement WechatCallbackController (501 lines, async reply mode)
- Complete iit_quality_check Worker with WeChat notifications
- Configure WeChat routes (GET + POST /wechat/callback)
- Configure natapp tunnel for local development
- WeChat URL verification test passed
Technical Highlights:
- Async reply mode to avoid 5-second timeout
- Message encryption/decryption using @wecom/crypto
- Signature verification using getSignature
- natapp tunnel: https://iit.nat100.top
- Environment variables configuration completed
Technical Challenges Solved:
- Fix environment variable naming (WECHAT_CORP_SECRET)
- Fix @wecom/crypto import (createRequire for CommonJS)
- Fix decrypt function parameters (2 params, not 4)
- Fix Token character recognition (lowercase l vs digit 1)
- Regenerate EncodingAESKey (43 chars, correct format)
- Configure natapp for internal network penetration
Test Results:
- WeChat developer tool verification: PASSED
- Return status: request success
- HTTP 200, decrypted 23 characters correctly
- Backend logs: URL verification successful
Documentation:
- Add Day3 WeChat integration development record
- Update MVP development task list (Day 2-3 completed)
- Update module status guide (v1.2 -> v1.3)
- Overall completion: 35% -> 50%
Progress:
- Module completion: 35% -> 50%
- Day 3 development: COMPLETED
- Ready for end-to-end testing (REDCap -> WeChat)
2026-01-03 00:13:36 +08:00
2eef7522a1
feat(iit): Complete Day 2 - REDCap real-time integration
...
Summary:
- Implement RedcapAdapter (271 lines, 7 API methods)
- Implement WebhookController (327 lines, <10ms response)
- Implement SyncManager (398 lines, incremental/full sync)
- Register Workers (iit_quality_check + iit_redcap_poll)
- Configure routes with form-urlencoded parser
- Add 3 integration test scripts (912 lines total)
- Complete development documentation
Technical Highlights:
- REDCap DET real-time trigger (0ms delay)
- Webhook + scheduled polling dual mechanism
- Form-urlencoded format support for REDCap DET
- Postgres-Only architecture with pg-boss queue
- Full compliance with team development standards
Test Results:
- Integration tests: 12/12 passed
- Real scenario validation: PASSED
- Performance: Webhook response <10ms
- Data accuracy: 100%
Progress:
- Module completion: 18% -> 35%
- Day 2 development: COMPLETED
- Production ready: YES
2026-01-02 18:20:18 +08:00
bdfca32305
docs(iit): REDCap对接技术方案完成与模块状态更新
...
- 新增《REDCap对接技术方案与实施指南》(1070行)
- 确定DET+REST API技术方案(不使用External Module)
- 完整RedcapAdapter/WebhookController/SyncManager代码设计
- Day 2详细实施步骤与验收标准
- 更新《IIT Manager Agent模块当前状态与开发指南》
- 记录REDCap本地环境部署完成(15.8.0)
- 记录对接方案确定过程与技术决策
- 更新Day 2工作计划(6个阶段详细清单)
- 整体进度18%(Day 1完成+REDCap环境就绪)
- REDCap环境准备完成
- 测试项目test0102(PID 16)创建成功
- DET功能源码验证通过
- 本地Docker环境稳定运行
技术方案:
- 实时触发: Data Entry Trigger (0秒延迟)
- 数据拉取: REST API exportRecords (增量同步)
- 轮询补充: pg-boss定时任务 (每30分钟)
- 可靠性: Webhook幂等性 + 轮询补充机制
2026-01-02 14:30:38 +08:00
dac3cecf78
feat(iit): Complete IIT Manager Agent Day 1 - Environment initialization and WeChat integration
...
Summary:
- Complete IIT Manager Agent MVP Day 1 (12.5% progress)
- Database: Create iit_schema with 5 tables (IitProject, IitPendingAction, IitTaskRun, IitUserMapping, IitAuditLog)
- Backend: Add module structure (577 lines) and types (223 lines)
- WeChat: Configure Enterprise WeChat app (CorpID, AgentID, Secret)
- WeChat: Obtain web authorization and JS-SDK authorization
- WeChat: Configure trusted domain (iit.xunzhengyixue.com)
- Frontend: Deploy v1.2 with WeChat domain verification file
- Frontend: Fix CRLF issue in docker-entrypoint.sh (CRLF -> LF)
- Testing: 11/11 database CRUD tests passed
- Testing: Access Token retrieval test passed
- Docs: Create module status and development guide
- Docs: Update MVP task list with Day 1 completion
- Docs: Rename deployment doc to SAE real-time status record
- Deployment: Update frontend internal IP to 172.17.173.80
Technical Details:
- Prisma: Multi-schema support (iit_schema)
- pg-boss: Job queue integration prepared
- Taro 4.x: Framework selected for WeChat Mini Program
- Shadow State: Architecture foundation laid
- Docker: Fix entrypoint script line endings for Linux container
Status: Day 1/14 complete, ready for Day 2 REDCap integration
2026-01-01 14:32:58 +08:00
4c5bb3d174
feat(iit): Initialize IIT Manager Agent MVP - Day 1 complete
...
- Add iit_schema with 5 tables
- Create module structure and types (223 lines)
- WeChat integration verified (Access Token success)
- Update system docs to v2.4
- Add REDCap source folders to .gitignore
- Day 1/14 complete (11/11 tasks)
2025-12-31 18:35:05 +08:00
decff0bb1f
docs(deploy): Complete full system deployment to Aliyun SAE
...
Summary:
- Successfully deployed complete system to Aliyun SAE (2025-12-25)
- All services running: Python microservice + Node.js backend + Frontend Nginx + CLB
- Public access available at http://8.140.53.236/
Major Achievements:
1. Python microservice deployed (v1.0, internal IP: 172.17.173.66:8000)
2. Node.js backend deployed (v1.3, internal IP: 172.17.173.73:3001)
- Fixed 4 critical issues: bash path, config directory, pino-pretty, ES Module
3. Frontend Nginx deployed (v1.0, internal IP: 172.17.173.72:80)
4. CLB load balancer configured (public IP: 8.140.53.236)
New Documentation (9 docs):
- 11-Node.js backend SAE deployment config checklist (21 env vars)
- 12-Node.js backend SAE deployment operation manual
- 13-Node.js backend image fix record (config directory)
- 14-Node.js backend pino-pretty fix
- 15-Node.js backend deployment success summary
- 16-Frontend Nginx deployment success summary
- 17-Complete deployment practical manual 2025 edition (1800 lines)
- 18-Deployment documentation usage guide
- 19-Daily update quick operation manual (670 lines)
Key Fixes:
- Environment variable name correction: EXTRACTION_SERVICE_URL (not PYTHON_SERVICE_URL)
- Dockerfile fix: added COPY config ./config
- Logger configuration: conditional pino-pretty for dev only
- Health check fix: ES Module compatibility (require -> import)
Updated Files:
- System status document updated with full deployment info
- Deployment progress overview updated with latest IPs
- All 3 Docker services' Dockerfiles and configs refined
Verification:
- All health checks passed
- Tool C 7 features working correctly
- Literature screening module functional
- Response time < 1 second
BREAKING CHANGE: Node.js backend internal IP changed from 172.17.173.71 to 172.17.173.73
Closes #deployment-milestone
2025-12-25 21:24:37 +08:00
691dc2bc98
docs(deploy): Update deployment documentation for Node.js backend
...
Summary:
- Created Node.js backend Docker image build guide
- Updated deployment progress overview with backend status
- Updated system status documentation
Backend build achievements:
- Fixed 200+ TypeScript compilation errors (200+ to 0)
- Completed Prisma reverse sync (32 models from RDS)
- Manually added 30+ Prisma relation fields
- Successfully built Docker image (838MB)
- Pushed image to ACR (v1.0 + latest tags)
Documentation updates:
- Added 10-Node.js后端-Docker镜像构建手册.md
- Updated 00-部署进度总览.md with backend deployment status
- Updated 00-系统当前状态与开发指南.md with latest progress
- Fixed date format (2024 -> 2025)
Next steps:
- Deploy Node.js backend to SAE
- Configure environment variables
- Test end-to-end functionality
Status: Backend Docker image ready for SAE deployment
2025-12-25 08:21:21 +08:00
ef967d7d7c
build(backend): Complete Node.js backend deployment preparation
...
Major changes:
- Add Docker configuration (Dockerfile, .dockerignore)
- Fix 200+ TypeScript compilation errors
- Add Prisma schema relations for all models (30+ relations)
- Update tsconfig.json to relax non-critical checks
- Optimize Docker build with local dist strategy
Technical details:
- Exclude test files from TypeScript compilation
- Add manual relations for ASL, PKB, DC, AIA modules
- Use type assertions for JSON/Buffer compatibility
- Fix pg-boss, extractionWorker, and other legacy code issues
Build result:
- Docker image: 838MB (compressed ~186MB)
- Successfully pushed to ACR
- Zero TypeScript compilation errors
Related docs:
- Update deployment documentation
- Add Python microservice SAE deployment guide
2025-12-24 22:12:00 +08:00
b64896a307
feat(deploy): Complete PostgreSQL migration and Docker image build
...
Summary:
- PostgreSQL database migration to RDS completed (90MB SQL, 11 schemas)
- Frontend Nginx Docker image built and pushed to ACR (v1.0, ~50MB)
- Python microservice Docker image built and pushed to ACR (v1.0, 1.12GB)
- Created 3 deployment documentation files
Docker Configuration Files:
- frontend-v2/Dockerfile: Multi-stage build with nginx:alpine
- frontend-v2/.dockerignore: Optimize build context
- frontend-v2/nginx.conf: SPA routing and API proxy
- frontend-v2/docker-entrypoint.sh: Dynamic env injection
- extraction_service/Dockerfile: Multi-stage build with Aliyun Debian mirror
- extraction_service/.dockerignore: Optimize build context
- extraction_service/requirements-prod.txt: Production dependencies (removed Nougat)
Deployment Documentation:
- docs/05-部署文档/00-部署进度总览.md: One-stop deployment status overview
- docs/05-部署文档/07-前端Nginx-SAE部署操作手册.md: Frontend deployment guide
- docs/05-部署文档/08-PostgreSQL数据库部署操作手册.md: Database deployment guide
- docs/00-系统总体设计/00-系统当前状态与开发指南.md: Updated with deployment status
Database Migration:
- RDS instance: pgm-2zex1m2y3r23hdn5 (2C4G, PostgreSQL 15.0)
- Database: ai_clinical_research
- Schemas: 11 business schemas migrated successfully
- Data: 3 users, 2 projects, 1204 literatures verified
- Backup: rds_init_20251224_154529.sql (90MB)
Docker Images:
- Frontend: crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/ai-clinical_frontend-nginx:v1.0
- Python: crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/python-extraction:v1.0
Key Achievements:
- Resolved Docker Hub network issues (using generic tags)
- Fixed 30 TypeScript compilation errors
- Removed Nougat OCR to reduce image size by 1.5GB
- Used Aliyun Debian mirror to resolve apt-get network issues
- Implemented multi-stage builds for optimization
Next Steps:
- Deploy Python microservice to SAE
- Build Node.js backend Docker image
- Deploy Node.js backend to SAE
- Deploy frontend Nginx to SAE
- End-to-end verification testing
Status: Docker images ready, SAE deployment pending
2025-12-24 18:21:55 +08:00
4c6eaaecbf
feat(dc): Implement Postgres-Only async architecture and performance optimization
...
Summary:
- Implement async file upload processing (Platform-Only pattern)
- Add parseExcelWorker with pg-boss queue
- Implement React Query polling mechanism
- Add clean data caching (avoid duplicate parsing)
- Fix pivot single-value column tuple issue
- Optimize performance by 99 percent
Technical Details:
1. Async Architecture (Postgres-Only):
- SessionService.createSession: Fast upload + push to queue (3s)
- parseExcelWorker: Background parsing + save clean data (53s)
- SessionController.getSessionStatus: Status query API for polling
- React Query Hook: useSessionStatus (auto-serial polling)
- Frontend progress bar with real-time feedback
2. Performance Optimization:
- Clean data caching: Worker saves processed data to OSS
- getPreviewData: Read from clean data cache (0.5s vs 43s, -99 percent)
- getFullData: Read from clean data cache (0.5s vs 43s, -99 percent)
- Intelligent cleaning: Boundary detection + ghost column/row removal
- Safety valve: Max 3000 columns, 5M cells
3. Bug Fixes:
- Fix pivot column name tuple issue for single value column
- Fix queue name format (colon to underscore: asl:screening -> asl_screening)
- Fix polling storm (15+ concurrent requests -> 1 serial request)
- Fix QUEUE_TYPE environment variable (memory -> pgboss)
- Fix logger import in PgBossQueue
- Fix formatSession to return cleanDataKey
- Fix saveProcessedData to update clean data synchronously
4. Database Changes:
- ALTER TABLE dc_tool_c_sessions ADD COLUMN clean_data_key VARCHAR(1000)
- ALTER TABLE dc_tool_c_sessions ALTER COLUMN total_rows DROP NOT NULL
- ALTER TABLE dc_tool_c_sessions ALTER COLUMN total_cols DROP NOT NULL
- ALTER TABLE dc_tool_c_sessions ALTER COLUMN columns DROP NOT NULL
5. Documentation:
- Create Postgres-Only async task processing guide (588 lines)
- Update Tool C status document (Day 10 summary)
- Update DC module status document
- Update system overview document
- Update cloud-native development guide
Performance Improvements:
- Upload + preview: 96s -> 53.5s (-44 percent)
- Filter operation: 44s -> 2.5s (-94 percent)
- Pivot operation: 45s -> 2.5s (-94 percent)
- Concurrent requests: 15+ -> 1 (-93 percent)
- Complete workflow (upload + 7 ops): 404s -> 70.5s (-83 percent)
Files Changed:
- Backend: 15 files (Worker, Service, Controller, Schema, Config)
- Frontend: 4 files (Hook, Component, API)
- Docs: 4 files (Guide, Status, Overview, Spec)
- Database: 4 column modifications
- Total: ~1388 lines of new/modified code
Status: Fully tested and verified, production ready
2025-12-22 21:30:31 +08:00
9b81aef9a7
feat(dc): Add multi-metric transformation feature (direction 1+2)
...
Summary:
- Implement intelligent multi-metric grouping detection algorithm
- Add direction 1: timepoint-as-row, metric-as-column (analysis format)
- Add direction 2: timepoint-as-column, metric-as-row (display format)
- Fix column name pattern detection (FMA___ issue)
- Maintain original Record ID order in output
- Add full-select/clear buttons in UI
- Integrate into TransformDialog with Radio selection
- Update 3 documentation files
Technical Details:
- Python: detect_metric_groups(), apply_multi_metric_to_long(), apply_multi_metric_to_matrix()
- Backend: 3 new methods in QuickActionService
- Frontend: MultiMetricPanel.tsx (531 lines)
- Total: ~1460 lines of new code
Status: Fully tested and verified, ready for production
2025-12-21 15:06:15 +08:00
19f9c5ea93
docs(deployment): Fix 8 critical deployment issues and enhance documentation
...
Summary of fixes:
- Fix service discovery address (change .sae domain to internal IP)
- Unify timezone configuration (Asia/Shanghai for all services)
- Enhance ECS security group configuration (Redis/Weaviate port binding)
- Add image pull strategy best practices
- Add Python service memory management guidelines
- Update Dify API Key deployment strategy (avoid deadlock)
- Add SSH tunnel for RDS database access
- Add NAT gateway cost optimization explanation
Modified files (7 docs):
- 00-部署架构总览.md (enhanced with 7 sections)
- 03-Dify-ECS部署完全指南.md (security hardening)
- 04-Python微服务-SAE容器部署指南.md (timezone + service discovery)
- 05-Node.js后端-SAE容器部署指南.md (timezone configuration)
- PostgreSQL部署策略-摸底报告.md (timezone best practice)
- 07-关键配置补充说明.md (3 new sections)
- 08-部署检查清单.md (service address fix)
New files:
- 文档修正报告-20251214.md (comprehensive fix report)
- Review documents from technical team
Impact:
- Fixed 3 P0/P1 critical issues (100% connection failure risk)
- Fixed 3 P2 important issues (stability and maintainability)
- Added 2 P3 best practices (developer convenience)
Status: All deployment documents reviewed and corrected, ready for production deployment
2025-12-14 13:25:28 +08:00
fa72beea6c
feat(platform): Complete Postgres-Only architecture refactoring (Phase 1-7)
...
Major Changes:
- Implement Platform-Only architecture pattern (unified task management)
- Add PostgresCacheAdapter for unified caching (platform_schema.app_cache)
- Add PgBossQueue for job queue management (platform_schema.job)
- Implement CheckpointService using job.data (generic for all modules)
- Add intelligent threshold-based dual-mode processing (THRESHOLD=50)
- Add task splitting mechanism (auto chunk size recommendation)
- Refactor ASL screening service with smart mode selection
- Refactor DC extraction service with smart mode selection
- Register workers for ASL and DC modules
Technical Highlights:
- All task management data stored in platform_schema.job.data (JSONB)
- Business tables remain clean (no task management fields)
- CheckpointService is generic (shared by all modules)
- Zero code duplication (DRY principle)
- Follows 3-layer architecture principle
- Zero additional cost (no Redis needed, save 8400 CNY/year)
Code Statistics:
- New code: ~1750 lines
- Modified code: ~500 lines
- Test code: ~1800 lines
- Documentation: ~3000 lines
Testing:
- Unit tests: 8/8 passed
- Integration tests: 2/2 passed
- Architecture validation: passed
- Linter errors: 0
Files:
- Platform layer: PostgresCacheAdapter, PgBossQueue, CheckpointService, utils
- ASL module: screeningService, screeningWorker
- DC module: ExtractionController, extractionWorker
- Tests: 11 test files
- Docs: Updated 4 key documents
Status: Phase 1-7 completed, Phase 8-9 pending
2025-12-13 16:10:04 +08:00
4b41344d78
chore: add backend/uploads/ to gitignore and remove test data from git tracking
...
- Added backend/uploads/ to .gitignore
- Removed 171 test files from Git tracking (--cached, local files preserved)
- Tool B: ~20 test files
- Tool C: ~150 test files
- Local files are safe and not deleted
- This prevents future commits from tracking uploaded user files
2025-12-10 18:12:00 +08:00
200eab5c2e
feat(dc-tool-c): Tool C UX重大改进 - 列头筛选/行号/滚动条/全量数据
...
新功能
- 列头筛选:Excel风格筛选功能(Community版本,中文本地化,显示唯一值及计数)
- 行号列:添加固定行号列(#列头,灰色背景,左侧固定)
- 全量数据加载:不再限制50行预览,Session加载全量数据
- 全量数据返回:所有快速操作(筛选/映射/分箱/条件/删NA/计算/Pivot)全量返回结果
Bug修复
- 滚动条终极修复:修改MainLayout为固定高度(h-screen + overflow-hidden),整个浏览器窗口无滚动条,只有AG Grid内部滚动
- 计算列全角字符修复:自动转换中文括号等全角字符为半角
- 计算列特殊字符列名修复:完善列别名机制,支持任意特殊字符列名
UI优化
- 删除'表格仅展示前50行'提示条,减少干扰
- 筛选对话框美化:白色背景,圆角,阴影
- 列头筛选图标优化:清晰可见,易于点击
文档更新
- 工具C_功能按钮开发计划_V1.0.md:添加V1.5版本记录
- 工具C_MVP开发_TODO清单.md:添加Day 8 UX优化内容
- 00-工具C当前状态与开发指南.md:更新进度为98%
- 00-模块当前状态与开发指南.md:更新DC模块状态
- 00-系统当前状态与开发指南.md:更新系统整体状态
影响范围
- Python微服务:无修改
- Node.js后端:5处代码修改(SessionService + QuickActionController + AICodeService)
- 前端:MainLayout + DataGrid + ag-grid-custom.css + index.tsx
- 完成度:Tool C整体完成度提升至98%
代码统计
- 修改文件:~15个文件
- 新增行数:~200行
- 修改行数:~150行
Co-authored-by: AI Assistant <assistant@example.com >
2025-12-10 18:02:42 +08:00
74cf346453
feat(dc/tool-c): Add missing value imputation feature with 6 methods and MICE
...
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
2025-12-10 13:06:00 +08:00
f4f1d09837
feat(dc/tool-c): Add pivot column ordering and NA handling features
...
Major features:
1. Pivot transformation enhancements:
- Add option to keep unselected columns with 3 aggregation methods
- Maintain original column order after pivot (aligned with source file)
- Preserve pivot value order (first appearance order)
2. NA handling across 4 core functions:
- Recode: Support keep/map/drop for NA values
- Filter: Already supports is_null/not_null operators
- Binning: Support keep/label/assign for NA values (fix nan display)
- Conditional: Add is_null/not_null operators
3. UI improvements:
- Enable column header tooltips with custom header component
- Add closeable alert for 50-row preview
- Fix page scrollbar issues
Modified files:
Python: pivot.py, recode.py, binning.py, conditional.py, main.py
Backend: SessionController, QuickActionController, QuickActionService
Frontend: PivotDialog, RecodeDialog, BinningDialog, ConditionalDialog, DataGrid, index
Status: Ready for testing
2025-12-09 14:40:14 +08:00
75ceeb0653
hotfix(dc/tool-c): Fix compute formula validation and binning NaN serialization
...
Critical fixes:
1. Compute column: Add Chinese comma support in formula validation
- Problem: Formula with Chinese comma failed validation
- Fix: Add Chinese comma character to allowed_chars regex
- Example: Support formulas like 'col1(kg)+ col2,col3'
2. Binning operation: Fix NaN serialization error
- Problem: 'Out of range float values are not JSON compliant: nan'
- Fix: Enhanced NaN/inf handling in binning endpoint
- Added np.inf/-np.inf replacement before JSON serialization
- Added manual JSON serialization with NaN->null conversion
3. Enhanced all operation endpoints for consistency
- Updated conditional, dropna endpoints with same NaN/inf handling
- Ensures all operations return JSON-compliant data
Modified files:
- extraction_service/operations/compute.py: Add Chinese comma to regex
- extraction_service/main.py: Enhanced NaN handling in binning/conditional/dropna
Status: Hotfix complete, ready for testing
2025-12-09 08:45:27 +08:00
91cab452d1
fix(dc/tool-c): Fix special character handling and improve UX
...
Major fixes:
- Fix pivot transformation with special characters in column names
- Fix compute column validation for Chinese punctuation
- Fix recode dialog to fetch unique values from full dataset via new API
- Add column mapping mechanism to handle special characters
Database migration:
- Add column_mapping field to dc_tool_c_sessions table
- Migration file: 20251208_add_column_mapping
UX improvements:
- Darken table grid lines for better visibility
- Reduce column width by 40% with tooltip support
- Insert new columns next to source columns
- Preserve original row order after operations
- Add notice about 50-row preview limit
Modified files:
- Backend: SessionService, SessionController, QuickActionService, routes
- Python: pivot.py, compute.py, recode.py, binning.py, conditional.py
- Frontend: DataGrid, RecodeDialog, index.tsx, ag-grid-custom.css
- Database: schema.prisma, migration SQL
Status: Code complete, database migrated, ready for testing
2025-12-08 23:20:55 +08:00
f729699510
feat(dc): Complete Tool C quick action buttons Phase 1-2 - 7 functions
...
Summary:
- Implement 7 quick action functions (filter, recode, binning, conditional, dropna, compute, pivot)
- Refactor to pre-written Python functions architecture (stable and secure)
- Add 7 Python operations modules with full type hints
- Add 7 frontend Dialog components with user-friendly UI
- Fix NaN serialization issues and auto type conversion
- Update all related documentation
Technical Details:
- Python: operations/ module (filter.py, recode.py, binning.py, conditional.py, dropna.py, compute.py, pivot.py)
- Backend: QuickActionService.ts with 7 execute methods
- Frontend: 7 Dialog components with complete validation
- Toolbar: Enable 7 quick action buttons
Status: Phase 1-2 completed, basic testing passed, ready for further testing
2025-12-08 17:38:08 +08:00
af325348b8
feat(dc): Complete Tool C Day 5 - AI Chat + Ant Design X Integration
...
Summary:
- Upgrade to Ant Design 6.0.1 + install Ant Design X (2.1.0) + X SDK (2.1.0)
- Develop frontend common capability layer: Chat component library (~968 lines)
* ChatContainer.tsx - Core container component
* MessageRenderer.tsx - Message renderer
* CodeBlockRenderer.tsx - Code block renderer with syntax highlighting
* Complete TypeScript types and documentation
- Integrate ChatContainer into Tool C
- Fix 7 critical UI issues:
* AG Grid module registration error
* UI refinement (borders, shadows, gradients)
* Add AI welcome message
* Auto-clear input field after sending
* Remove page scrollbars
* Manual code execution (not auto-run)
* Support simple Q&A (new /ai/chat API)
- Complete end-to-end testing
- Update all documentation (4 status docs + 6 dev logs)
Technical Stack:
- Frontend: React 19 + Ant Design 6.0 + Ant Design X 2.1
- Components: Bubble, Sender from @ant-design/x
- Total code: ~5418 lines
Status: Tool C MVP completed, production ready
2025-12-07 22:02:14 +08:00
f01981bf78
feat(dc/tool-c): 完成AI代码生成服务(Day 3 MVP)
...
核心功能:
- 新增AICodeService(550行):AI代码生成核心服务
- 新增AIController(257行):4个API端点
- 新增dc_tool_c_ai_history表:存储对话历史
- 实现自我修正机制:最多3次智能重试
- 集成LLMFactory:复用通用能力层
- 10个Few-shot示例:覆盖Level 1-4场景
技术优化:
- 修复NaN序列化问题(Python端转None)
- 修复数据传递问题(从Session获取真实数据)
- 优化System Prompt(明确环境信息)
- 调整Few-shot示例(移除import语句)
测试结果:
- 通过率:9/11(81.8%) 达到MVP标准
- 成功场景:缺失值处理、编码、分箱、BMI、筛选、填补、统计、分类
- 待优化:数值清洗、智能去重(已记录技术债务TD-C-006)
API端点:
- POST /api/v1/dc/tool-c/ai/generate(生成代码)
- POST /api/v1/dc/tool-c/ai/execute(执行代码)
- POST /api/v1/dc/tool-c/ai/process(生成并执行,一步到位)
- GET /api/v1/dc/tool-c/ai/history/:sessionId(对话历史)
文档更新:
- 新增Day 3开发完成总结(770行)
- 新增复杂场景优化技术债务(TD-C-006)
- 更新工具C当前状态文档
- 更新技术债务清单
影响范围:
- backend/src/modules/dc/tool-c/*(新增2个文件,更新1个文件)
- backend/scripts/create-tool-c-ai-history-table.mjs(新增)
- backend/prisma/schema.prisma(新增DcToolCAiHistory模型)
- extraction_service/services/dc_executor.py(NaN序列化修复)
- docs/03-业务模块/DC-数据清洗整理/*(5份文档更新)
Breaking Changes: 无
总代码行数:+950行
Refs: #Tool-C-Day3
2025-12-07 16:21:32 +08:00
2348234013
feat(dc/tool-c): Day 2 - Session管理与数据处理完成
...
核心功能:
- 数据库: 创建dc_tool_c_sessions表 (12字段, 3索引)
- 服务层: SessionService (383行), DataProcessService (303行)
- 控制器: SessionController (300行, 6个API端点)
- 路由: 新增6个Session管理路由
- 测试: 7个API测试全部通过 (100%)
技术亮点:
- 零落盘架构: Excel内存解析, OSS存储
- Session管理: 10分钟过期, 心跳延长机制
- 云原生规范: storage/logger/prisma全平台复用
- 完整测试: 上传/预览/完整数据/删除/心跳
文件清单:
- backend/prisma/schema.prisma (新增DcToolCSession模型)
- backend/prisma/migrations/create_tool_c_session.sql
- backend/scripts/create-tool-c-table.mjs
- backend/src/modules/dc/tool-c/services/ (SessionService, DataProcessService)
- backend/src/modules/dc/tool-c/controllers/SessionController.ts
- backend/src/modules/dc/tool-c/routes/index.ts
- backend/test-tool-c-day2.mjs
- docs/03-业务模块/DC-数据清洗整理/00-工具C当前状态与开发指南.md
- docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md
代码统计: ~1900行
测试结果: 7/7 通过 (100%)
云原生规范: 完全符合
2025-12-06 22:12:47 +08:00
8be741cd52
docs(dc/tool-c): Complete Tool C MVP planning and TODO list
...
Summary:
- Update Tool C MVP Development Plan (V1.3)
* Clarify Python execution as core feature
* Add 15 real medical data cleaning scenarios (basic/medium/advanced)
* Enhance System Prompt with 10 Few-shot examples
* Discover existing Python service (extraction_service)
* Update to extend existing service instead of rebuilding
- Create Tool C MVP Development TODO List
* 3-week plan with 30 tasks (Day 1-15)
* 4 core milestones with clear acceptance criteria
* Daily checklist and risk management
* Detailed task breakdown for each day
Key Changes:
- Python service: Extend existing extraction_service instead of new setup
- Test scenarios: 15 scenarios (5 basic + 5 medium + 5 advanced)
- Success criteria: Basic >90%, Medium >80%, Advanced >60%, Total >80%
- Development time: Reduced from 3 weeks to 2 weeks (reuse infrastructure)
Status: Planning complete, ready to start Day 1 development
2025-12-06 11:00:44 +08:00
8a17369138
feat(dc): Complete Tool B MVP with full API integration and bug fixes
...
Phase 5: Export Feature
- Add Excel export API endpoint (GET /tasks/:id/export)
- Fix Content-Disposition header encoding for Chinese filenames
- Fix export field order to match template definition
- Export finalResult or resultA as fallback
API Integration Fixes (Phase 1-5):
- Fix API response parsing (return result.data consistently)
- Fix field name mismatch (fileKey -> sourceFileKey)
- Fix Excel parsing bug (range:99 -> slice(0,100))
- Add file upload with Excel parsing (columns, totalRows)
- Add detailed error logging for debugging
LLM Integration Fixes:
- Fix LLM call method: LLMFactory.createLLM -> getAdapter
- Fix adapter interface: generateText -> chat([messages])
- Fix response fields: text -> content, tokensUsed -> usage.totalTokens
- Fix model names: qwen-max -> qwen3-72b
React Infinite Loop Fixes:
- Step2: Remove updateState from useEffect deps
- Step3: Add useRef to prevent Strict Mode double execution
- Step3: Clear interval on API failure (max 3 retries)
- Step4: Add useRef to prevent infinite data loading
- Add cleanup functions to all useEffect hooks
Frontend Enhancements:
- Add comprehensive error handling with user-friendly messages
- Remove debug console.logs (production ready)
- Fix TypeScript type definitions (TaskProgress, ExtractionItem)
- Improve Step4Verify data transformation logic
Backend Enhancements:
- Add detailed logging at each step for debugging
- Add parameter validation in controllers
- Improve error messages with stack traces (dev mode)
- Add export field ordering by template definition
Documentation Updates:
- Update module status: Tool B MVP completed
- Create MVP completion summary (06-开发记录)
- Create technical debt document (07-技术债务)
- Update API documentation with test status
- Update database documentation with verified status
- Update system overview with DC module status
- Document 4 known issues (Excel preprocessing, progress display, etc.)
Testing Results:
- File upload: 9 rows parsed successfully
- Health check: Column validation working
- Dual model extraction: DeepSeek-V3 + Qwen-Max both working
- Processing time: ~49s for 9 records (~5s per record)
- Token usage: ~10k tokens total (~1.1k per record)
- Conflict detection: 1 clean, 8 conflicts (88.9% conflict rate)
- Excel export: Working with proper encoding
Files Changed:
Backend (~500 lines):
- ExtractionController.ts: Add upload endpoint, improve logging
- DualModelExtractionService.ts: Fix LLM call methods, add detailed logs
- HealthCheckService.ts: Fix Excel range parsing
- routes/index.ts: Add upload route
Frontend (~200 lines):
- toolB.ts: Fix API response parsing, add error handling
- Step1Upload.tsx: Integrate upload and health check APIs
- Step2Schema.tsx: Fix infinite loop, load templates from API
- Step3Processing.tsx: Fix infinite loop, integrate progress polling
- Step4Verify.tsx: Fix infinite loop, transform backend data correctly
- Step5Result.tsx: Integrate export API
- index.tsx: Add file metadata to state
Scripts:
- check-task-progress.mjs: Database inspection utility
Docs (~8 files):
- 00-模块当前状态与开发指南.md: Update to v2.0
- API设计文档.md: Mark all endpoints as tested
- 数据库设计文档.md: Update verification status
- DC模块Tool-B开发计划.md: Add MVP completion notice
- DC模块Tool-B开发任务清单.md: Update progress to 100%
- Tool-B-MVP完成总结.md: New completion summary
- Tool-B技术债务清单.md: New technical debt document
- 00-系统当前状态与开发指南.md: Update DC module status
Status: Tool B MVP complete and production ready
2025-12-03 15:07:39 +08:00
5f1e7af92c
feat(dc): Complete Tool B frontend development with UI optimization
...
- Implement Tool B 5-step workflow (upload, schema, processing, verify, result)
- Add back navigation button to Portal
- Optimize Step 2 field list styling to match prototype
- Fix step 3 label: 'dual-blind' to 'dual-model'
- Create API service layer with 7 endpoints
- Integrate Tool B route into DC module
- Add comprehensive TypeScript types
Components (~1100 lines):
- index.tsx: Main Tool B entry with state management
- Step1Upload.tsx: File upload and health check
- Step2Schema.tsx: Smart template configuration
- Step3Processing.tsx: Dual-model extraction progress
- Step4Verify.tsx: Conflict verification workbench
- Step5Result.tsx: Result display
- StepIndicator.tsx: Step progress component
- api/toolB.ts: API service layer
Status: Frontend complete, ready for API integration
2025-12-03 09:36:35 +08:00
d4d33528c7
feat(dc): Complete Phase 1 - Portal workbench page development
...
Summary:
- Implement DC module Portal page with 3 tool cards
- Create ToolCard component with decorative background and hover animations
- Implement TaskList component with table layout and progress bars
- Implement AssetLibrary component with tab switching and file cards
- Complete database verification (4 tables confirmed)
- Complete backend API verification (6 endpoints ready)
- Optimize UI to match prototype design (V2.html)
Frontend Components (~715 lines):
- components/ToolCard.tsx - Tool cards with animations
- components/TaskList.tsx - Recent tasks table view
- components/AssetLibrary.tsx - Data asset library with tabs
- hooks/useRecentTasks.ts - Task state management
- hooks/useAssets.ts - Asset state management
- pages/Portal.tsx - Main portal page
- types/portal.ts - TypeScript type definitions
Backend Verification:
- Backend API: 1495 lines code verified
- Database: dc_schema with 4 tables verified
- API endpoints: 6 endpoints tested (templates API works)
Documentation:
- Database verification report
- Backend API test report
- Phase 1 completion summary
- UI optimization report
- Development task checklist
- Development plan for Tool B
Status: Phase 1 completed (100%), ready for browser testing
Next: Phase 2 - Tool B Step 1 and 2 development
2025-12-02 21:53:24 +08:00
88cc049fb3
feat(asl): Complete Day 5 - Fulltext Screening Backend API Development
...
- Implement 5 core API endpoints (create task, get progress, get results, update decision, export Excel)
- Add FulltextScreeningController with Zod validation (652 lines)
- Implement ExcelExporter service with 4-sheet report generation (352 lines)
- Register routes under /api/v1/asl/fulltext-screening
- Create 31 REST Client test cases
- Add automated integration test script
- Fix PDF extraction fallback mechanism in LLM12FieldsService
- Update API design documentation to v3.0
- Update development plan to v1.2
- Create Day 5 development record
- Clean up temporary test files
2025-11-23 10:52:07 +08:00
beb7f7f559
feat(asl): Implement full-text screening core LLM service and validation system (Day 1-3)
...
Core Components:
- PDFStorageService with Dify/OSS adapters
- LLM12FieldsService with Nougat-first + dual-model + 3-layer JSON parsing
- PromptBuilder for dynamic prompt assembly
- MedicalLogicValidator with 5 rules + fault tolerance
- EvidenceChainValidator for citation integrity
- ConflictDetectionService for dual-model comparison
Prompt Engineering:
- System Prompt (6601 chars, Section-Aware strategy)
- User Prompt template (PICOS context injection)
- JSON Schema (12 fields constraints)
- Cochrane standards (not loaded in MVP)
Key Innovations:
- 3-layer JSON parsing (JSON.parse + json-repair + code block extraction)
- Promise.allSettled for dual-model fault tolerance
- safeGetFieldValue for robust field extraction
- Mixed CN/EN token calculation
Integration Tests:
- integration-test.ts (full test)
- quick-test.ts (quick test)
- cached-result-test.ts (fault tolerance test)
Documentation Updates:
- Development record (Day 2-3 summary)
- Quality assurance strategy (full-text screening)
- Development plan (progress update)
- Module status (v1.1 update)
- Technical debt (10 new items)
Test Results:
- JSON parsing success rate: 100%
- Medical logic validation: 5/5 passed
- Dual-model parallel processing: OK
- Cost per PDF: CNY 0.10
Files: 238 changed, 14383 insertions(+), 32 deletions(-)
Docs: docs/03-涓氬姟妯″潡/ASL-AI鏅鸿兘鏂囩尞/05-寮€鍙戣褰?2025-11-22_Day2-Day3_LLM鏈嶅姟涓庨獙璇佺郴缁熷紑鍙?md
2025-11-22 22:21:12 +08:00
8eef9e0544
feat(asl): Complete Week 4 - Results display and Excel export with hybrid solution
...
Features:
- Backend statistics API (cloud-native Prisma aggregation)
- Results page with hybrid solution (AI consensus + human final decision)
- Excel export (frontend generation, zero disk write, cloud-native)
- PRISMA-style exclusion reason analysis with bar chart
- Batch selection and export (3 export methods)
- Fixed logic contradiction (inclusion does not show exclusion reason)
- Optimized table width (870px, no horizontal scroll)
Components:
- Backend: screeningController.ts - add getProjectStatistics API
- Frontend: ScreeningResults.tsx - complete results page (hybrid solution)
- Frontend: excelExport.ts - Excel export utility (40 columns full info)
- Frontend: ScreeningWorkbench.tsx - add navigation button
- Utils: get-test-projects.mjs - quick test tool
Architecture:
- Cloud-native: backend aggregation reduces network transfer
- Cloud-native: frontend Excel generation (zero file persistence)
- Reuse platform: global prisma instance, logger
- Performance: statistics API < 500ms, Excel export < 3s (1000 records)
Documentation:
- Update module status guide (add Week 4 features)
- Update task breakdown (mark Week 4 completed)
- Update API design spec (add statistics API)
- Update database design (add field usage notes)
- Create Week 4 development plan
- Create Week 4 completion report
- Create technical debt list
Test:
- End-to-end flow test passed
- All features verified
- Performance test passed
- Cloud-native compliance verified
Ref: Week 4 Development Plan
Scope: ASL Module MVP - Title Abstract Screening Results
Cloud-Native: Backend aggregation + Frontend Excel generation
2025-11-21 20:12:38 +08:00
2e8699c217
feat(asl): Week 2 Day 2 - Excel import with template download and intelligent dedup
...
Features:
- feat: Excel template generation and download (with examples)
- feat: Excel file parsing in memory (cloud-native, no disk write)
- feat: Field validation (title + abstract required)
- feat: Smart deduplication (DOI priority + Title fallback)
- feat: Literature preview table with statistics
- feat: Complete submission flow (create project + import literatures)
Components:
- feat: Create excelUtils.ts with full Excel processing toolkit
- feat: Enhance TitleScreeningSettings page with upload/preview/submit
- feat: Update API interface signatures and export unified aslApi object
Dependencies:
- chore: Add xlsx library for Excel file processing
Ref: Week 2 Frontend Development - Day 2
Scope: ASL Module MVP - Title Abstract Screening
Cloud-Native: Memory parsing, no file persistence
2025-11-19 10:24:47 +08:00