Spaces:
Running
Running
| """These are the base classes for the AI Dashboard application.""" | |
| from typing import Any | |
| from abc import ABC, abstractmethod | |
| class BasePlotPlugin(ABC): | |
| """Abstract base class for plot plugins in the AI Dashboard.""" | |
| name = "Unnamed Plot" | |
| def __init__(self, dataframe: Any) -> None: | |
| """Initialize with a dataframe.""" | |
| self.dataframe = dataframe | |
| def controls(self) -> Any: | |
| """Return UI controls (dropdowns).""" | |
| raise NotImplementedError | |
| def render(self, **kwargs: Any) -> Any: | |
| """Return a dcc.Graph.""" | |
| raise NotImplementedError | |
| def register_callbacks(self, app: Any) -> Any: | |
| """Register Dash callbacks for this plot.""" | |
| raise NotImplementedError | |
| def numeric_columns(self) -> Any: | |
| """Return list of numeric column names in the dataframe.""" | |
| return self.dataframe.select_dtypes(include=["number"]).columns.tolist() | |
| def categorical_columns(self) -> Any: | |
| """Return list of categorical column names in the dataframe.""" | |
| return self.dataframe.select_dtypes(exclude=["number"]).columns.tolist() | |
| class BaseTablePlugin(ABC): | |
| """Abstract base class for table plugins in the AI Dashboard.""" | |
| name = "Unnamed Table" | |
| def __init__(self, dataframe: Any) -> None: | |
| """Initialize with a dataframe.""" | |
| self.dataframe = dataframe | |
| def render(self, **kwargs: Any) -> Any: | |
| """Return a dash_table.DataTable.""" | |
| raise NotImplementedError | |
| def register_callbacks(self, app: Any) -> Any: | |
| """Register Dash callbacks for this table.""" | |
| raise NotImplementedError | |