Import Data from Multiple Sources
Import data from CSV, Excel, JSON, and other formats. Handle large datasets with streaming uploads.
Upload Data File
POST /api/{tenantId}/{projectId}/dataset/{datasetId}/import
Upload and import data from various file formats including CSV, Excel, and XES. Supports large file uploads with chunked transfer.
Parameters
| Parameter | Type | Location | Description |
|---|---|---|---|
tenantId |
GUID | Path | The tenant identifier |
projectId |
GUID | Path | The project identifier |
datasetId |
GUID | Path | The dataset identifier |
file |
File | Form Data | Data file to upload |
columnMapping |
JSON | Form Data | Column mapping configuration |
Column Mapping Configuration
{
"mapping": [
{
"sourceColumn": "Case_ID",
"targetColumn": "CaseID",
"dataType": "string"
},
{
"sourceColumn": "Event_Name",
"targetColumn": "Activity",
"dataType": "string"
},
{
"sourceColumn": "Event_Time",
"targetColumn": "Timestamp",
"dataType": "datetime",
"format": "yyyy-MM-dd HH:mm:ss"
}
],
"options": {
"hasHeader": true,
"delimiter": ",",
"encoding": "UTF-8",
"skipRows": 0
}
}
Response
{
"importId": "import-550e8400-e29b-41d4-a716-446655440000",
"datasetId": "550e8400-e29b-41d4-a716-446655440000",
"status": "Processing",
"fileName": "process_events.csv",
"fileSize": 15728640,
"rowsProcessed": 0,
"rowsTotal": 50000,
"errors": [],
"warnings": [],
"startTime": "2024-01-15T10:30:00Z"
}
Import CSV with Mapping
POST /api/{tenantId}/{projectId}/dataset/{datasetId}/import/csv
Import CSV data with advanced column mapping, data transformation, and validation options.
Request Body
{
"fileUrl": "https://your-storage.com/data/events.csv",
"mapping": [
{
"sourceColumn": "order_id",
"targetColumn": "CaseID",
"dataType": "string",
"required": true
},
{
"sourceColumn": "step_name",
"targetColumn": "Activity",
"dataType": "string",
"required": true
},
{
"sourceColumn": "timestamp",
"targetColumn": "Timestamp",
"dataType": "datetime",
"format": "ISO8601",
"required": true
},
{
"sourceColumn": "user_name",
"targetColumn": "Resource",
"dataType": "string",
"required": false
}
],
"options": {
"hasHeader": true,
"delimiter": ",",
"encoding": "UTF-8",
"skipRows": 1,
"validateData": true,
"replaceExisting": false
},
"transformations": [
{
"column": "Activity",
"type": "replace",
"find": "ORDER_",
"replace": "Order "
}
]
}
Response
Returns the same import status object as the file upload endpoint.
Get Import Status
GET /api/{tenantId}/{projectId}/dataset/{datasetId}/import/{importId}/status
Monitor the progress and status of a data import operation including validation results and error details.
Response
{
"importId": "import-550e8400-e29b-41d4-a716-446655440000",
"datasetId": "550e8400-e29b-41d4-a716-446655440000",
"status": "Completed",
"fileName": "process_events.csv",
"fileSize": 15728640,
"rowsProcessed": 49876,
"rowsTotal": 50000,
"rowsSkipped": 124,
"startTime": "2024-01-15T10:30:00Z",
"endTime": "2024-01-15T10:45:23Z",
"duration": "00:15:23",
"errors": [
{
"row": 1532,
"column": "Timestamp",
"error": "Invalid date format",
"value": "2024-13-01 25:00:00"
}
],
"warnings": [
{
"row": 2847,
"column": "Resource",
"warning": "Empty value for optional field",
"value": ""
}
],
"statistics": {
"uniqueCases": 1247,
"uniqueActivities": 12,
"dateRange": {
"earliest": "2024-01-01T08:00:00Z",
"latest": "2024-01-31T17:30:00Z"
}
}
}
Supported File Formats
mindzieStudio supports multiple data formats for seamless process mining data import:
CSV Files
Comma-separated values with flexible parsing options.
- Custom delimiters (comma, semicolon, tab)
- UTF-8, ISO-8859-1 encoding support
- Header row detection
- Quote character handling
Excel Files
Microsoft Excel workbooks (.xlsx, .xls).
- Multiple worksheet support
- Cell formatting preservation
- Date/time recognition
- Large file streaming
XES Format
IEEE XES standard for process mining.
- Full XES specification support
- Event attributes and extensions
- Lifecycle information
- Process mining tool compatibility
JSON Files
Structured JSON data for complex events.
- Nested object support
- Array handling
- Custom schema mapping
- Streaming JSON processing
JavaScript Example: File Upload with Progress
class DataImporter {
constructor(baseUrl, tenantId, projectId, token) {
this.baseUrl = baseUrl;
this.tenantId = tenantId;
this.projectId = projectId;
this.headers = {
'Authorization': `Bearer ${token}`
};
}
async uploadFile(datasetId, file, columnMapping) {
const formData = new FormData();
formData.append('file', file);
formData.append('columnMapping', JSON.stringify(columnMapping));
const url = `${this.baseUrl}/api/${this.tenantId}/${this.projectId}/dataset/${datasetId}/import`;
const response = await fetch(url, {
method: 'POST',
headers: this.headers,
body: formData
});
return await response.json();
}
async importCsv(datasetId, csvConfig) {
const url = `${this.baseUrl}/api/${this.tenantId}/${this.projectId}/dataset/${datasetId}/import/csv`;
const response = await fetch(url, {
method: 'POST',
headers: {
...this.headers,
'Content-Type': 'application/json'
},
body: JSON.stringify(csvConfig)
});
return await response.json();
}
async getImportStatus(datasetId, importId) {
const url = `${this.baseUrl}/api/${this.tenantId}/${this.projectId}/dataset/${datasetId}/import/${importId}/status`;
const response = await fetch(url, {
headers: this.headers
});
return await response.json();
}
async monitorImport(datasetId, importId, callback) {
const checkStatus = async () => {
try {
const status = await this.getImportStatus(datasetId, importId);
callback(status);
if (status.status === 'Processing') {
setTimeout(checkStatus, 2000); // Check every 2 seconds
}
} catch (error) {
callback({ error: error.message });
}
};
checkStatus();
}
buildStandardMapping() {
return {
mapping: [
{
sourceColumn: 'case_id',
targetColumn: 'CaseID',
dataType: 'string'
},
{
sourceColumn: 'activity',
targetColumn: 'Activity',
dataType: 'string'
},
{
sourceColumn: 'timestamp',
targetColumn: 'Timestamp',
dataType: 'datetime',
format: 'ISO8601'
}
],
options: {
hasHeader: true,
delimiter: ',',
encoding: 'UTF-8',
validateData: true
}
};
}
}
// Usage example
const importer = new DataImporter(
'https://your-mindzie-instance.com',
'tenant-guid',
'project-guid',
'your-token'
);
// Handle file upload with progress monitoring
document.getElementById('fileInput').addEventListener('change', async (e) => {
const file = e.target.files[0];
if (!file) return;
const mapping = importer.buildStandardMapping();
try {
const result = await importer.uploadFile('dataset-guid', file, mapping);
console.log('Upload started:', result.importId);
// Monitor progress
importer.monitorImport('dataset-guid', result.importId, (status) => {
if (status.error) {
console.error('Import failed:', status.error);
} else {
const progress = (status.rowsProcessed / status.rowsTotal) * 100;
console.log(`Progress: ${progress.toFixed(1)}% (${status.rowsProcessed}/${status.rowsTotal})`);
if (status.status === 'Completed') {
console.log('Import completed successfully!');
console.log(`Processed ${status.rowsProcessed} rows with ${status.errors.length} errors`);
}
}
});
} catch (error) {
console.error('Upload failed:', error);
}
});