diff --git a/src/types/span-annotations.ts b/src/types/span-annotations.ts new file mode 100644 index 0000000..260dc8b --- /dev/null +++ b/src/types/span-annotations.ts @@ -0,0 +1,50 @@ +/** + * Span annotation types for chart pattern labeling + */ + +/** + * A sub-span represents a nested time range within a parent span annotation, + * used to mark sub-structures or phases within a larger pattern. + */ +export interface SubSpan { + start_time: number; + end_time: number; + label: string; + color?: string; + notes?: string | null; +} + +/** + * A span annotation marks a time range on a chart with a pattern label + * and optional metadata such as confidence, outcome, and notes. + */ +export interface SpanAnnotation { + id: number; + chart_id: number; + start_time: number; + end_time: number; + label: string; + confidence: number | null; + outcome: string | null; + notes: string | null; + sub_spans: SubSpan[] | null; + color: string; + source?: string; + model_prediction?: Record | null; + created_at: number; +} + +/** + * A span label type defines a named pattern category that can be applied + * to span annotations, with display metadata and optional keyboard shortcut. + */ +export interface SpanLabelType { + id: number; + name: string; + display_name: string; + color: string; + hotkey: string | null; + is_active: boolean; + sort_order: number; + created_at: number; +}