InteractionData

data class InteractionData(val type: String, val details: Map<String, Any>, val timestamp: Long, val userId: String)(source)

Represents a single user interaction event captured from an application.

InteractionData serves as the fundamental unit of information that flows from applications into the KARL learning system. Each instance captures a discrete user action, behavior, or context change that can be learned from to improve future predictions and recommendations.

Data structure principles:

  • Standardized format: Consistent structure across different interaction types

  • Rich context: Sufficient detail for meaningful pattern recognition

  • Privacy protection: No personally identifiable information in raw data

  • Extensible design: Details map allows for domain-specific information

  • Temporal tracking: Precise timestamps enable time-series analysis

Common interaction types and examples:

UI Interactions:

  • "button_click": User selects specific UI elements or controls

  • "menu_selection": Navigation through application menus and options

  • "form_submission": Completion of data entry or configuration forms

  • "scroll_behavior": Reading patterns and content consumption habits

Content Interactions:

  • "document_view": Access to files, articles, or media content

  • "search_query": Information seeking and discovery behaviors

  • "filter_application": Data filtering and refinement preferences

  • "content_creation": User-generated content and editing activities

Navigation Patterns:

  • "page_transition": Movement between different application sections

  • "workflow_step": Progress through multi-step processes or tasks

  • "session_start": Beginning of user interaction sessions

  • "session_end": Conclusion of user activities with outcome tracking

Context Events:

  • "error_occurrence": Error conditions and user recovery actions

  • "performance_metric": System responsiveness and user satisfaction indicators

  • "preference_change": User customization and setting modifications

  • "feature_discovery": First-time use of application features or capabilities

Details map structure and content guidelines:

Contextual information:

  • "session_id": Unique identifier for grouping related interactions

  • "screen_name": Current application screen or context

  • "feature_area": Functional domain or module where interaction occurred

  • "user_goal": Inferred or declared user objective for the interaction

Interaction specifics:

  • "element_id": Specific UI element or content identifier

  • "action_result": Success, failure, or outcome of the interaction

  • "duration": Time spent on the interaction or associated task

  • "effort_level": Complexity or difficulty of the interaction

Environmental factors:

  • "device_type": Platform or device characteristics

  • "network_status": Connectivity and performance conditions

  • "time_context": Time of day, day of week, or seasonal factors

  • "location_context": Geographic or spatial context when relevant

Performance and quality metrics:

  • "response_time": System responsiveness for the interaction

  • "accuracy": Correctness or precision of user actions

  • "completion_status": Whether the interaction achieved its intended goal

  • "user_satisfaction": Explicit or implicit satisfaction indicators

Privacy and security considerations:

  • Never include passwords, personal identifiers, or sensitive content

  • Use anonymized or hashed identifiers for external references

  • Apply data minimization principles to include only learning-relevant information

  • Implement automatic expiration for temporary or session-specific data

Data quality and validation:

  • Ensure consistent timestamp formats and timezone handling

  • Validate interaction types against known vocabularies

  • Implement schema validation for details map structure

  • Monitor data volume and implement sampling for high-frequency events

Constructors

Link copied to clipboard
constructor(type: String, details: Map<String, Any>, timestamp: Long, userId: String)

Properties

Link copied to clipboard

A flexible map containing interaction-specific information and context. Keys should be standardized within interaction types, and values should be serializable primitive types or collections. Use nested maps for complex structured data.

Link copied to clipboard

Unix timestamp in milliseconds representing when the interaction occurred. Should be as precise as possible and use UTC timezone to ensure consistent temporal analysis across different locales.

Link copied to clipboard

A standardized string identifier that categorizes the interaction. Should follow a consistent naming convention and be drawn from a well-defined vocabulary to enable effective pattern recognition. Examples: "button_click", "document_view", "search_query"

Link copied to clipboard

The unique identifier for the user who performed the interaction. Must match the userId associated with the KarlContainer to ensure proper data isolation and privacy protection.