Symphony State#

All components have access to the same, shared state.

Name

Description

Type

filter

The active filter that is applied to the backing metadata.

WidgetWritable<string>;

filterError

The current error that the filter throws upon filtering. Empty if no error.

WidgetWritable<string>;

table

The raw backing metadata table.

Readable<ColumnTable>;

symphonySpec

The specification holding the file paths and other general information.

WidgetWritable<SymphonySpec>;

groupColumns

Columns by which the metadata is grouped.

WidgetWritable<string[]>;

groupNames

Names of all the groups. Result of a Cartesian product between all group names.

WidgetWritable<string[][]>;

groupedTables

The grouped metadata tables (filters applied).

Readable<ColumnTable[]>;

filteredTable

The filtered metadata table.

Readable<ColumnTable>;

selected

A list of all selected data samples.

WidgetWritable<string[]>;

tooltip

Specification of the position and content of the tooltip.

WidgetWritable<TooltipSpec>;

showRaw

Whether to show the unfiltered data alongside the filtered data (mostly used for charts).

WidgetWritable<boolean>;

If your component has additional requirements, the WidgetSpec needs to be changed. For that, [your_widget_name]/widget.py needs to be modified to take additional parameters, for example:

def __init__(self,
                 width: str = 'XXL',
                 height: str = 'M',
                 page: str = 'Binary Confusion Matrix',
                 label_column: str = '',
                 prediction_column: str = '',
                 **kwargs
                 ):
        """A simple binary confusion matrix extension that takes into account grouping.

        Parameters
        ----------
        width : str, optional
            By default "XXL".
        height : str, optional
            By default "M".
        page : str, optional
            Which page of the dashboard to show the widget on, by default "SymphonyBinaryConfusionMatrix".
        label_column: str, optional
            The column with the instance label. By default empty.
        prediction_column: str, optional
            The column with the model's prediction. By default empty.

        Returns
        -------
        SymphonyBinaryConfusionMatrix
        """
        super().__init__(**kwargs)
        self.width: str = width
        self.height: str = height
        self.page: str = page
        self.spec = symphony_ui.ClassificationSpec(
            width=width,
            height=height,
            page=page,
            label_column=label_column,
            prediction_column=prediction_column,
            name=self.name,
            description=self.description
        )

This component takes 2 additional parameters, namely label_column and prediction_column. To support typing for this new spec, both the main Symphony _specs.py and Symphony Lib’s types.ts need to be augmented.