Skip to content

Commit 968fed0

Browse files
committed
Merge remote-tracking branch 'origin/develop_930' into develop_930
2 parents dd69755 + 8641760 commit 968fed0

File tree

5 files changed

+35
-364
lines changed

5 files changed

+35
-364
lines changed

frontend/src/mock/cleansing.tsx

Lines changed: 0 additions & 335 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,14 @@
1-
import type { OperatorI } from "@/pages/DataCleansing/cleansing.model";
21
import {
32
DatabaseOutlined,
4-
FilterOutlined,
53
BarChartOutlined,
64
FileTextOutlined,
75
ThunderboltOutlined,
86
PictureOutlined,
97
CalculatorOutlined,
10-
ClusterOutlined,
11-
AimOutlined,
128
SwapOutlined,
139
} from "@ant-design/icons";
1410
import { FileImage, FileText, Music, Repeat, Video } from "lucide-react";
1511

16-
export const MOCK_TASKS = [
17-
{
18-
id: 1,
19-
name: "肺癌WSI图像清洗",
20-
description: "肺癌WSI病理图像数据集的标准化清洗任务",
21-
dataset: "肺癌WSI病理图像数据集",
22-
newDatasetName: "肺癌WSI图像_清洗后",
23-
template: "医学影像标准清洗",
24-
batchSize: 100,
25-
status: "运行中",
26-
progress: 60,
27-
startTime: "2024-01-20 09:30:15",
28-
estimatedTime: "2小时",
29-
totalFiles: 1250,
30-
processedFiles: 750,
31-
operators: ["格式转换", "噪声去除", "尺寸标准化", "质量检查"],
32-
},
33-
{
34-
id: 2,
35-
name: "病理WSI图像处理",
36-
description: "WSI病理切片图像的专业清洗流程",
37-
dataset: "WSI切片数据集",
38-
newDatasetName: "WSI切片_清洗后",
39-
template: "病理WSI图像处理",
40-
batchSize: 100,
41-
status: "已完成",
42-
progress: 100,
43-
startTime: "2024-01-18 14:10:00",
44-
estimatedTime: "1小时30分",
45-
totalFiles: 800,
46-
processedFiles: 800,
47-
operators: ["格式转换", "色彩校正", "分辨率调整", "组织区域提取"],
48-
},
49-
{
50-
id: 3,
51-
name: "医学文本清洗",
52-
description: "医学文本数据的标准化清洗流程",
53-
dataset: "医学文本数据集",
54-
newDatasetName: "医学文本_清洗后",
55-
template: "医学文本清洗",
56-
batchSize: 200,
57-
status: "队列中",
58-
progress: 0,
59-
startTime: "待开始",
60-
estimatedTime: "预计2小时",
61-
totalFiles: 1000,
62-
processedFiles: 0,
63-
operators: ["编码转换", "格式统一", "敏感信息脱敏", "质量过滤"],
64-
},
65-
];
66-
67-
export const MOCK_TEMPLATES = [
68-
{
69-
id: "medical-image",
70-
name: "医学影像标准清洗",
71-
description: "专用于医学影像的标准化清洗流程,包含格式转换、质量检查等步骤",
72-
operators: [
73-
"DICOM解析",
74-
"格式标准化",
75-
"窗宽窗位调整",
76-
"噪声去除",
77-
"质量检查",
78-
],
79-
category: "医学影像",
80-
usage: 156,
81-
color: "blue",
82-
},
83-
{
84-
id: "pathology-wsi",
85-
name: "病理WSI图像处理",
86-
description: "WSI病理切片图像的专业清洗流程,优化病理诊断数据质量",
87-
operators: ["格式转换", "色彩校正", "分辨率调整", "组织区域提取"],
88-
category: "病理学",
89-
usage: 89,
90-
color: "green",
91-
},
92-
{
93-
id: "text-cleaning",
94-
name: "医学文本清洗",
95-
description: "医学文本数据的标准化清洗流程,确保文本数据的一致性和质量",
96-
operators: ["编码转换", "格式统一", "敏感信息脱敏", "质量过滤"],
97-
category: "文本处理",
98-
usage: 234,
99-
color: "purple",
100-
},
101-
{
102-
id: "general-image",
103-
name: "通用图像清洗",
104-
description: "适用于各类图像数据的通用清洗流程,提供基础的图像处理功能",
105-
operators: ["质量检查", "重复检测", "异常过滤", "格式转换"],
106-
category: "通用",
107-
usage: 445,
108-
color: "orange",
109-
},
110-
{
111-
id: "audio-processing",
112-
name: "音频数据清洗",
113-
description: "专门针对医学音频数据的清洗和预处理流程",
114-
operators: ["噪声去除", "格式转换", "音量标准化", "质量检测"],
115-
category: "音频处理",
116-
usage: 67,
117-
color: "pink",
118-
},
119-
{
120-
id: "multimodal-clean",
121-
name: "多模态数据清洗",
122-
description: "处理包含多种数据类型的综合清洗流程",
123-
operators: ["数据分类", "格式统一", "质量检查", "关联验证"],
124-
category: "多模态",
125-
usage: 123,
126-
color: "geekblue",
127-
},
128-
];
129-
13012
// 模板类型选项
13113
export const templateTypes = [
13214
{
@@ -172,220 +54,3 @@ export const OPERATOR_CATEGORIES = {
17254
io: { name: "输入输出", icon: <FileTextOutlined />, color: "#595959" },
17355
math: { name: "数学计算", icon: <CalculatorOutlined />, color: "#fadb14" },
17456
};
175-
176-
// 模拟算子模板
177-
const generateOperatorTemplates = (): OperatorI[] => {
178-
const templates: OperatorI[] = [
179-
{
180-
id: "data_reader_mysql",
181-
name: "MySQL读取",
182-
type: "data_reader",
183-
category: "data",
184-
icon: <DatabaseOutlined />,
185-
description: "从MySQL数据库读取数据",
186-
tags: ["数据库", "读取", "MySQL"],
187-
isStar: true,
188-
settings: {
189-
host: { type: "input", label: "主机地址", value: "localhost" },
190-
port: { type: "input", label: "端口", value: "3306" },
191-
database: { type: "input", label: "数据库名", value: "" },
192-
table: { type: "input", label: "表名", value: "" },
193-
limit: {
194-
type: "range",
195-
label: "读取行数",
196-
value: [1000],
197-
min: 100,
198-
max: 10000,
199-
step: 100,
200-
},
201-
},
202-
},
203-
{
204-
id: "data_reader_csv",
205-
name: "CSV读取",
206-
type: "data_reader",
207-
category: "data",
208-
icon: <FileTextOutlined />,
209-
description: "读取CSV文件数据",
210-
tags: ["文件", "读取", "CSV"],
211-
isStar: true,
212-
settings: {
213-
filepath: { type: "input", label: "文件路径", value: "" },
214-
encoding: {
215-
type: "select",
216-
label: "编码",
217-
value: "utf-8",
218-
options: ["utf-8", "gbk", "ascii"],
219-
},
220-
delimiter: { type: "input", label: "分隔符", value: "," },
221-
},
222-
},
223-
{
224-
id: "data_filter",
225-
name: "数据过滤",
226-
type: "filter",
227-
category: "data",
228-
icon: <FilterOutlined />,
229-
description: "根据条件过滤数据行",
230-
tags: ["过滤", "条件", "筛选"],
231-
isStar: true,
232-
params: {
233-
column: { type: "input", label: "过滤字段", value: "" },
234-
operator: {
235-
type: "select",
236-
label: "操作符",
237-
value: "equals",
238-
options: [
239-
"equals",
240-
"not_equals",
241-
"greater_than",
242-
"less_than",
243-
"contains",
244-
],
245-
},
246-
value: { type: "input", label: "过滤值", value: "" },
247-
},
248-
},
249-
{
250-
id: "linear_regression",
251-
name: "线性回归",
252-
type: "ml_model",
253-
category: "ml",
254-
icon: <ThunderboltOutlined />,
255-
description: "训练线性回归模型",
256-
tags: ["回归", "监督学习", "预测"],
257-
isStar: true,
258-
settings: {
259-
features: {
260-
type: "checkbox",
261-
label: "特征列",
262-
value: [],
263-
options: ["feature1", "feature2", "feature3"],
264-
},
265-
target: { type: "input", label: "目标列", value: "" },
266-
test_size: {
267-
type: "range",
268-
label: "测试集比例",
269-
value: [0.2],
270-
min: 0.1,
271-
max: 0.5,
272-
step: 0.1,
273-
},
274-
},
275-
},
276-
{
277-
id: "random_forest",
278-
name: "随机森林",
279-
type: "ml_model",
280-
category: "ml",
281-
icon: <ClusterOutlined />,
282-
description: "训练随机森林模型",
283-
tags: ["分类", "回归", "集成学习"],
284-
settings: {
285-
n_estimators: {
286-
type: "range",
287-
label: "树的数量",
288-
value: [100],
289-
min: 10,
290-
max: 500,
291-
step: 10,
292-
},
293-
max_depth: {
294-
type: "range",
295-
label: "最大深度",
296-
value: [10],
297-
min: 3,
298-
max: 20,
299-
step: 1,
300-
},
301-
features: {
302-
type: "checkbox",
303-
label: "特征列",
304-
value: [],
305-
options: ["feature1", "feature2", "feature3"],
306-
},
307-
},
308-
},
309-
{
310-
id: "image_resize",
311-
name: "图像缩放",
312-
type: "image_transform",
313-
category: "vision",
314-
icon: <PictureOutlined />,
315-
description: "调整图像尺寸",
316-
tags: ["图像", "缩放", "预处理"],
317-
params: {
318-
width: { type: "input", label: "宽度", value: "224" },
319-
height: { type: "input", label: "高度", value: "224" },
320-
method: {
321-
type: "select",
322-
label: "缩放方法",
323-
value: "bilinear",
324-
options: ["bilinear", "nearest", "bicubic"],
325-
},
326-
},
327-
},
328-
{
329-
id: "object_detection",
330-
name: "目标检测",
331-
type: "vision_model",
332-
category: "vision",
333-
icon: <AimOutlined />,
334-
description: "检测图像中的目标对象",
335-
tags: ["检测", "目标", "YOLO"],
336-
params: {
337-
model: {
338-
type: "select",
339-
label: "模型",
340-
value: "yolov5",
341-
options: ["yolov5", "yolov8", "rcnn"],
342-
},
343-
confidence: {
344-
type: "range",
345-
label: "置信度阈值",
346-
value: [0.5],
347-
min: 0.1,
348-
max: 1.0,
349-
step: 0.1,
350-
},
351-
classes: {
352-
type: "checkbox",
353-
label: "检测类别",
354-
value: [],
355-
options: ["person", "car", "dog", "cat"],
356-
},
357-
},
358-
},
359-
];
360-
361-
// 生成更多算子以模拟100+的场景
362-
const additionalTemplates: OperatorTemplate[] = [];
363-
const categories = Object.keys(
364-
OPERATOR_CATEGORIES
365-
) as (keyof typeof OPERATOR_CATEGORIES)[];
366-
for (let i = 0; i < 95; i++) {
367-
const category = categories[i % categories.length];
368-
additionalTemplates.push({
369-
id: `operator_${i + 8}`,
370-
name: `算子${i + 8}`,
371-
type: `type_${i + 8}`,
372-
category,
373-
icon: <ThunderboltOutlined />,
374-
description: `这是第${i + 8}个算子的描述`,
375-
tags: [`标签${(i % 5) + 1}`, `功能${(i % 3) + 1}`],
376-
isPopular: i % 10 === 0,
377-
params: {
378-
param1: { type: "input", label: "参数1", value: "" },
379-
param2: {
380-
type: "select",
381-
label: "参数2",
382-
value: "option1",
383-
options: ["option1", "option2", "option3"],
384-
},
385-
},
386-
});
387-
}
388-
return [...templates, ...additionalTemplates];
389-
};
390-
391-
export const operatorList = generateOperatorTemplates();

frontend/src/pages/DataCleansing/Create/CreateTask.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ArrowLeft, Database } from "lucide-react";
1616
import OperatorLibrary from "./components/OperatorLibrary";
1717
import OperatorOrchestration from "./components/OperatorOrchestration";
1818
import OperatorConfig from "./components/OperatorConfig";
19-
import { OPERATOR_CATEGORIES, operatorList } from "@/mock/cleansing";
19+
import { OPERATOR_CATEGORIES } from "@/mock/cleansing";
2020
import { datasetSubTypeMap } from "@/pages/DataManagement/dataset.const";
2121
import { queryDatasetsUsingGet } from "@/pages/DataManagement/dataset.api";
2222
import { useDragOperators } from "./hooks/useDragOperators";
@@ -176,7 +176,7 @@ export default function CleansingTaskCreate() {
176176
{/* 左侧算子库 */}
177177
<OperatorLibrary
178178
operators={operators}
179-
operatorList={operatorList}
179+
operatorList={currentTemplate?.instance || []}
180180
OPERATOR_CATEGORIES={OPERATOR_CATEGORIES}
181181
toggleOperator={toggleOperator}
182182
handleDragStart={handleDragStart}
@@ -293,7 +293,7 @@ export default function CleansingTaskCreate() {
293293
</Form.Item>
294294
<Form.Item label="包含算子">
295295
<div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
296-
{operatorList.map((op, index) => (
296+
{operators.map((op, index) => (
297297
<Tag key={index}>{op.name}</Tag>
298298
))}
299299
</div>

0 commit comments

Comments
 (0)