From 75ceeb06533471e825b17f3ad2cf222bdf34180b Mon Sep 17 00:00:00 2001 From: HaHafeng Date: Tue, 9 Dec 2025 08:45:27 +0800 Subject: [PATCH] hotfix(dc/tool-c): Fix compute formula validation and binning NaN serialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- DC模块代码恢复指南.md | 1 + .../add_data_stats_to_tool_c_session.sql | 1 + .../20251208_add_column_mapping/migration.sql | 1 + .../migrations/create_tool_c_session.sql | 1 + backend/recover-code-from-cursor-db.js | 1 + backend/scripts/check-dc-tables.mjs | 1 + .../create-tool-c-ai-history-table.mjs | 1 + backend/scripts/create-tool-c-table.js | 1 + backend/scripts/create-tool-c-table.mjs | 1 + .../__tests__/api-integration-test.ts | 1 + .../__tests__/e2e-real-test-v2.ts | 1 + .../__tests__/fulltext-screening-api.http | 1 + .../services/ExcelExporter.ts | 1 + .../services/ConflictDetectionService.ts | 1 + .../dc/tool-b/services/TemplateService.ts | 1 + backend/src/modules/dc/tool-c/README.md | 1 + .../tool-c/controllers/StreamAIController.ts | 1 + backend/sync-dc-database.ps1 | 1 + backend/test-tool-c-advanced-scenarios.mjs | 1 + backend/test-tool-c-day2.mjs | 1 + backend/test-tool-c-day3.mjs | 1 + .../04-开发计划/05-全文复筛前端开发计划.md | 1 + .../05-开发记录/2025-01-23_全文复筛前端开发完成.md | 1 + .../05-开发记录/2025-01-23_全文复筛前端逻辑调整.md | 1 + .../05-开发记录/2025-11-23_Day5_全文复筛API开发.md | 1 + .../04-开发计划/工具C_AI_Few-shot示例库.md | 1 + .../04-开发计划/工具C_Bug修复总结_2025-12-08.md | 1 + .../04-开发计划/工具C_Day3开发计划.md | 1 + .../04-开发计划/工具C_Day4-5前端开发计划.md | 1 + .../06-开发记录/2025-12-02_工作总结.md | 1 + .../06-开发记录/2025-12-06_工具C_Day1开发完成总结.md | 1 + .../06-开发记录/2025-12-06_工具C_Day2开发完成总结.md | 1 + .../06-开发记录/2025-12-07_AI对话核心功能增强总结.md | 1 + .../2025-12-07_Bug修复_DataGrid空数据防御.md | 1 + .../06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md | 1 + .../06-开发记录/2025-12-07_Day5最终总结.md | 1 + .../06-开发记录/2025-12-07_UI优化与Bug修复.md | 1 + .../06-开发记录/2025-12-07_后端API完整对接完成.md | 1 + .../06-开发记录/2025-12-07_完整UI优化与功能增强.md | 1 + .../06-开发记录/2025-12-07_工具C_Day4前端基础完成.md | 1 + .../06-开发记录/DC模块重建完成总结-Day1.md | 1 + .../06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md | 1 + .../Phase2-ToolB-Step1-2开发完成-2025-12-03.md | 1 + .../06-开发记录/Portal页面UI优化-2025-12-02.md | 1 + .../06-开发记录/Tool-B-MVP完成总结-2025-12-03.md | 1 + .../06-开发记录/ToolB-UI优化-2025-12-03.md | 1 + .../06-开发记录/ToolB-UI优化-Round2-2025-12-03.md | 1 + .../06-开发记录/ToolB浏览器测试计划-2025-12-03.md | 1 + .../06-开发记录/后端API测试报告-2025-12-02.md | 1 + .../06-开发记录/待办事项-下一步工作.md | 1 + .../06-开发记录/数据库验证报告-2025-12-02.md | 1 + .../07-技术债务/Tool-B技术债务清单.md | 1 + .../05-技术债务/通用对话服务抽取计划.md | 1 + extraction_service/main.py | 44 ++++++++++++++----- extraction_service/operations/__init__.py | 1 + extraction_service/operations/compute.py | 4 +- extraction_service/operations/dropna.py | 1 + extraction_service/operations/filter.py | 1 + extraction_service/test_dc_api.py | 1 + extraction_service/test_execute_simple.py | 1 + extraction_service/test_module.py | 1 + .../asl/components/FulltextDetailDrawer.tsx | 1 + .../modules/asl/hooks/useFulltextResults.ts | 1 + .../src/modules/asl/hooks/useFulltextTask.ts | 1 + .../src/modules/asl/pages/FulltextResults.tsx | 1 + frontend-v2/src/modules/dc/hooks/useAssets.ts | 1 + .../src/modules/dc/hooks/useRecentTasks.ts | 1 + .../components/BinningDialog_improved.tsx | 1 + .../pages/tool-c/components/DropnaDialog.tsx | 1 + .../pages/tool-c/components/PivotDialog.tsx | 1 + .../modules/dc/pages/tool-c/types/index.ts | 1 + frontend-v2/src/modules/dc/types/portal.ts | 1 + frontend-v2/src/shared/components/index.ts | 1 + python-microservice/operations/__init__.py | 1 + python-microservice/operations/binning.py | 1 + python-microservice/operations/filter.py | 1 + python-microservice/operations/recode.py | 1 + recover_dc_code.py | 1 + run_recovery.ps1 | 1 + 79 files changed, 111 insertions(+), 14 deletions(-) diff --git a/DC模块代码恢复指南.md b/DC模块代码恢复指南.md index 5b7eca07..de10f7d7 100644 --- a/DC模块代码恢复指南.md +++ b/DC模块代码恢复指南.md @@ -228,3 +228,4 @@ + diff --git a/backend/migrations/add_data_stats_to_tool_c_session.sql b/backend/migrations/add_data_stats_to_tool_c_session.sql index b4583973..1c521fab 100644 --- a/backend/migrations/add_data_stats_to_tool_c_session.sql +++ b/backend/migrations/add_data_stats_to_tool_c_session.sql @@ -23,3 +23,4 @@ WHERE table_schema = 'dc_schema' + diff --git a/backend/prisma/migrations/20251208_add_column_mapping/migration.sql b/backend/prisma/migrations/20251208_add_column_mapping/migration.sql index 51e4ef56..0041e480 100644 --- a/backend/prisma/migrations/20251208_add_column_mapping/migration.sql +++ b/backend/prisma/migrations/20251208_add_column_mapping/migration.sql @@ -8,3 +8,4 @@ ADD COLUMN IF NOT EXISTS "column_mapping" JSONB; -- 添加注释 COMMENT ON COLUMN "dc_schema"."dc_tool_c_sessions"."column_mapping" IS '列名映射:[{originalName, safeName, displayName}] 解决特殊字符问题'; + diff --git a/backend/prisma/migrations/create_tool_c_session.sql b/backend/prisma/migrations/create_tool_c_session.sql index a74a92ce..0a1a34ef 100644 --- a/backend/prisma/migrations/create_tool_c_session.sql +++ b/backend/prisma/migrations/create_tool_c_session.sql @@ -35,3 +35,4 @@ COMMENT ON COLUMN dc_schema.dc_tool_c_sessions.expires_at IS '过期时间(创 + diff --git a/backend/recover-code-from-cursor-db.js b/backend/recover-code-from-cursor-db.js index 58697c97..22e85bdd 100644 --- a/backend/recover-code-from-cursor-db.js +++ b/backend/recover-code-from-cursor-db.js @@ -185,3 +185,4 @@ function extractCodeBlocks(obj, blocks = []) { + diff --git a/backend/scripts/check-dc-tables.mjs b/backend/scripts/check-dc-tables.mjs index dc7101e9..8f4fb0ec 100644 --- a/backend/scripts/check-dc-tables.mjs +++ b/backend/scripts/check-dc-tables.mjs @@ -204,3 +204,4 @@ checkDCTables(); + diff --git a/backend/scripts/create-tool-c-ai-history-table.mjs b/backend/scripts/create-tool-c-ai-history-table.mjs index d2d6b101..188100f4 100644 --- a/backend/scripts/create-tool-c-ai-history-table.mjs +++ b/backend/scripts/create-tool-c-ai-history-table.mjs @@ -156,3 +156,4 @@ createAiHistoryTable() + diff --git a/backend/scripts/create-tool-c-table.js b/backend/scripts/create-tool-c-table.js index 851edc4c..07ea6827 100644 --- a/backend/scripts/create-tool-c-table.js +++ b/backend/scripts/create-tool-c-table.js @@ -143,3 +143,4 @@ createToolCTable() + diff --git a/backend/scripts/create-tool-c-table.mjs b/backend/scripts/create-tool-c-table.mjs index a4f1eacb..9bf3d233 100644 --- a/backend/scripts/create-tool-c-table.mjs +++ b/backend/scripts/create-tool-c-table.mjs @@ -140,3 +140,4 @@ createToolCTable() + diff --git a/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts b/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts index c561e01e..4cc23677 100644 --- a/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts +++ b/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts @@ -308,3 +308,4 @@ runTests().catch((error) => { + diff --git a/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts b/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts index c020419b..de8bc6ed 100644 --- a/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts +++ b/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts @@ -249,3 +249,4 @@ runTest() + diff --git a/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http b/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http index 1d5ec382..c5de09a8 100644 --- a/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http +++ b/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http @@ -287,3 +287,4 @@ Content-Type: application/json + diff --git a/backend/src/modules/asl/fulltext-screening/services/ExcelExporter.ts b/backend/src/modules/asl/fulltext-screening/services/ExcelExporter.ts index 364919ae..fd817f45 100644 --- a/backend/src/modules/asl/fulltext-screening/services/ExcelExporter.ts +++ b/backend/src/modules/asl/fulltext-screening/services/ExcelExporter.ts @@ -366,3 +366,4 @@ export class ExcelExporter { + diff --git a/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts b/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts index f8710dd2..ee54a885 100644 --- a/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts +++ b/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts @@ -223,3 +223,4 @@ export const conflictDetectionService = new ConflictDetectionService(); + diff --git a/backend/src/modules/dc/tool-b/services/TemplateService.ts b/backend/src/modules/dc/tool-b/services/TemplateService.ts index 80ed8b69..5532d1de 100644 --- a/backend/src/modules/dc/tool-b/services/TemplateService.ts +++ b/backend/src/modules/dc/tool-b/services/TemplateService.ts @@ -251,3 +251,4 @@ export const templateService = new TemplateService(); + diff --git a/backend/src/modules/dc/tool-c/README.md b/backend/src/modules/dc/tool-c/README.md index 45e1a087..94dca7d2 100644 --- a/backend/src/modules/dc/tool-c/README.md +++ b/backend/src/modules/dc/tool-c/README.md @@ -173,3 +173,4 @@ curl -X POST http://localhost:3000/api/v1/dc/tool-c/test/execute \ + diff --git a/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts b/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts index 89557626..9659b329 100644 --- a/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts +++ b/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts @@ -227,3 +227,4 @@ export const streamAIController = new StreamAIController(); + diff --git a/backend/sync-dc-database.ps1 b/backend/sync-dc-database.ps1 index 8a7289e7..799d2e45 100644 --- a/backend/sync-dc-database.ps1 +++ b/backend/sync-dc-database.ps1 @@ -31,3 +31,4 @@ Write-Host "✅ 完成!" -ForegroundColor Green + diff --git a/backend/test-tool-c-advanced-scenarios.mjs b/backend/test-tool-c-advanced-scenarios.mjs index 91252dd1..8be95991 100644 --- a/backend/test-tool-c-advanced-scenarios.mjs +++ b/backend/test-tool-c-advanced-scenarios.mjs @@ -318,3 +318,4 @@ runAdvancedTests().catch(error => { + diff --git a/backend/test-tool-c-day2.mjs b/backend/test-tool-c-day2.mjs index 8706bb3b..612e695d 100644 --- a/backend/test-tool-c-day2.mjs +++ b/backend/test-tool-c-day2.mjs @@ -384,3 +384,4 @@ runAllTests() + diff --git a/backend/test-tool-c-day3.mjs b/backend/test-tool-c-day3.mjs index c9bda980..79defc3b 100644 --- a/backend/test-tool-c-day3.mjs +++ b/backend/test-tool-c-day3.mjs @@ -342,3 +342,4 @@ runAllTests() + diff --git a/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md b/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md index 2f7d3930..455037b7 100644 --- a/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md +++ b/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md @@ -1248,3 +1248,4 @@ interface FulltextScreeningResult { + diff --git a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md index db9ccda5..6aea1daa 100644 --- a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md +++ b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md @@ -362,3 +362,4 @@ GET /api/v1/asl/fulltext-screening/tasks/:taskId/export + diff --git a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md index 814b6a9b..17df5198 100644 --- a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md +++ b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md @@ -305,3 +305,4 @@ Linter错误:0个 + diff --git a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md index 7db0d2d2..31633c6b 100644 --- a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md +++ b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md @@ -464,3 +464,4 @@ Failed to open file '\\tmp\\extraction_service\\temp_10000_test.pdf' + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md index 581b9edb..3be40071 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md @@ -530,3 +530,4 @@ df['creatinine'] = pd.to_numeric(df['creatinine'], errors='coerce') + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md index a94e9380..bb96b92a 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md @@ -368,3 +368,4 @@ npm run dev **修复完成时间**: 2025-12-08 当前时间 **状态**: ✅ 已完成,待测试验证 + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md index 13a374c4..97b22497 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md @@ -945,3 +945,4 @@ export const aiController = new AIController(); + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md index 80a3df7b..8436b664 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md @@ -1279,3 +1279,4 @@ npm install react-markdown + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md index 7dd2045a..10b9c98a 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md @@ -301,3 +301,4 @@ Changes: + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md index 013f22c3..6f489b86 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md @@ -373,3 +373,4 @@ cd path; command + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md index 24714103..ef4df1b8 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md @@ -602,3 +602,4 @@ import { logger } from '../../../../common/logging/index.js'; + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md index 3e670caa..933418f1 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md @@ -606,3 +606,4 @@ Content-Length: 45234 + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md index fb345c18..b99000d4 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md @@ -258,3 +258,4 @@ Response: + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md index 110f84bf..ccd570f2 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md @@ -411,3 +411,4 @@ Response: + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md index 1cdf0ba5..c3da4119 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md @@ -405,3 +405,4 @@ import { ChatContainer } from '@/shared/components/Chat'; + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md index 024cbd83..978235e3 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md @@ -315,3 +315,4 @@ const initialMessages = defaultMessages.length > 0 ? defaultMessages : [{ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md index d7c58eba..176e7e95 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md @@ -355,3 +355,4 @@ python main.py + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md index dc1bd372..1909ff93 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md @@ -603,3 +603,4 @@ http://localhost:5173/data-cleaning/tool-c + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md index 74a4949a..c68a86f5 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md @@ -213,3 +213,4 @@ Day 5 (6-8小时): + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md index c94fc905..ecf2e431 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md @@ -391,3 +391,4 @@ Docs: docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建 + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md index a86faa23..cbf6ec4b 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md @@ -366,3 +366,4 @@ const mockAssets: Asset[] = [ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md index 2bfb349a..706b6a8d 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md @@ -350,3 +350,4 @@ frontend-v2/src/modules/dc/ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md index 656f47cb..8b6ea790 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md @@ -310,3 +310,4 @@ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md index 774aedf1..5fd50328 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md @@ -264,3 +264,4 @@ ConflictDetectionService // 冲突检测(字段级对比) + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md index cd968e10..2bb0686a 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md @@ -313,3 +313,4 @@ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md index 13c52c25..aab0db15 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md @@ -276,3 +276,4 @@ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md index e54a3ebc..90c410de 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md @@ -340,3 +340,4 @@ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md index 03c996b7..c55aab49 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md @@ -428,3 +428,4 @@ Tool B后端代码**100%复用**了平台通用能力层,无任何重复开发 + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md index 3503a2ef..d53721a3 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md @@ -274,3 +274,4 @@ + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md index d266e6a2..7d4bf5f8 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md @@ -205,3 +205,4 @@ $ node scripts/check-dc-tables.mjs + diff --git a/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md b/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md index 932140e3..82723b6f 100644 --- a/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md +++ b/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md @@ -438,3 +438,4 @@ ${fields.map((f, i) => `${i + 1}. ${f.name}:${f.desc}`).join('\n')} + diff --git a/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md b/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md index 72118bd0..4b06266a 100644 --- a/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md +++ b/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md @@ -452,3 +452,4 @@ import { ChatContainer } from '@/shared/components/Chat'; + diff --git a/extraction_service/main.py b/extraction_service/main.py index 9d487532..2fcf4900 100644 --- a/extraction_service/main.py +++ b/extraction_service/main.py @@ -851,15 +851,22 @@ async def operation_binning(request: BinningRequest): request.num_bins ) - # 转换回JSON(处理Categorical类型和NaN值) + # 转换回JSON(处理Categorical类型、NaN值和inf值) + import numpy as np + # 1. 将Categorical列转为字符串 for col in result_df.columns: if pd.api.types.is_categorical_dtype(result_df[col]): result_df[col] = result_df[col].astype(str) - # 2. 将NaN替换为None(避免JSON序列化错误) - result_df_clean = result_df.fillna(value=pd.NA).replace({pd.NA: None}) - result_data = result_df_clean.to_dict('records') + # 2. 替换inf和-inf为None + result_df = result_df.replace([np.inf, -np.inf], None) + + # 3. 将NaN替换为None(避免JSON序列化错误) + result_df = result_df.fillna(value=pd.NA).replace({pd.NA: None}) + + # 4. 转换为dict + result_data = result_df.to_dict('records') # 恢复stdout sys.stdout = sys.__stdout__ @@ -869,13 +876,22 @@ async def operation_binning(request: BinningRequest): logger.info(f"分箱成功: {request.column} → {request.new_column_name}") - return JSONResponse(content={ + # 使用json.dumps手动序列化(确保NaN完全处理) + import json + response_content = { "success": True, "result_data": result_data, "output": output, "execution_time": execution_time, "result_shape": [len(result_data), len(result_df.columns)] - }) + } + + # 手动序列化,NaN会被转为null + json_str = json.dumps(response_content, allow_nan=True) + # 替换NaN为null(防止任何遗漏的NaN) + json_str = json_str.replace('NaN', 'null').replace('Infinity', 'null').replace('-Infinity', 'null') + + return JSONResponse(content=json.loads(json_str)) except Exception as e: sys.stdout = sys.__stdout__ @@ -937,9 +953,11 @@ async def operation_conditional(request: ConditionalRequest): request.else_value ) - # 转换回JSON(处理NaN值) - result_df_clean = result_df.fillna(value=pd.NA).replace({pd.NA: None}) - result_data = result_df_clean.to_dict('records') + # 转换回JSON(处理NaN和inf值) + import numpy as np + result_df = result_df.replace([np.inf, -np.inf], None) + result_df = result_df.fillna(value=pd.NA).replace({pd.NA: None}) + result_data = result_df.to_dict('records') # 恢复stdout sys.stdout = sys.__stdout__ @@ -1015,9 +1033,11 @@ async def operation_dropna(request: DropnaRequest): subset=request.subset ) - # 转换回JSON(处理NaN值) - result_df_clean = result_df.fillna(value=pd.NA).replace({pd.NA: None}) - result_data = result_df_clean.to_dict('records') + # 转换回JSON(处理NaN和inf值) + import numpy as np + result_df = result_df.replace([np.inf, -np.inf], None) + result_df = result_df.fillna(value=pd.NA).replace({pd.NA: None}) + result_data = result_df.to_dict('records') # 恢复stdout sys.stdout = sys.__stdout__ diff --git a/extraction_service/operations/__init__.py b/extraction_service/operations/__init__.py index e915a187..3f2ec111 100644 --- a/extraction_service/operations/__init__.py +++ b/extraction_service/operations/__init__.py @@ -15,3 +15,4 @@ __version__ = '1.0.0' + diff --git a/extraction_service/operations/compute.py b/extraction_service/operations/compute.py index e9a9064d..a5ede2f8 100644 --- a/extraction_service/operations/compute.py +++ b/extraction_service/operations/compute.py @@ -60,8 +60,8 @@ def validate_formula(formula: str, available_columns: list) -> tuple[bool, str]: return False, f'公式包含不允许的操作: {pattern}' # ✨ 增强:检查是否只包含允许的字符(放宽限制,支持更多特殊字符) - # 允许:英文字母、数字、下划线、中文、空格、运算符、括号(中英文)、逗号、点、冒号、等号 - allowed_chars = r'[a-zA-Z0-9_\u4e00-\u9fa5\s\+\-\*/\(\)\[\]\{\}\.,:\*\*=()【】、。:;!?]' + # 允许:英文字母、数字、下划线、中文、空格、运算符、括号(中英文)、逗号(中英文)、点、冒号、等号 + allowed_chars = r'[a-zA-Z0-9_\u4e00-\u9fa5\s\+\-\*/\(\)\[\]\{\}\.,,:\*\*=()【】、。:;!?]' if not re.match(f'^{allowed_chars}+$', formula): # 找出不允许的字符 invalid_chars = set(re.findall(f'[^{allowed_chars}]', formula)) diff --git a/extraction_service/operations/dropna.py b/extraction_service/operations/dropna.py index 42ee5163..5e08aa59 100644 --- a/extraction_service/operations/dropna.py +++ b/extraction_service/operations/dropna.py @@ -148,3 +148,4 @@ def get_missing_summary(df: pd.DataFrame) -> dict: } + diff --git a/extraction_service/operations/filter.py b/extraction_service/operations/filter.py index c62c95a7..df5afe11 100644 --- a/extraction_service/operations/filter.py +++ b/extraction_service/operations/filter.py @@ -108,3 +108,4 @@ def apply_filter( return result + diff --git a/extraction_service/test_dc_api.py b/extraction_service/test_dc_api.py index 4c45383d..88a6cb84 100644 --- a/extraction_service/test_dc_api.py +++ b/extraction_service/test_dc_api.py @@ -282,3 +282,4 @@ if __name__ == "__main__": + diff --git a/extraction_service/test_execute_simple.py b/extraction_service/test_execute_simple.py index 825ffef7..d67d8fab 100644 --- a/extraction_service/test_execute_simple.py +++ b/extraction_service/test_execute_simple.py @@ -48,3 +48,4 @@ except Exception as e: + diff --git a/extraction_service/test_module.py b/extraction_service/test_module.py index 1f67559a..4e3b88da 100644 --- a/extraction_service/test_module.py +++ b/extraction_service/test_module.py @@ -28,3 +28,4 @@ except Exception as e: + diff --git a/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx b/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx index 2299b4f1..9dea3f44 100644 --- a/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx +++ b/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx @@ -517,3 +517,4 @@ export default FulltextDetailDrawer; + diff --git a/frontend-v2/src/modules/asl/hooks/useFulltextResults.ts b/frontend-v2/src/modules/asl/hooks/useFulltextResults.ts index 8a364bb9..3d302963 100644 --- a/frontend-v2/src/modules/asl/hooks/useFulltextResults.ts +++ b/frontend-v2/src/modules/asl/hooks/useFulltextResults.ts @@ -116,3 +116,4 @@ export function useFulltextResults({ + diff --git a/frontend-v2/src/modules/asl/hooks/useFulltextTask.ts b/frontend-v2/src/modules/asl/hooks/useFulltextTask.ts index 8f3e7223..307a907d 100644 --- a/frontend-v2/src/modules/asl/hooks/useFulltextTask.ts +++ b/frontend-v2/src/modules/asl/hooks/useFulltextTask.ts @@ -79,3 +79,4 @@ export function useFulltextTask({ + diff --git a/frontend-v2/src/modules/asl/pages/FulltextResults.tsx b/frontend-v2/src/modules/asl/pages/FulltextResults.tsx index 4d6fdc63..f2ff4317 100644 --- a/frontend-v2/src/modules/asl/pages/FulltextResults.tsx +++ b/frontend-v2/src/modules/asl/pages/FulltextResults.tsx @@ -470,3 +470,4 @@ export default FulltextResults; + diff --git a/frontend-v2/src/modules/dc/hooks/useAssets.ts b/frontend-v2/src/modules/dc/hooks/useAssets.ts index ffa3be5c..b79d16b5 100644 --- a/frontend-v2/src/modules/dc/hooks/useAssets.ts +++ b/frontend-v2/src/modules/dc/hooks/useAssets.ts @@ -110,3 +110,4 @@ export const useAssets = (activeTab: AssetTabType) => { + diff --git a/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts b/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts index 2cd6200c..419fa619 100644 --- a/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts +++ b/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts @@ -100,3 +100,4 @@ export const useRecentTasks = () => { + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/components/BinningDialog_improved.tsx b/frontend-v2/src/modules/dc/pages/tool-c/components/BinningDialog_improved.tsx index 90a8d5ec..765f45fd 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/components/BinningDialog_improved.tsx +++ b/frontend-v2/src/modules/dc/pages/tool-c/components/BinningDialog_improved.tsx @@ -336,3 +336,4 @@ const BinningDialog: React.FC = ({ export default BinningDialog; + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx b/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx index 7669bfef..87d01cc2 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx +++ b/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx @@ -299,3 +299,4 @@ const DropnaDialog: React.FC = ({ export default DropnaDialog; + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/components/PivotDialog.tsx b/frontend-v2/src/modules/dc/pages/tool-c/components/PivotDialog.tsx index b6be31d3..4c39799a 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/components/PivotDialog.tsx +++ b/frontend-v2/src/modules/dc/pages/tool-c/components/PivotDialog.tsx @@ -261,3 +261,4 @@ const PivotDialog: React.FC = ({ export default PivotDialog; + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts b/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts index 6920e74e..bcae6391 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts +++ b/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts @@ -62,3 +62,4 @@ export interface DataStats { + diff --git a/frontend-v2/src/modules/dc/types/portal.ts b/frontend-v2/src/modules/dc/types/portal.ts index 82ac0b8c..78fe3685 100644 --- a/frontend-v2/src/modules/dc/types/portal.ts +++ b/frontend-v2/src/modules/dc/types/portal.ts @@ -58,3 +58,4 @@ export type AssetTabType = 'all' | 'processed' | 'raw'; + diff --git a/frontend-v2/src/shared/components/index.ts b/frontend-v2/src/shared/components/index.ts index 27100228..5ef0125f 100644 --- a/frontend-v2/src/shared/components/index.ts +++ b/frontend-v2/src/shared/components/index.ts @@ -13,3 +13,4 @@ export { default as Placeholder } from './Placeholder'; + diff --git a/python-microservice/operations/__init__.py b/python-microservice/operations/__init__.py index e915a187..3f2ec111 100644 --- a/python-microservice/operations/__init__.py +++ b/python-microservice/operations/__init__.py @@ -15,3 +15,4 @@ __version__ = '1.0.0' + diff --git a/python-microservice/operations/binning.py b/python-microservice/operations/binning.py index 05b89047..da210503 100644 --- a/python-microservice/operations/binning.py +++ b/python-microservice/operations/binning.py @@ -122,3 +122,4 @@ def apply_binning( return result + diff --git a/python-microservice/operations/filter.py b/python-microservice/operations/filter.py index c62c95a7..df5afe11 100644 --- a/python-microservice/operations/filter.py +++ b/python-microservice/operations/filter.py @@ -108,3 +108,4 @@ def apply_filter( return result + diff --git a/python-microservice/operations/recode.py b/python-microservice/operations/recode.py index a8a49a0c..5fd07f8f 100644 --- a/python-microservice/operations/recode.py +++ b/python-microservice/operations/recode.py @@ -78,3 +78,4 @@ def apply_recode( return result + diff --git a/recover_dc_code.py b/recover_dc_code.py index 9607b295..e3d1214a 100644 --- a/recover_dc_code.py +++ b/recover_dc_code.py @@ -222,3 +222,4 @@ if __name__ == "__main__": + diff --git a/run_recovery.ps1 b/run_recovery.ps1 index 086a0277..b145df3a 100644 --- a/run_recovery.ps1 +++ b/run_recovery.ps1 @@ -46,3 +46,4 @@ Write-Host "==================================================================== +