/** * Task Transformer * * Flexible data transformation from any source format to Label Studio tasks. * Supports nested data, predictions, and custom field mapping. */ export interface TaskTransformRule { /** * Field mapping: Label Studio field name -> source data path * Example: { "image": "image_url", "date": "metadata.timestamp" } */ dataFields: { [lsField: string]: string; }; /** * Prediction configuration (optional) */ predictions?: PredictionConfig; /** * Metadata to attach to task (optional) */ meta?: { [key: string]: string; }; } export interface PredictionConfig { /** * Enable predictions */ enabled: boolean; /** * Path to prediction result in source data */ resultPath: string; /** * Path to confidence score (optional) */ scorePath?: string; /** * Model version identifier (optional) */ modelVersion?: string; /** * Transform function for prediction result */ resultTransform?: (result: any) => any; } export interface LabelStudioTask { data: string; predictions?: Array<{ result: any; score?: number; model_version?: string; }>; meta?: any; } export declare class TaskTransformer { /** * Transform source data to Label Studio tasks * * @param sourceData - Array of source data objects * @param rule - Transformation rules * @returns Array of Label Studio tasks */ static transform(sourceData: any[], rule: TaskTransformRule): LabelStudioTask[]; /** * Transform a single data object */ static transformOne(sourceData: any, rule: TaskTransformRule): LabelStudioTask | null; /** * Build prediction object from source data */ private static buildPrediction; /** * Get nested value from object using dot notation path * Example: "metadata.user.name" -> obj.metadata.user.name */ private static getNestedValue; /** * Transform with multiple rules (useful for heterogeneous data) */ static transformMultiRule(sourceData: any[], rules: TaskTransformRule[]): LabelStudioTask[]; } /** * Pre-built transformation templates for common scenarios */ export declare class TaskTransformTemplates { /** * WBM Image Classification with AI predictions */ static wbmImageClassification(includeAiPrediction?: boolean): TaskTransformRule; /** * Simple image classification */ static imageClassification(imageField?: string): TaskTransformRule; /** * Text classification with metadata */ static textClassification(textField?: string, metaFields?: string[]): TaskTransformRule; /** * Time series data */ static timeSeries(valuesField: string, timestampField?: string): TaskTransformRule; /** * Object detection with bounding box predictions */ static objectDetection(imageField?: string, predictionsField?: string): TaskTransformRule; }