eegdash.dataset.snapshot module#
Single data-access seam for the docs build.
One server chart-data call (rows + montages + metadata, all shaped
server-side) with disk-cache and package-CSV fallbacks, self-reporting
provenance via DatasetSnapshot.source.
- class eegdash.dataset.snapshot.DatasetSnapshot(*, rows: DataFrame, aggregations: dict[str, Any], montages: Mapping[str, Mapping[str, Any]], source: Literal['live', 'cached', 'package-csv'], fetched_at: datetime, api_errors: list[str] | None = None, manifest: dict[str, Any] | None = None, metadata: Mapping[str, Mapping[str, Any]] | None = None)[source]
Bases:
objectA frozen view of the dataset catalog for one docs build.
Build with
build(), read via the accessors; provenance onsource/fetched_at/api_errors.- aggregations() dict[str, Any][source]
Server-side totals; empty on a fallback (cached / package-csv) build.
- classmethod build(api_base: str = 'https://data.eegdash.org/api', database: str = 'eegdash', *, limit: int | None = None, force_refresh: bool = False) DatasetSnapshot[source]
Fetch / cache / fallback in one call, memoised per process.
Order: live
chart-data→ disk cache → package CSV (each failure recorded onapi_errors).limitdefaults toEEGDASH_DOC_LIMITor 1000;force_refreshskips both caches.
- property dataset_count: int
- metadata(dataset_id: str) Mapping[str, Any] | None[source]
Server metadata dict for one dataset (case-insensitive), or
None.Live builds only; cached / package-csv builds carry none.
- montage(dataset_id: str) Mapping[str, Any] | None[source]
Top montage dict for one dataset (case-insensitive), or
None.
- source: Literal['live', 'cached', 'package-csv'] = 'package-csv'