synapse-sdk 2025.10.1__py3-none-any.whl → 2025.10.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of synapse-sdk might be problematic. Click here for more details.
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-action.md +934 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-overview.md +560 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-template.md +715 -0
- synapse_sdk/devtools/docs/docs/plugins/plugins.md +12 -5
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-action.md +934 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-overview.md +560 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-template.md +715 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current.json +16 -4
- synapse_sdk/devtools/docs/sidebars.ts +27 -1
- synapse_sdk/plugins/README.md +487 -80
- synapse_sdk/plugins/categories/export/actions/export/action.py +8 -3
- synapse_sdk/plugins/categories/export/actions/export/utils.py +108 -8
- synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +4 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/__init__.py +3 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/action.py +10 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/__init__.py +28 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/action.py +145 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/enums.py +269 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/exceptions.py +14 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/factory.py +76 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/models.py +97 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/orchestrator.py +250 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/run.py +64 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/__init__.py +17 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/annotation.py +284 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/base.py +170 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/extraction.py +83 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/metrics.py +87 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/preprocessor.py +127 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/validation.py +143 -0
- synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +2 -1
- synapse_sdk/plugins/categories/upload/actions/upload/models.py +134 -94
- synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +2 -2
- synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +106 -14
- synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +113 -36
- synapse_sdk/plugins/categories/upload/templates/README.md +365 -0
- {synapse_sdk-2025.10.1.dist-info → synapse_sdk-2025.10.4.dist-info}/METADATA +1 -1
- {synapse_sdk-2025.10.1.dist-info → synapse_sdk-2025.10.4.dist-info}/RECORD +50 -22
- synapse_sdk/devtools/docs/docs/plugins/developing-upload-template.md +0 -1463
- synapse_sdk/devtools/docs/docs/plugins/upload-plugins.md +0 -1964
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/developing-upload-template.md +0 -1463
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/upload-plugins.md +0 -2077
- {synapse_sdk-2025.10.1.dist-info → synapse_sdk-2025.10.4.dist-info}/WHEEL +0 -0
- {synapse_sdk-2025.10.1.dist-info → synapse_sdk-2025.10.4.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-2025.10.1.dist-info → synapse_sdk-2025.10.4.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-2025.10.1.dist-info → synapse_sdk-2025.10.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: upload-plugin-overview
|
|
3
|
+
title: Upload Plugin Overview
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Upload Plugin Overview
|
|
8
|
+
|
|
9
|
+
Upload plugins provide comprehensive file upload and data ingestion operations for processing files into the Synapse platform with metadata support, security validation, and organized data unit generation.
|
|
10
|
+
|
|
11
|
+
## Quick Overview
|
|
12
|
+
|
|
13
|
+
**Category:** Upload
|
|
14
|
+
**Available Actions:** `upload`
|
|
15
|
+
**Execution Method:** Job-based execution
|
|
16
|
+
|
|
17
|
+
## Key Features
|
|
18
|
+
|
|
19
|
+
- **Multi-Path Mode Support**: Upload files from different locations with individual path settings for each asset
|
|
20
|
+
- **Excel Metadata Integration**: Automatic metadata annotation from Excel files
|
|
21
|
+
- **Flexible File Organization**: Single-path or multi-path modes for different use cases
|
|
22
|
+
- **Batch Processing**: Optimized batch processing for large-scale uploads
|
|
23
|
+
- **Progress Tracking**: Real-time progress updates across workflow stages
|
|
24
|
+
- **Security Validation**: Comprehensive file and Excel security checks
|
|
25
|
+
|
|
26
|
+
## Use Cases
|
|
27
|
+
|
|
28
|
+
- Bulk file uploads with metadata annotation
|
|
29
|
+
- Excel-based metadata mapping and validation
|
|
30
|
+
- Recursive directory processing
|
|
31
|
+
- Type-based file organization
|
|
32
|
+
- Batch data unit creation
|
|
33
|
+
- Multi-source dataset uploads (sensors, cameras, annotations from different locations)
|
|
34
|
+
- Secure file processing with size and content validation
|
|
35
|
+
|
|
36
|
+
## Supported Upload Sources
|
|
37
|
+
|
|
38
|
+
- Local file system paths (files and directories)
|
|
39
|
+
- Recursive directory scanning
|
|
40
|
+
- Excel metadata files for enhanced file annotation
|
|
41
|
+
- Mixed file types with automatic organization
|
|
42
|
+
- Distributed data sources with per-asset path configuration
|
|
43
|
+
|
|
44
|
+
## Configuration Modes
|
|
45
|
+
|
|
46
|
+
### Mode 1: Single Path Mode (Default - `use_single_path: true`)
|
|
47
|
+
|
|
48
|
+
All assets share one base directory. The system expects subdirectories for each file specification.
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"name": "Standard Upload",
|
|
53
|
+
"use_single_path": true,
|
|
54
|
+
"path": "/data/experiment",
|
|
55
|
+
"is_recursive": true,
|
|
56
|
+
"storage": 1,
|
|
57
|
+
"data_collection": 5
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Expected Directory Structure:**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
/data/experiment/
|
|
65
|
+
├── pcd_1/ # Point clouds
|
|
66
|
+
│ └── *.pcd
|
|
67
|
+
├── image_1/ # Images
|
|
68
|
+
│ └── *.jpg
|
|
69
|
+
└── json_meta_1/ # Metadata
|
|
70
|
+
└── *.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Mode 2: Multi-Path Mode (`use_single_path: false`)
|
|
74
|
+
|
|
75
|
+
Each asset has its own path and recursive setting. Perfect for distributed data sources.
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"name": "Multi-Source Upload",
|
|
80
|
+
"use_single_path": false,
|
|
81
|
+
"assets": {
|
|
82
|
+
"pcd_1": {
|
|
83
|
+
"path": "/sensors/lidar/scan_001",
|
|
84
|
+
"is_recursive": false
|
|
85
|
+
},
|
|
86
|
+
"image_1": {
|
|
87
|
+
"path": "/sensors/camera/front",
|
|
88
|
+
"is_recursive": true
|
|
89
|
+
},
|
|
90
|
+
"json_meta_1": {
|
|
91
|
+
"path": "/metadata/annotations",
|
|
92
|
+
"is_recursive": false
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"storage": 1,
|
|
96
|
+
"data_collection": 5
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Basic Usage
|
|
101
|
+
|
|
102
|
+
### CLI Usage
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Single path mode (traditional)
|
|
106
|
+
synapse plugin run upload '{
|
|
107
|
+
"name": "Dataset Upload",
|
|
108
|
+
"use_single_path": true,
|
|
109
|
+
"path": "/data/training",
|
|
110
|
+
"is_recursive": true,
|
|
111
|
+
"storage": 1,
|
|
112
|
+
"data_collection": 5
|
|
113
|
+
}'
|
|
114
|
+
|
|
115
|
+
# Multi-path mode (advanced)
|
|
116
|
+
synapse plugin run upload '{
|
|
117
|
+
"name": "Multi-Sensor Upload",
|
|
118
|
+
"use_single_path": false,
|
|
119
|
+
"assets": {
|
|
120
|
+
"lidar": {"path": "/sensors/lidar", "is_recursive": true},
|
|
121
|
+
"camera": {"path": "/sensors/camera", "is_recursive": false}
|
|
122
|
+
},
|
|
123
|
+
"storage": 1,
|
|
124
|
+
"data_collection": 5
|
|
125
|
+
}'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Python API Usage
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from synapse_sdk.plugins.categories.upload.actions.upload.action import UploadAction
|
|
132
|
+
|
|
133
|
+
# Configure upload parameters
|
|
134
|
+
params = {
|
|
135
|
+
"name": "Dataset Upload",
|
|
136
|
+
"use_single_path": true,
|
|
137
|
+
"path": "/data/training_images",
|
|
138
|
+
"is_recursive": True,
|
|
139
|
+
"storage": 1,
|
|
140
|
+
"data_collection": 5,
|
|
141
|
+
"max_file_size_mb": 100
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
action = UploadAction(params=params, plugin_config=plugin_config)
|
|
145
|
+
result = action.start()
|
|
146
|
+
|
|
147
|
+
print(f"Uploaded {result['uploaded_files_count']} files")
|
|
148
|
+
print(f"Generated {result['generated_data_units_count']} data units")
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Configuration Parameters
|
|
152
|
+
|
|
153
|
+
### Required Parameters
|
|
154
|
+
|
|
155
|
+
| Parameter | Type | Description | Example |
|
|
156
|
+
| ----------------- | ----- | ------------------ | ------------- |
|
|
157
|
+
| `name` | `str` | Upload name | `"My Upload"` |
|
|
158
|
+
| `storage` | `int` | Storage ID | `1` |
|
|
159
|
+
| `data_collection` | `int` | Data collection ID | `5` |
|
|
160
|
+
|
|
161
|
+
### Mode-Specific Required Parameters
|
|
162
|
+
|
|
163
|
+
**Single Path Mode** (`use_single_path: true`):
|
|
164
|
+
|
|
165
|
+
- `path` (str): Base directory path
|
|
166
|
+
|
|
167
|
+
**Multi-Path Mode** (`use_single_path: false`):
|
|
168
|
+
|
|
169
|
+
- `assets` (dict): Asset-specific configurations with `path` and `is_recursive` per asset
|
|
170
|
+
|
|
171
|
+
### Optional Parameters
|
|
172
|
+
|
|
173
|
+
| Parameter | Type | Default | Description |
|
|
174
|
+
| ------------------------------- | ------------- | ------- | --------------------------------- |
|
|
175
|
+
| `description` | `str \| None` | `None` | Upload description |
|
|
176
|
+
| `project` | `int \| None` | `None` | Project ID |
|
|
177
|
+
| `use_single_path` | `bool` | `true` | Mode toggle |
|
|
178
|
+
| `is_recursive` | `bool` | `true` | Recursive scan (single path mode) |
|
|
179
|
+
| `excel_metadata_path` | `str \| None` | `None` | Excel metadata file path (will be deprecated in future, use `excel_metadata` instead) |
|
|
180
|
+
| `excel_metadata` | `dict \| None`| `None` | Excel metadata (base64 encoded, recommended) |
|
|
181
|
+
| `max_file_size_mb` | `int` | `50` | Maximum file size in MB |
|
|
182
|
+
| `creating_data_unit_batch_size` | `int` | `100` | Batch size for data units |
|
|
183
|
+
| `use_async_upload` | `bool` | `True` | Use asynchronous processing |
|
|
184
|
+
|
|
185
|
+
## Excel Metadata Support
|
|
186
|
+
|
|
187
|
+
The upload plugin provides advanced Excel metadata processing with flexible header support, comprehensive filename matching, and two distinct input methods for different use cases.
|
|
188
|
+
|
|
189
|
+
### Input Methods
|
|
190
|
+
|
|
191
|
+
There are two separate parameters for providing Excel metadata:
|
|
192
|
+
|
|
193
|
+
#### 1. File Path Method (`excel_metadata_path`)
|
|
194
|
+
|
|
195
|
+
:::info Future Deprecation Notice
|
|
196
|
+
This parameter will be deprecated in a future version.
|
|
197
|
+
We recommend using the `excel_metadata` parameter with base64 encoding for new implementations.
|
|
198
|
+
:::
|
|
199
|
+
|
|
200
|
+
**Use case:** Traditional file-based uploads where the Excel file exists on the server's file system.
|
|
201
|
+
|
|
202
|
+
Simple string path to an Excel file:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"excel_metadata_path": "/data/metadata.xlsx"
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Advantages:**
|
|
211
|
+
- Backward compatible with existing implementations
|
|
212
|
+
- Simple and straightforward
|
|
213
|
+
- Direct file system access
|
|
214
|
+
|
|
215
|
+
**Note:** Consider migrating to base64 encoded method for future compatibility (see Method 2 below)
|
|
216
|
+
|
|
217
|
+
#### 2. Base64 Encoded Method (`excel_metadata`) - **RECOMMENDED**
|
|
218
|
+
|
|
219
|
+
**Use case:** Web frontends, APIs, and cloud integrations where files are transmitted as encoded data.
|
|
220
|
+
|
|
221
|
+
Send Excel file as base64-encoded data with original filename:
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"excel_metadata": {
|
|
226
|
+
"data": "UEsDBBQABgAIAAAAIQDd4Z...", // base64 encoded Excel file
|
|
227
|
+
"filename": "metadata.xlsx"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Advantages:**
|
|
233
|
+
- No intermediate file storage required
|
|
234
|
+
- Perfect for web upload forms
|
|
235
|
+
- API-friendly JSON payload
|
|
236
|
+
- Automatic temporary file cleanup
|
|
237
|
+
- **This is the recommended method going forward**
|
|
238
|
+
|
|
239
|
+
**Python Example:**
|
|
240
|
+
```python
|
|
241
|
+
import base64
|
|
242
|
+
|
|
243
|
+
# Read Excel file and encode to base64
|
|
244
|
+
with open("metadata.xlsx", "rb") as f:
|
|
245
|
+
excel_bytes = f.read()
|
|
246
|
+
encoded_excel = base64.b64encode(excel_bytes).decode("utf-8")
|
|
247
|
+
|
|
248
|
+
# Use in upload parameters
|
|
249
|
+
upload_params = {
|
|
250
|
+
"name": "Web Upload",
|
|
251
|
+
"path": "/data/files",
|
|
252
|
+
"storage": 1,
|
|
253
|
+
"data_collection": 5,
|
|
254
|
+
"excel_metadata": {
|
|
255
|
+
"data": encoded_excel,
|
|
256
|
+
"filename": "metadata.xlsx"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
:::warning Important
|
|
262
|
+
You **cannot** use both `excel_metadata_path` and `excel_metadata` at the same time. Choose the method that best fits your use case:
|
|
263
|
+
- Use `excel_metadata_path` for server-side files (will be deprecated in future versions)
|
|
264
|
+
- Use `excel_metadata` for all use cases (recommended for new implementations)
|
|
265
|
+
:::
|
|
266
|
+
|
|
267
|
+
### Future-Proof Migration Example
|
|
268
|
+
|
|
269
|
+
For new implementations, we recommend using `excel_metadata`. Here's how to migrate:
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
import base64
|
|
273
|
+
|
|
274
|
+
# Current approach (will be deprecated in future):
|
|
275
|
+
upload_params = {
|
|
276
|
+
"name": "My Upload",
|
|
277
|
+
"path": "/data/files",
|
|
278
|
+
"storage": 1,
|
|
279
|
+
"data_collection": 5,
|
|
280
|
+
"excel_metadata_path": "/data/metadata.xlsx" # Will be deprecated
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
# Recommended approach for new implementations:
|
|
284
|
+
with open("/data/metadata.xlsx", "rb") as f:
|
|
285
|
+
excel_bytes = f.read()
|
|
286
|
+
encoded_excel = base64.b64encode(excel_bytes).decode("utf-8")
|
|
287
|
+
|
|
288
|
+
upload_params = {
|
|
289
|
+
"name": "My Upload",
|
|
290
|
+
"path": "/data/files",
|
|
291
|
+
"storage": 1,
|
|
292
|
+
"data_collection": 5,
|
|
293
|
+
"excel_metadata": {
|
|
294
|
+
"data": encoded_excel,
|
|
295
|
+
"filename": "metadata.xlsx"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Excel Format
|
|
301
|
+
|
|
302
|
+
Both header formats are supported (case-insensitive):
|
|
303
|
+
|
|
304
|
+
**Option 1: "filename" header**
|
|
305
|
+
| filename | category | description | custom_field |
|
|
306
|
+
|----------|----------|-------------|--------------|
|
|
307
|
+
| image1.jpg | nature | Mountain landscape | high_res |
|
|
308
|
+
| image2.png | urban | City skyline | processed |
|
|
309
|
+
|
|
310
|
+
**Option 2: "filename" header**
|
|
311
|
+
| file_name | category | description | custom_field |
|
|
312
|
+
|-----------|----------|-------------|--------------|
|
|
313
|
+
| image1.jpg | nature | Mountain landscape | high_res |
|
|
314
|
+
| image2.png | urban | City skyline | processed |
|
|
315
|
+
|
|
316
|
+
### Filename Matching
|
|
317
|
+
|
|
318
|
+
The system uses a 5-tier priority matching algorithm:
|
|
319
|
+
|
|
320
|
+
1. **Exact stem match** (highest priority): `image1` matches `image1.jpg`
|
|
321
|
+
2. **Exact filename match**: `image1.jpg` matches `image1.jpg`
|
|
322
|
+
3. **Metadata key stem match**: `path/image1.ext` stem matches `image1`
|
|
323
|
+
4. **Partial path matching**: `/uploads/image1.jpg` contains `image1`
|
|
324
|
+
5. **Full path matching**: Complete path matching for complex structures
|
|
325
|
+
|
|
326
|
+
### Security Validation
|
|
327
|
+
|
|
328
|
+
Excel files undergo security validation:
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
# Default security limits
|
|
332
|
+
max_file_size_mb: 10 # File size limit
|
|
333
|
+
max_rows: 100000 # Row count limit
|
|
334
|
+
max_columns: 50 # Column count limit
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Configuration
|
|
338
|
+
|
|
339
|
+
Configure Excel security in `config.yaml`:
|
|
340
|
+
|
|
341
|
+
```yaml
|
|
342
|
+
actions:
|
|
343
|
+
upload:
|
|
344
|
+
excel_config:
|
|
345
|
+
max_file_size_mb: 10
|
|
346
|
+
max_rows: 100000
|
|
347
|
+
max_columns: 50
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## Progress Tracking
|
|
351
|
+
|
|
352
|
+
The upload action tracks progress across three main phases:
|
|
353
|
+
|
|
354
|
+
| Category | Proportion | Description |
|
|
355
|
+
| --------------------- | ---------- | ----------------------------------- |
|
|
356
|
+
| `analyze_collection` | 2% | Parameter validation and setup |
|
|
357
|
+
| `upload_data_files` | 38% | File upload processing |
|
|
358
|
+
| `generate_data_units` | 60% | Data unit creation and finalization |
|
|
359
|
+
|
|
360
|
+
## Common Use Cases
|
|
361
|
+
|
|
362
|
+
### 1. Simple Dataset Upload
|
|
363
|
+
|
|
364
|
+
```json
|
|
365
|
+
{
|
|
366
|
+
"name": "Training Dataset",
|
|
367
|
+
"use_single_path": true,
|
|
368
|
+
"path": "/datasets/training",
|
|
369
|
+
"is_recursive": true,
|
|
370
|
+
"storage": 1,
|
|
371
|
+
"data_collection": 2
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### 2. Multi-Source Sensor Data
|
|
376
|
+
|
|
377
|
+
```json
|
|
378
|
+
{
|
|
379
|
+
"name": "Multi-Camera Dataset",
|
|
380
|
+
"use_single_path": false,
|
|
381
|
+
"assets": {
|
|
382
|
+
"front_camera": { "path": "/cameras/front", "is_recursive": true },
|
|
383
|
+
"rear_camera": { "path": "/cameras/rear", "is_recursive": true },
|
|
384
|
+
"lidar": { "path": "/sensors/lidar", "is_recursive": false }
|
|
385
|
+
},
|
|
386
|
+
"storage": 1,
|
|
387
|
+
"data_collection": 2
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### 3. Dataset with Metadata (File Path)
|
|
392
|
+
|
|
393
|
+
```json
|
|
394
|
+
{
|
|
395
|
+
"name": "Annotated Dataset",
|
|
396
|
+
"use_single_path": true,
|
|
397
|
+
"path": "/data/annotated",
|
|
398
|
+
"is_recursive": true,
|
|
399
|
+
"excel_metadata_path": "/data/metadata.xlsx",
|
|
400
|
+
"storage": 1,
|
|
401
|
+
"data_collection": 5
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### 4. Dataset with Base64 Metadata (API/Web Use Case)
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"name": "Web Upload with Metadata",
|
|
410
|
+
"use_single_path": true,
|
|
411
|
+
"path": "/data/uploads",
|
|
412
|
+
"is_recursive": true,
|
|
413
|
+
"excel_metadata": {
|
|
414
|
+
"data": "UEsDBBQABgAIAAAAIQDd4Zg...",
|
|
415
|
+
"filename": "metadata.xlsx"
|
|
416
|
+
},
|
|
417
|
+
"storage": 1,
|
|
418
|
+
"data_collection": 5
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Python Example - Convert Excel to Base64:**
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
import base64
|
|
426
|
+
|
|
427
|
+
# Read Excel file and convert to base64
|
|
428
|
+
with open('metadata.xlsx', 'rb') as f:
|
|
429
|
+
excel_data = f.read()
|
|
430
|
+
encoded = base64.b64encode(excel_data).decode('utf-8')
|
|
431
|
+
|
|
432
|
+
# Use in upload params
|
|
433
|
+
params = {
|
|
434
|
+
"name": "Web Upload",
|
|
435
|
+
"path": "/data/uploads",
|
|
436
|
+
"excel_metadata": {
|
|
437
|
+
"data": encoded,
|
|
438
|
+
"filename": "metadata.xlsx"
|
|
439
|
+
},
|
|
440
|
+
"storage": 1,
|
|
441
|
+
"data_collection": 5
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
## Benefits
|
|
446
|
+
|
|
447
|
+
### For Users
|
|
448
|
+
|
|
449
|
+
- **Flexibility**: Upload files from multiple different locations in a single operation
|
|
450
|
+
- **Granular Control**: Set recursive search per asset, not globally
|
|
451
|
+
- **Organization**: Map complex file structures to data collection specifications
|
|
452
|
+
- **Use Case Support**: Multi-sensor data collection, distributed datasets, heterogeneous sources
|
|
453
|
+
|
|
454
|
+
### For Developers
|
|
455
|
+
|
|
456
|
+
- **Backward Compatible**: Existing code continues to work without changes
|
|
457
|
+
- **Type Safe**: Full Pydantic validation with clear error messages
|
|
458
|
+
- **Maintainable**: Clean separation between single-path and multi-path logic
|
|
459
|
+
- **Extensible**: Easy to add more per-asset configuration options in the future
|
|
460
|
+
|
|
461
|
+
## Next Steps
|
|
462
|
+
|
|
463
|
+
- **For Plugin Developers**: See [BaseUploader Template Guide](./upload-plugin-template.md) for creating custom upload plugins with file processing logic
|
|
464
|
+
- **For SDK/Action Developers**: See [Upload Action Development](./upload-plugin-action.md) for architecture details, strategy patterns, and action internals
|
|
465
|
+
|
|
466
|
+
## Migration Guide
|
|
467
|
+
|
|
468
|
+
### From Legacy to Current Version
|
|
469
|
+
|
|
470
|
+
The upload action maintains 100% backward compatibility. The default behavior (`use_single_path=true`) works identically to the previous version.
|
|
471
|
+
|
|
472
|
+
#### No Migration Required
|
|
473
|
+
|
|
474
|
+
Existing configurations continue to work without changes:
|
|
475
|
+
|
|
476
|
+
```python
|
|
477
|
+
# This legacy usage still works
|
|
478
|
+
params = {
|
|
479
|
+
"name": "My Upload",
|
|
480
|
+
"path": "/data/files",
|
|
481
|
+
"storage": 1,
|
|
482
|
+
"data_collection": 5
|
|
483
|
+
}
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
#### Adopting Multi-Path Mode
|
|
487
|
+
|
|
488
|
+
To use the new multi-path functionality:
|
|
489
|
+
|
|
490
|
+
1. Set `use_single_path: false`
|
|
491
|
+
2. Remove the `path` field (it will be ignored)
|
|
492
|
+
3. Add `assets` dictionary with per-asset configurations
|
|
493
|
+
|
|
494
|
+
```python
|
|
495
|
+
# New multi-path mode
|
|
496
|
+
params = {
|
|
497
|
+
"name": "Multi-Source Upload",
|
|
498
|
+
"use_single_path": false,
|
|
499
|
+
"assets": {
|
|
500
|
+
"pcd_1": {"path": "/sensors/lidar", "is_recursive": false},
|
|
501
|
+
"image_1": {"path": "/cameras/front", "is_recursive": true}
|
|
502
|
+
},
|
|
503
|
+
"storage": 1,
|
|
504
|
+
"data_collection": 5
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
## Troubleshooting
|
|
509
|
+
|
|
510
|
+
### Common Issues
|
|
511
|
+
|
|
512
|
+
#### "No Files Found" Error
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
# Check path exists and is readable
|
|
516
|
+
ls -la /path/to/data
|
|
517
|
+
test -r /path/to/data && echo "Readable" || echo "Not readable"
|
|
518
|
+
|
|
519
|
+
# Verify files exist
|
|
520
|
+
find /path/to/data -name "*.jpg" | head -10
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
#### Excel Processing Errors
|
|
524
|
+
|
|
525
|
+
```bash
|
|
526
|
+
# Check file format and size
|
|
527
|
+
file /path/to/metadata.xlsx
|
|
528
|
+
ls -lh /path/to/metadata.xlsx
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
#### Mode Validation Errors
|
|
532
|
+
|
|
533
|
+
- **Single path mode**: Ensure `path` is provided
|
|
534
|
+
- **Multi-path mode**: Ensure `assets` is provided with at least one asset configuration
|
|
535
|
+
|
|
536
|
+
## Best Practices
|
|
537
|
+
|
|
538
|
+
### Directory Organization
|
|
539
|
+
|
|
540
|
+
- Use clear, descriptive directory names
|
|
541
|
+
- Keep reasonable directory sizes (< 10,000 files per directory)
|
|
542
|
+
- Use absolute paths for reliability
|
|
543
|
+
|
|
544
|
+
### Performance Optimization
|
|
545
|
+
|
|
546
|
+
- Enable recursive only when needed
|
|
547
|
+
- Keep Excel files under 5MB for best performance
|
|
548
|
+
- Organize files in balanced directory structures
|
|
549
|
+
|
|
550
|
+
### Security Considerations
|
|
551
|
+
|
|
552
|
+
- Validate all paths before processing
|
|
553
|
+
- Use read-only permissions for source data
|
|
554
|
+
- Set appropriate Excel size limits
|
|
555
|
+
|
|
556
|
+
## Support and Resources
|
|
557
|
+
|
|
558
|
+
- **Action Development Guide**: [Upload Plugin Action Development](./upload-plugin-action.md)
|
|
559
|
+
- **Template Development Guide**: [Upload Plugin Template Development](./upload-plugin-template.md)
|
|
560
|
+
- **API Reference**: See action development documentation for detailed API reference
|