Updates

Update and Version Datasets

Update existing datasets, manage versions, and handle incremental data updates.

Update Dataset Metadata

PUT /api/{tenantId}/{projectId}/dataset/{datasetId}

Updates dataset name, description, and metadata without affecting the underlying data structure or content.

Request Body

{
  "datasetName": "Updated Purchase Order Process",
  "description": "Enhanced event log with additional attributes",
  "metadata": {
    "source": "SAP ERP System v2.0",
    "extractionDate": "2024-01-20T10:30:00Z",
    "dataOwner": "Process Analytics Team",
    "tags": ["procurement", "p2p", "updated"]
  }
}

Response

{
  "datasetId": "550e8400-e29b-41d4-a716-446655440000",
  "datasetName": "Updated Purchase Order Process",
  "description": "Enhanced event log with additional attributes",
  "datasetType": "EventLog",
  "status": "Active",
  "rowCount": 49876,
  "caseCount": 1247,
  "activityCount": 12,
  "dateCreated": "2024-01-15T10:30:00Z",
  "dateModified": "2024-01-20T10:30:00Z",
  "modifiedBy": "user456"
}

Append New Data

POST /api/{tenantId}/{projectId}/dataset/{datasetId}/append

Adds new rows to an existing dataset without replacing existing data. Ideal for continuous data feeds and regular updates.

Request Body

{
  "data": [
    {
      "CaseID": "PO-2024-001250",
      "Activity": "Create Purchase Order",
      "Timestamp": "2024-01-20T09:15:00Z",
      "Resource": "buyer.smith",
      "Amount": 15750.00
    },
    {
      "CaseID": "PO-2024-001250",
      "Activity": "Approve Purchase Order",
      "Timestamp": "2024-01-20T10:30:00Z",
      "Resource": "manager.jones",
      "Amount": 15750.00
    }
  ],
  "options": {
    "validateData": true,
    "allowDuplicates": false,
    "createSnapshot": true
  }
}

Response

{
  "updateId": "update-550e8400-e29b-41d4-a716-446655440000",
  "datasetId": "550e8400-e29b-41d4-a716-446655440000",
  "status": "Processing",
  "rowsAdded": 0,
  "rowsTotal": 2,
  "startTime": "2024-01-20T10:30:00Z",
  "snapshotId": "snapshot-660e8400-e29b-41d4-a716-446655440000"
}

Replace Dataset Data

PUT /api/{tenantId}/{projectId}/dataset/{datasetId}/data

Completely replaces all data in the dataset while preserving the structure and metadata. Creates a backup snapshot before replacement.

Request Body

{
  "replaceWith": {
    "source": "file",
    "fileUrl": "https://your-storage.com/updated-data.csv",
    "columnMapping": {
      "CaseID": "order_id",
      "Activity": "event_name",
      "Timestamp": "event_time"
    }
  },
  "options": {
    "createBackup": true,
    "validateStructure": true,
    "preserveMetadata": true
  }
}

Response

Returns an update operation status similar to the append endpoint.

Create Dataset Version

POST /api/{tenantId}/{projectId}/dataset/{datasetId}/version

Creates a new version of the dataset, preserving the current state as a snapshot for rollback purposes.

Request Body

{
  "versionName": "v2.1-january-update",
  "description": "Added Q1 2024 data with enhanced attributes",
  "major": false,
  "tags": ["quarterly-update", "enhanced-data"]
}

Response

{
  "versionId": "version-770e8400-e29b-41d4-a716-446655440000",
  "datasetId": "550e8400-e29b-41d4-a716-446655440000",
  "versionNumber": "2.1",
  "versionName": "v2.1-january-update",
  "description": "Added Q1 2024 data with enhanced attributes",
  "snapshotId": "snapshot-880e8400-e29b-41d4-a716-446655440000",
  "rowCount": 52143,
  "caseCount": 1289,
  "dateCreated": "2024-01-20T10:30:00Z",
  "createdBy": "user123"
}

Get Update Status

GET /api/{tenantId}/{projectId}/dataset/{datasetId}/update/{updateId}/status

Monitor the progress of dataset update operations including data validation and processing statistics.

Response

