sda.dashboard.utils =================== .. py:module:: sda.dashboard.utils .. autoapi-nested-parse:: Dashboard Utilities. =================== Utility functions and decorators for dashboard development. Submodules ---------- .. toctree:: :maxdepth: 1 /_api/sda/dashboard/utils/decorators/index /_api/sda/dashboard/utils/figure_utils/index /_api/sda/dashboard/utils/test_info/index Classes ------- .. autoapisummary:: sda.dashboard.utils.CallbackBuilder Functions --------- .. autoapisummary:: sda.dashboard.utils.auto_callback sda.dashboard.utils.create_standard_plot_callback sda.dashboard.utils.with_error_handling sda.dashboard.utils.with_logging sda.dashboard.utils.with_performance_monitoring sda.dashboard.utils.with_state_validation sda.dashboard.utils.create_enhanced_test_info_display sda.dashboard.utils.get_test_columns_sorted sda.dashboard.utils.get_test_row_count Package Contents ---------------- .. py:class:: CallbackBuilder(app) Builder pattern for creating callbacks with consistent configuration. .. py:attribute:: app .. py:method:: add_input(component_id, property) Add input to callback. :param component_id: Component ID :type component_id: :py:class:`str` :param property: Component property :type property: :py:class:`str` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: add_state(component_id, property) Add state to callback. :param component_id: Component ID :type component_id: :py:class:`str` :param property: Component property :type property: :py:class:`str` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: add_output(component_id, property) Add output to callback. :param component_id: Component ID :type component_id: :py:class:`str` :param property: Component property :type property: :py:class:`str` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: with_error_handling(context = ErrorContext.CALLBACK, severity = ErrorSeverity.MEDIUM) Enable error handling. :param context: Error context :type context: :py:class:`ErrorContext` :param severity: Error severity :type severity: :py:class:`ErrorSeverity` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: with_logging(verbose = True) Enable logging. :param verbose: Whether to enable verbose logging :type verbose: :py:class:`bool` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: with_performance_monitoring(threshold_ms = 1000.0) Enable performance monitoring. :param threshold_ms: Performance threshold in milliseconds :type threshold_ms: :py:class:`float` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: with_state_validation(*state_keys) Enable state validation. :param \*state_keys: State keys to validate :type \*state_keys: :py:class:`str` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: prevent_initial_call(prevent = True) Set prevent initial call. :param prevent: Whether to prevent initial call :type prevent: :py:class:`bool` :returns: Builder instance for chaining :rtype: :py:class:`CallbackBuilder` .. py:method:: build(handler) Build and register the callback. :param handler: Callback handler function :type handler: :py:class:`Callable` :returns: Decorated callback function :rtype: :py:class:`Callable` .. py:function:: auto_callback(inputs, outputs, prevent_initial_call = True, **decorator_kwargs) Auto-register callback with common decorators. :param inputs: Callback inputs :type inputs: :py:class:`List[Union[Input`, :py:class:`State]]` :param outputs: Callback outputs :type outputs: :py:class:`List[Output]` :param prevent_initial_call: Whether to prevent initial call :type prevent_initial_call: :py:class:`bool` :param \*\*decorator_kwargs: Arguments for decorators .. py:function:: create_standard_plot_callback(app, plot_type, graph_id, axis_ids, handler, **kwargs) Create a standard plot callback with common configuration. :param app: Dash application :type app: :py:class:`dash.Dash` :param plot_type: Type of plot (scatter, line, etc.) :type plot_type: :py:class:`str` :param graph_id: Graph component ID :type graph_id: :py:class:`str` :param axis_ids: List of axis component IDs :type axis_ids: :py:class:`List[str]` :param handler: Plot handler function :type handler: :py:class:`Callable` :param \*\*kwargs: Additional configuration :returns: Configured callback function :rtype: :py:class:`Callable` .. py:function:: with_error_handling(context = ErrorContext.CALLBACK, severity = ErrorSeverity.MEDIUM, fallback_value = None, retry_count = 0) Add error handling to callbacks. :param context: Context where error occurred :type context: :py:class:`ErrorContext` :param severity: Default error severity :type severity: :py:class:`ErrorSeverity` :param fallback_value: Value to return on error :type fallback_value: :py:class:`Any` :param retry_count: Number of retries on failure :type retry_count: :py:class:`int` .. py:function:: with_logging(verbose = True) Add logging to callbacks. :param verbose: Whether to enable verbose logging :type verbose: :py:class:`bool` .. py:function:: with_performance_monitoring(threshold_ms = 1000.0) Monitor callback performance. :param threshold_ms: Performance threshold in milliseconds :type threshold_ms: :py:class:`float` .. py:function:: with_state_validation(*state_keys) Validate state before callback execution. :param \*state_keys: State keys to validate :type \*state_keys: :py:class:`str` .. py:function:: create_enhanced_test_info_display(test_names) Create an enhanced test information display with hyperlinks, row counts, and columns. :param test_names: Single test name or list of test names :type test_names: :py:class:`Union[str`, :py:class:`List[str]]` :returns: Enhanced test information display component :rtype: :py:class:`html.Div` .. py:function:: get_test_columns_sorted(test_name) Get the sorted list of columns for a test. :param test_name: The name of the test :type test_name: :py:class:`str` :returns: Sorted list of column names :rtype: :py:class:`List[str]` .. py:function:: get_test_row_count(test_name) Get the number of rows for a test. :param test_name: The name of the test :type test_name: :py:class:`str` :returns: Number of rows in the test data :rtype: :py:class:`int`