export declare enum DataItemType {
number = "number",
text = "text",
boolean = "boolean",
select = "select",
radio = "radio",
date = "date",
datetime = "datetime",
file = "file",
image = "image",
video = "video",
audio = "audio",
signature = "signature"
}
export declare enum DataItemStatType {
sum = "sum",
mean = "mean",
stddev = "stddev",
variance = "variance",
min = "min",
max = "max",
range = "range",
median = "median",
mode = "mode"
}
export declare class DataItem {
name: string;
description?: string;
tag?: string;
group?: string;
subgroup?: string;
active?: boolean;
hidden?: boolean;
type?: DataItemType;
options?: {
[option: string]: any;
};
stat?: DataItemStatType;
agg?: DataItemStatType;
unit?: string;
quota?: number;
spec?: {
[key: string]: any;
};
}
export declare class DataItemPatch {
name?: string;
description?: string;
tag?: string;
group?: string;
subgroup?: string;
type?: DataItemType;
options?: {
[option: string]: any;
};
stat?: DataItemStatType;
agg?: DataItemStatType;
unit?: string;
quota?: number;
active?: boolean;
hidden?: boolean;
spec?: {
[key: string]: any;
};
}
/**
* ============================================================================
* Media Type Options Schema
* ============================================================================
*
* The `options` field provides type-specific configuration for media types
* (image, video, audio). Below are the recommended schemas for each type.
*
* ============================================================================
* IMAGE Type Options
* ============================================================================
*
* Example:
* {
* type: 'image',
* options: {
* // File formats
* accept: ['jpeg', 'png', 'webp', 'gif'], // Allowed formats
*
* // Size constraints
* maxSize: 10485760, // Max file size in bytes (10MB)
* maxWidth: 4096, // Max width in pixels
* maxHeight: 4096, // Max height in pixels
* minWidth: 224, // Min width in pixels
* minHeight: 224, // Min height in pixels
*
* // Multiple uploads
* multiple: true, // Allow multiple images
* maxFiles: 10, // Max number of files
*
* // Thumbnail generation
* thumbnail: {
* enabled: true,
* width: 200,
* height: 200,
* format: 'jpeg', // 'jpeg' | 'png' | 'webp'
* quality: 85 // 1-100
* },
*
* // Preview settings
* preview: {
* enabled: true,
* maxWidth: 1024,
* maxHeight: 1024
* },
*
* // Metadata extraction
* metadata: {
* extractExif: true, // Extract EXIF data
* extractDimensions: true, // Extract width/height
* extractFormat: true, // Extract image format
* extractColorProfile: true // Extract color profile
* },
*
* // Compression/conversion
* compression: {
* enabled: true,
* format: 'webp', // Target format
* quality: 85, // Compression quality
* maxDimension: 2048 // Max width or height
* }
* }
* }
*
* ============================================================================
* VIDEO Type Options
* ============================================================================
*
* Example:
* {
* type: 'video',
* options: {
* // File formats
* accept: ['mp4', 'webm', 'mov', 'avi'], // Allowed formats
*
* // Size constraints
* maxSize: 104857600, // Max file size in bytes (100MB)
* maxDuration: 300, // Max duration in seconds (5 minutes)
* maxWidth: 1920, // Max resolution width
* maxHeight: 1080, // Max resolution height
*
* // Multiple uploads
* multiple: false, // Usually single video per field
* maxFiles: 1,
*
* // Thumbnail generation
* thumbnail: {
* enabled: true,
* width: 320,
* height: 180,
* format: 'jpeg',
* quality: 85,
* captureTime: 1 // Capture thumbnail at N seconds
* },
*
* // Preview settings
* preview: {
* enabled: true,
* maxWidth: 640,
* maxHeight: 480,
* controls: true, // Show video controls
* autoplay: false, // Autoplay preview
* muted: true // Mute by default
* },
*
* // Metadata extraction
* metadata: {
* extractDuration: true, // Extract video duration
* extractResolution: true, // Extract width/height
* extractFormat: true, // Extract video format
* extractCodec: true, // Extract video/audio codec
* extractFrameRate: true, // Extract FPS
* extractBitrate: true // Extract bitrate
* },
*
* // Transcoding
* transcoding: {
* enabled: true,
* format: 'mp4', // Target format
* codec: 'h264', // Video codec
* quality: 'medium', // 'low' | 'medium' | 'high'
* maxDimension: 1280 // Scale down if larger
* }
* }
* }
*
* ============================================================================
* AUDIO Type Options
* ============================================================================
*
* Example:
* {
* type: 'audio',
* options: {
* // File formats
* accept: ['mp3', 'wav', 'ogg', 'm4a', 'aac'], // Allowed formats
*
* // Size constraints
* maxSize: 52428800, // Max file size in bytes (50MB)
* maxDuration: 600, // Max duration in seconds (10 minutes)
*
* // Multiple uploads
* multiple: false,
* maxFiles: 1,
*
* // Waveform visualization
* waveform: {
* enabled: true,
* width: 800,
* height: 100,
* color: '#3498db'
* },
*
* // Preview settings
* preview: {
* enabled: true,
* controls: true, // Show audio controls
* autoplay: false, // Autoplay preview
* visualizer: true // Show audio visualizer
* },
*
* // Metadata extraction
* metadata: {
* extractDuration: true, // Extract audio duration
* extractFormat: true, // Extract audio format
* extractCodec: true, // Extract audio codec
* extractBitrate: true, // Extract bitrate
* extractSampleRate: true, // Extract sample rate
* extractChannels: true, // Extract channel count
* extractID3Tags: true // Extract ID3 tags (artist, title, etc.)
* },
*
* // Transcoding
* transcoding: {
* enabled: true,
* format: 'mp3', // Target format
* codec: 'mp3', // Audio codec
* bitrate: 128, // kbps
* sampleRate: 44100, // Hz
* channels: 2 // Stereo
* }
* }
* }
*
* ============================================================================
* Usage in GraphQL
* ============================================================================
*
* mutation {
* updateDataSet(
* name: "product_inspection"
* patch: {
* dataItems: [
* {
* name: "product_image"
* type: image
* options: {
* accept: ["jpeg", "png"]
* maxSize: 10485760
* thumbnail: { enabled: true, width: 200, height: 200 }
* metadata: { extractExif: true, extractDimensions: true }
* }
* },
* {
* name: "inspection_video"
* type: video
* options: {
* accept: ["mp4", "webm"]
* maxSize: 104857600
* maxDuration: 120
* thumbnail: { enabled: true, captureTime: 1 }
* }
* },
* {
* name: "operator_note_audio"
* type: audio
* options: {
* accept: ["mp3", "wav"]
* maxSize: 10485760
* maxDuration: 60
* waveform: { enabled: true }
* }
* }
* ]
* }
* ) {
* id
* name
* }
* }
*
* ============================================================================
* Label Studio Integration
* ============================================================================
*
* Dataset media types map to Label Studio annotation types:
*
* - image →
* - video →
* - audio →
*
* Example Label Studio config generation:
*
* const dataItem = { name: 'product_image', type: 'image' }
*
* // → Label Studio config
*
*
*
*
*
*
*
*
* ============================================================================
*/