{
  "updateId": "update-550e8400-e29b-41d4-a716-446655440000",
  "datasetId": "550e8400-e29b-41d4-a716-446655440000",
  "operation": "append",
  "status": "Completed",
  "rowsAdded": 2267,
  "rowsTotal": 2267,
  "rowsSkipped": 0,
  "startTime": "2024-01-20T10:30:00Z",
  "endTime": "2024-01-20T10:35:47Z",
  "duration": "00:05:47",
  "errors": [],
  "warnings": [
    {
      "row": 156,
      "message": "Future timestamp detected",
      "value": "2024-02-01T08:00:00Z"
    }
  ],
  "newStatistics": {
    "totalRows": 52143,
    "totalCases": 1289,
    "uniqueActivities": 14,
    "dateRange": {
      "earliest": "2024-01-01T08:00:00Z",
      "latest": "2024-01-20T17:30:00Z"
    }
  }
}

Version Management

Comprehensive dataset versioning for change tracking and rollback capabilities:

Version History

Track all changes with detailed version metadata.

  • Automatic version numbering
  • Change descriptions and tags
  • User attribution

Snapshots

Point-in-time dataset snapshots for rollback.

  • Automatic snapshot creation
  • Manual snapshot triggers
  • Storage optimization

Rollback Operations

Restore previous dataset versions safely.

  • Version comparison
  • Impact analysis
  • Safe rollback procedures

Update Strategies

Flexible data update approaches.

  • Incremental appends
  • Full replacements
  • Merge operations

JavaScript Example: Dataset Updates

class DatasetUpdater {
  constructor(baseUrl, tenantId, projectId, token) {
    this.baseUrl = baseUrl;
    this.tenantId = tenantId;
    this.projectId = projectId;
    this.headers = {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    };
  }

  async updateMetadata(datasetId, metadata) {
    const url = `${this.baseUrl}/api/${this.tenantId}/${this.projectId}/dataset/${datasetId}`;

    const response = await fetch(url, {
      method: 'PUT',
      headers: this.headers,
      body: JSON.stringify(metadata)
    });

    return await response.json();
  }

  async appendData(datasetId, newData, options = {}) {
    const url = `${this.baseUrl}/api/${this.tenantId}/${this.projectId}/dataset/${datasetId}/append`;

    const payload = {
      data: newData,
      options: {
        validateData: true,
        allowDuplicates: false,
        createSnapshot: true,
        ...options
      }
    };

    const response = await fetch(url, {
      method: 'POST',
      headers: this.headers,
      body: JSON.stringify(payload)
    });

    return await response.json();
  }

  async createVersion(datasetId, versionInfo) {
    const url = `${this.baseUrl}/api/${this.tenantId}/${this.projectId}/dataset/${datasetId}/version`;

    const response = await fetch(url, {
      method: 'POST',
      headers: this.headers,
      body: JSON.stringify(versionInfo)
    });

    return await response.json();
  }

  async getUpdateStatus(datasetId, updateId) {
    const url = `${this.baseUrl}/api/${this.tenantId}/${this.projectId}/dataset/${datasetId}/update/${updateId}/status`;

    const response = await fetch(url, {
      headers: this.headers
    });

    return await response.json();
  }

  async monitorUpdate(datasetId, updateId, callback) {
    const checkStatus = async () => {
      try {
        const status = await this.getUpdateStatus(datasetId, updateId);
        callback(status);

        if (status.status === 'Processing') {
          setTimeout(checkStatus, 3000);
        }
      } catch (error) {
        callback({ error: error.message });
      }
    };

    checkStatus();
  }
}

// Usage example
const updater = new DatasetUpdater(
  'https://your-mindzie-instance.com',
  'tenant-guid',
  'project-guid',
  'your-token'
);

// Update dataset metadata
const newMetadata = {
  datasetName: 'Q1 2024 Order Processing',
  description: 'Updated with latest quarter data',
  metadata: {
    source: 'ERP System v3.1',
    quarter: 'Q1-2024',
    extractionDate: new Date().toISOString()
  }
};

updater.updateMetadata('dataset-guid', newMetadata)
  .then(result => {
    console.log('Metadata updated:', result.datasetName);
  });

// Append new data
const newEvents = [
  {
    CaseID: 'ORD-2024-001',
    Activity: 'Order Received',
    Timestamp: '2024-01-20T09:00:00Z',
    Resource: 'system.auto'
  }
];

updater.appendData('dataset-guid', newEvents)
  .then(result => {
    console.log('Append started:', result.updateId);

    // Monitor progress
    updater.monitorUpdate('dataset-guid', result.updateId, (status) => {
      console.log(`Status: ${status.status}`);
      if (status.status === 'Completed') {
        console.log(`Added ${status.rowsAdded} rows`);
      }
    });
  });
An error has occurred. This application may no longer respond until reloaded. Reload ??