MetadataController¶
class MetadataController(available_subclasses: Optional[Mapping[str, List[str]]] = None, **kwargs)
Bases: MetaController
Subclass of MetaController for managing metadata view-model logic.
Relays plot data, query results, and column/unit updates to the view.
Public Methods¶
- MetadataController.get_experiment_names_for_tree(experiments: list[str], loader_name: str) None¶
Provide a list of experiment names to the view for the tree display.
- MetadataController.get_experiment_structure_ready(structure: dict[str, list[int]], loader_name: str) None¶
Pass experiment-to-channel mappings to the view in display-ready format.
- MetadataController.get_session_state() Dict[str, Any]¶
Include the view’s live subset filters in this tab’s session history entry.
- Returns:
Extra state to serialize into this tab’s session history entry.
- Return type:
Dict[str, Any]
- MetadataController.on_raw_filter_validated(valid: bool, error_msg: str) None¶
Relay the result of raw filter validation to the view.
- MetadataController.relay_baseline_duration(duration: float | None) None¶
Relay the computed baseline duration to the view.
- Parameters:
duration (Optional[float]) – Duration of the baseline in appropriate units, or None if it could not be resolved.
- MetadataController.relay_column_type(column_type: str | None) None¶
Relay the data type of a specified column to the view
- Parameters:
column_type (Optional[str]) – The data type of the column, or None if the loader could not resolve one.
- MetadataController.relay_event_data_generator(generator: Generator) None¶
Relay a generator for event data overlays to the view.
- Parameters:
generator (Generator) – Generator yielding event data for overlay purposes.
- MetadataController.relay_event_plot_data_generator(generator: Generator) None¶
Relay a generator for event plotting to the view.
- Parameters:
generator (Generator) – Generator yielding event data for plotting.
- MetadataController.relay_event_query(query: str, debug: str) None¶
Relay an event-level query to the view.
- MetadataController.relay_experiment_id(exp_id: int | None) None¶
Relay a resolved experiment id to the view.
- Parameters:
exp_id (Optional[int]) – Integer experiment id.
- MetadataController.relay_plot_data(data: Any) None¶
Relay processed data to the view for plotting.
- Parameters:
data (Any) – Structured plot data.
- MetadataController.relay_query(query: str, debug: str, table_name: str, *args: str) None¶
Relay a query and optional debug message to the view, handling optional filter intents.
- MetadataController.relay_query_result(result: DataFrame | None) None¶
Relay the result of a direct DB query to the view.
- Parameters:
result (Optional[pd.DataFrame]) – DataFrame returned by query_database_directly.
- MetadataController.relay_table_by_column(table: str | None) None¶
Relay the name of the table a column lives in to the view.
- Parameters:
table (Optional[str]) – Name of the table containing the queried column, or None if the loader could not resolve one.
- MetadataController.relay_units(units: str | None) None¶
Provide a column unit label to the view.
- Parameters:
units (Optional[str]) – Unit string for the queried column, or None if the loader could not resolve one.
- MetadataController.restore_session_state(state: Dict[str, Any]) None¶
Restore subset filters captured by
get_session_state()onto the view.- Parameters:
state (Dict[str, Any]) – This tab’s session history entry, as previously written by
get_session_state().
- MetadataController.set_channel_db_id(channel_db_id: int | None) None¶
Relay the channel database ID to the view.
- Parameters:
channel_db_id (Optional[int]) – Integer database ID of the channel.
- MetadataController.set_experiment_id(experiment_id: int | None) None¶
Relay the experiment ID to the view.
- Parameters:
experiment_id (Optional[int]) – Integer ID of the experiment.
- MetadataController.set_exported_event_count(written: int) None¶
Update the view with the number of events exported.
- Parameters:
written (int) – Number of events successfully written to file.
- MetadataController.update_column_names(column_names: list[str]) None¶
Update the view with new column names.
- MetadataController.update_column_units(column_units: str | None, axis: str) None¶
Update the view with the unit label for a specific axis.
- MetadataController.update_features(vertical: list[float] | None = None, horizontal: list[float] | None = None, points: list[tuple[float, float]] | None = None, vlabels: list[str] | None = None, hlabels: list[str] | None = None, plabels: list[str] | None = None) None¶
Update the plot with visual annotations including vertical lines, horizontal lines, and point markers.
Validates that each visual feature has a corresponding label (or explicit None) if labels are provided.
- Parameters:
vertical (Optional[list[float]]) – Vertical line positions for the event being plotted.
horizontal (Optional[list[float]]) – Horizontal line positions for the event being plotted.
points (Optional[list[tuple[float, float]]]) – (x, y) point coordinates for the event being plotted.
vlabels (Optional[list[str]]) – Labels for the vertical lines.
hlabels (Optional[list[str]]) – Labels for the horizontal lines.
plabels (Optional[list[str]]) – Labels for the point markers.
- Raises:
ValueError – If a label list is provided and its length does not match the corresponding feature list.