/* * SPDX-License-Identifier: AGPL-3.0-or-later * Copyright (C) 2025 Sergej Görzen * This file is part of OmiLAXR. */ using System; using OmiLAXR.TrackingBehaviours; using OmiLAXR.Utils; namespace OmiLAXR.Composers { /// /// Core interface for all analytics statements in the OmiLAXR system. /// Represents a single learning analytics event or interaction that can be processed, /// transformed, and exported to various endpoints (xAPI, CSV, JSON, etc.). /// Statements contain contextual information about learning interactions including /// actor data, activity information, and temporal context. /// public interface IStatement { /// /// Gets the origin identifier for this statement. /// The origin typically indicates the source component, system, or context /// that generated this statement. Used for debugging, filtering, and routing. /// /// String identifier representing the statement's origin string GetOrigin(); /// /// Sets the origin identifier for this statement. /// Used to tag statements with their source for tracking and debugging purposes. /// /// String identifier representing the statement's origin void SetOrigin(string origin); /// /// Gets the unique identifier for this statement. /// Each statement should have a globally unique identifier (GUID) that /// distinguishes it from all other statements in the system. /// /// GUID uniquely identifying this statement Guid GetId(); /// /// Associates this statement with the composer that created it. /// Composers are responsible for generating statements from tracked interactions /// and events. This linkage enables type-specific processing and validation. /// /// The composer component that generated this statement void SetComposer(IComposer composer); /// /// Checks if this statement was generated by a composer of the specified type. /// Useful for filtering and processing statements based on their origin composer, /// allowing for type-specific handling in the analytics pipeline. /// /// The composer type to check against /// True if the statement was generated by a composer of type T public bool IsFromComposer() where T : IComposer; /// /// Gets the composer component that generated this statement. /// Provides access to the original composer for additional context, /// configuration, or type-specific processing needs. /// /// The composer component that created this statement IComposer GetComposer(); /// /// Associates this statement with a specific tracking behaviour component. /// Tracking behaviours monitor and respond to various types of interactions /// or events in the learning environment. This linkage provides contextual /// information about how the statement was triggered. /// /// The tracking behaviour that owns this statement void SetOwner(ITrackingBehaviour trackingBehaviour); /// /// Checks if this statement has been marked as discarded. /// Discarded statements are typically filtered out of the pipeline /// and not processed by endpoints. Used for implementing business rules, /// privacy controls, or data quality filters. /// /// True if the statement has been discarded and should be ignored bool IsDiscarded(); /// /// Marks this statement as discarded, preventing further processing. /// Discarded statements are filtered out of the pipeline and not sent /// to endpoints. Used for implementing privacy controls, data quality rules, /// or dynamic filtering based on runtime conditions. /// void Discard(); /// /// Creates a deep copy of this statement with a new unique identifier. /// Useful for creating variations of a statement for different contexts, /// parallel processing, or backup purposes while maintaining data integrity. /// /// A new statement instance with identical data but different ID IStatement Clone(); /// /// Legacy method for converting statement to string format. /// This method has been deprecated in favor of ToJsonString for better /// flexibility and standardization on JSON format for data export. /// /// String representation of the statement data [System.Obsolete("Use ToJsonString(bool pretty = false) instead.", true)] string ToDataStandardString(string version = null); /// /// Converts the statement to JSON string format for export or storage. /// JSON format provides standardized, human-readable, and machine-parseable /// representation of statement data suitable for various endpoints and systems. /// /// Whether to format JSON with indentation for readability /// Data standard version /// JSON string representation of the statement string ToJsonString(bool pretty = false, string version = null); /// /// Converts the statement to a concise string representation for logging or debugging. /// Provides essential information about the statement in a compact format /// suitable for log files, console output, or diagnostic displays. /// /// Concise string summary of the statement string ToShortString(); /// /// Converts the statement to CSV format for tabular data export. /// Enables export to spreadsheet applications, data analysis tools, /// and databases that require structured tabular data format. /// /// Whether to flatten nested objects into separate columns /// CSV format representation of the statement data CsvFormat ToCsvFormat(bool flatten = false, string version = null); /// /// Gets the timestamp when this statement was created as a formatted string. /// Provides standardized time representation for temporal analysis, /// sequencing, and chronological ordering of learning events. /// /// Formatted timestamp string representing when the statement was created string GetTimestampString(); /// /// Gets pipeline information from the component that sent this statement. /// Provides access to pipeline context including actor data providers, /// configuration settings, and other contextual information needed /// for statement processing and enrichment. /// /// Pipeline information from the sending component PipelineInfo GetSenderPipelineInfo(); } }