eegdash.dataset.registry module#

eegdash.dataset.registry.fetch_chart_data_from_api(api_url: str = 'https://data.eegdash.org/api', database: str = 'eegdash', limit: int = 1000) tuple[DataFrame, dict[str, Any]][source]

Fetch pre-aggregated chart data from API.

Deprecated since version Shim: over DatasetSnapshot; new code should use DatasetSnapshot.build(...).

Returns:

Rows and aggregations; empty 2-tuple on full failure (pre-B1 contract).

Return type:

tuple[pandas.DataFrame, dict]

eegdash.dataset.registry.fetch_datasets_from_api(api_url: str = 'https://data.eegdash.org/api', database: str = 'eegdash', force_refresh: bool = False) DataFrame[source]

Fetch dataset summaries from API and return as DataFrame.

Deprecated since version Shim: over DatasetSnapshot; new code should use DatasetSnapshot.build(...).

Returns:

Empty on full failure (pre-B1 silent-empty contract).

Return type:

pandas.DataFrame

eegdash.dataset.registry.register_openneuro_datasets(summary_file: str | Path | None = None, *, base_class=None, namespace: Dict[str, Any] | None = None, add_to_all: bool = True, from_api: bool = False, api_url: str = 'https://data.eegdash.org/api', database: str = 'eegdash') Dict[str, type][source]

Dynamically create and register dataset classes from a summary file or API.

This function reads a CSV file or queries the API containing summaries of datasets and dynamically creates a Python class for each dataset. These classes inherit from a specified base class and are pre-configured with the dataset’s ID.

Parameters:
  • summary_file (str or pathlib.Path) – The path to the CSV file containing the dataset summaries.

  • base_class (type, optional) – The base class from which the new dataset classes will inherit. If not provided, eegdash.api.EEGDashDataset is used.

  • namespace (dict, optional) – The namespace (e.g., globals()) into which the newly created classes will be injected. Defaults to the local globals() of this module.

  • add_to_all (bool, default True) – If True, the names of the newly created classes are added to the __all__ list of the target namespace, making them importable with from … import *.

Returns:

A dictionary mapping the names of the registered classes to the class types themselves.

Return type:

dict[str, type]