Skip to main content

RowExplorer

Explorer
DashAI.back.exploration.explorers.RowExplorer

Display a tabular sample of dataset rows for direct data inspection.

Returns up to row_ammount rows from the dataset rendered as a table. Rows can be taken from the head or tail of the dataset, and optionally shuffled before sampling to obtain a random preview. This is typically the first exploration step after loading a dataset, allowing users to verify column types, spot obvious data quality issues, and understand the raw data format before applying transformations.

Parameters

row_ammount : integer, default=50
Maximum number of rows to take.
shuffle : boolean, default=False
Shuffle the rows when exploring.
from_top : boolean, default=True
Take rows from the head of the dataset. Otherwise, take from the tail.

Methods

get_results(self, exploration_path: str, options: Dict[str, Any]) -> Dict[str, Any]

Defined on RowExplorer

Load and return the saved row sample for the frontend.

Parameters

exploration_path : str
Path to the JSON file saved by save_notebook.
options : Dict[str, Any]
Rendering options from the frontend. Supports "orientation" (str, default "dict"), which is forwarded to pandas.DataFrame.to_dict.

Returns

Dict[str, Any]
Dictionary with keys "data" (nested dict of the sampled rows in the requested orientation), "type" ("tabular"), and "config" (dict containing {"orient": <orientation>}).

launch_exploration(self, dataset: 'DashAIDataset', explorer_info: DashAI.back.dependencies.database.models.Explorer)

Defined on RowExplorer

Return a subset of dataset rows for tabular preview.

Parameters

dataset : DashAIDataset
The dataset to sample rows from.
explorer_info : Explorer
The explorer database record (unused).

Returns

Any
A pandas.DataFrame containing at most self.row_ammount rows selected from the head or tail of the (optionally shuffled) dataset.

save_notebook(self, notebook_info: DashAI.back.dependencies.database.models.Notebook, explorer_info: DashAI.back.dependencies.database.models.Explorer, save_path: 'Path', result: Any) -> str

Defined on RowExplorer

Save the sampled rows DataFrame to a JSON file on disk.

Parameters

notebook_info : Notebook
The notebook database record (unused).
explorer_info : Explorer
The explorer record used for filename generation.
save_path : Path
Directory where the file will be saved.
result : Any
The pandas.DataFrame returned by launch_exploration.

Returns

str
The path of the saved JSON file as a POSIX string.

get_metadata(cls) -> Dict[str, Any]

Defined on BaseExplorer

Get metadata for the explorer, used by the DashAI frontend.

Returns

Dict[str, Any]
Dictionary containing display name, description, image preview path, category, icon, color, allowed dtypes, restricted dtypes, and input cardinality constraints.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

prepare_dataset(self, loaded_dataset: 'DashAIDataset', columns: List[Dict[str, Any]]) -> 'DashAIDataset'

Defined on BaseExplorer

Prepare the dataset by selecting only the columns needed for this exploration.

Parameters

loaded_dataset : DashAIDataset
The full dataset loaded from storage.
columns : List[Dict[str, Any]]
List of column descriptor dicts, each containing at least "columnName". Optional keys: "id", "valueType", "dataType".

Returns

DashAIDataset
Dataset restricted to the requested columns.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.

validate_columns(cls, explorer_info: DashAI.back.dependencies.database.models.Explorer, column_spec: Dict[str, Dict[str, str]]) -> bool

Defined on BaseExplorer

Validate that the selected columns satisfy the explorer's constraints.

Parameters

explorer_info : Explorer
The database record for the explorer instance, including the selected columns.
column_spec : Dict[str, Dict[str, str]]
A mapping from column name to a dict with at least a "type" key describing the column's data type.

Returns

bool
True if all column constraints are satisfied, False otherwise.

validate_parameters(cls, params: Dict[str, Any]) -> bool

Defined on BaseExplorer

Validate explorer parameters against the explorer's schema.

Parameters

params : Dict[str, Any]
The configuration parameters to validate.

Returns

BaseExplorerSchema
The validated and parsed schema instance. Subclasses that override this method may return a bool to indicate pass/fail without returning the model instance.