Standardized structure for detected patterns

Defines the comprehensive data structure used to represent detected patterns uniformly across the application. This interface ensures all patterns contain the necessary metadata for confidence assessment, presentation, and tracking.

Properties:

  • type: The categorized pattern type from PatternType enum
  • confidence: Normalized score (0-1) indicating pattern reliability
  • description: Human-readable explanation of the pattern
  • occurrences: Number of times this pattern has been observed
  • relatedItems: Array of related entities (artists, tracks, contexts)
  • details: Extended pattern-specific data for deeper analysis
  • firstDetected: ISO timestamp when pattern was first identified
  • lastDetected: ISO timestamp when pattern was most recently observed

This structure supports pattern persistence, trend analysis over time, and rich presentation of insights to users.

interface DetectedPattern {
    type: PatternType;
    confidence: number;
    description: string;
    occurrences: number;
    relatedItems: string[];
    details: Record<string, unknown>;
    firstDetected: string;
    lastDetected: string;
}

Properties

confidence: number
description: string
occurrences: number
relatedItems: string[]
details: Record<string, unknown>
firstDetected: string
lastDetected: string