Skip to main content

radiens-drive-catalog

A Python package for programmatically managing large neural datasets stored on Google Drive. It handles Drive scanning, local cataloging, and selective dataset download. Analysis is done locally — this package is purely about data management.

Documentation: https://neuronexus.github.io/radiens-drive-catalog/latest/

Overview

Neural data is stored as xdat filesets (NeuroNexus format) on a shared Google Drive. Each dataset consists of 3 files sharing a common base_name:

{base_name}_data.xdat
{base_name}.xdat.json
{base_name}_timestamp.xdat

radiens-drive-catalog scans the Drive hierarchy, builds a local catalog indexed by base_name, and lets you query and download datasets selectively. Non-xdat content found alongside recordings — logs directories, PowerPoints, writeups — is also discovered and tracked as Drive items.

Usage

Recordings

from radiens_drive_catalog import Catalog, Config

config = Config.from_file("config.json")
catalog = Catalog(config)

# Scan Drive and build the catalog (discovers recordings and Drive items)
result = catalog.scan()      # returns ScanResult with new/existing/removed counts
result = catalog.scan(flat=False)  # recursive traversal instead of flat file scan

# Query recordings using pandas directly
catalog.recordings_df
catalog.list_recordings()                                                                    # everything
catalog.list_recordings(drive_path="2026-02-15_batch/reaching")                             # exact folder
catalog.list_recordings(drive_path="2026-02-15_batch", drive_path_mode="prefix")            # full date subtree
catalog.list_recordings(drive_path="reaching", drive_path_mode="contains")                   # any depth
catalog.list_recordings(base_name="rat01_session3")                                          # exact base_name
catalog.list_recordings(base_name="rat01", base_name_mode="prefix")                           # base_name prefix
catalog.list_recordings(base_name="session3", base_name_mode="contains")                     # base_name substring

# Filters are ANDed together, e.g. all "rat01" recordings under "2026-02-15_batch"
catalog.list_recordings(drive_path="2026-02-15_batch", drive_path_mode="prefix", base_name="rat01", base_name_mode="prefix")

# Look up a recording by base_name (raises AmbiguousRecordingError if not globally
# unique — pass drive_path to disambiguate)
entry = catalog.get_recording("rat01_session3")
entry = catalog.get_recording("rat01_session3", drive_path="2026-02-15_batch/reaching")

# Download a recording (3 xdat files)
catalog.download_recording("2026-02-15_batch/reaching", "rat01_session3")

# Get the local path, downloading automatically if needed
path = catalog.get_recording_path("2026-02-15_batch/reaching", "rat01_session3")

Drive items (non-xdat content)

Non-xdat files and folders (e.g. logs/, PowerPoints, writeups) are automatically cataloged as Drive items during scan().

# Query items using pandas directly
catalog.items_df
catalog.items_df[catalog.items_df["drive_path"].str.startswith("2026-02-15_batch")]
catalog.items_df[catalog.items_df["is_folder"] == True]

# Download an item (drive_path is the slash-joined path to the item's parent folder)
catalog.download_item("2026-02-15_batch/reaching", "logs")

# Get the local path, downloading automatically if needed
path = catalog.get_item_path("2026-02-15_batch/reaching", "logs")

# Render an annotated tree of the full Drive hierarchy
print(catalog.file_tree())

# Print a headline summary report: counts, download progress, date
# range, and Drive/local storage totals
print(catalog.summary())

# verbose=True adds an item-type breakdown, largest entries, itemized
# incomplete recordings, a per-folder breakdown, and a full per-entry listing
print(catalog.summary(verbose=True))

Items land under local_data_dir/{drive_path}/{name}, using the same Drive-mirroring convention as recordings.

Configuration

Create a config.json (outside your repo — do not commit it):

{
    "credentials_path": "/path/to/service_account.json",
    "root_folder_id": "your-drive-folder-id",
    "local_data_dir": "/path/to/local/data",
    "catalog_path": "/path/to/local/data/catalog.json"
}

Config.from_file() locates the config file using this resolution order:

  1. Explicit path argument.
  2. RADIENS_DRIVE_CATALOG_CONFIG environment variable.
  3. .secrets/config.json, then config.json, searched starting in the current working directory and then each parent directory up to the filesystem root (closest directory wins) — the same convention git uses to locate .git, so this works the same whether you run from the repo root or a nested subdirectory (e.g. a notebook in notebooks/).
  4. ~/.config/radiens-drive/config.json.
  5. /etc/radiens-drive/config.json.
# Automatic discovery (env var or well-known paths)
config = Config.from_file()

# Explicit path
config = Config.from_file("/path/to/config.json")

The root_folder_id is the alphanumeric string in the Drive URL when you're inside the root data folder.

Authentication

This package uses a Google service account for shared access among collaborators. To set it up:

  1. Create a project in Google Cloud Console
  2. Enable the Google Drive API
  3. Create a service account and download its JSON credentials file
  4. Share your root Drive data folder with the service account's email address (Viewer access is sufficient)
  5. Point credentials_path in your config at the downloaded JSON file

Distribute the credentials file to collaborators securely — treat it like a password.

Installation

This project uses uv for dependency management. If you don't have it:

macOS / Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows:

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Then install the project:

uv sync

Development

uv run pytest          # run tests
uv run mypy            # type checking
uv run ruff check .    # linting
uv run ruff format .   # formatting

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

radiens_drive_catalog-0.0.16.tar.gz (154.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

radiens_drive_catalog-0.0.16-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file radiens_drive_catalog-0.0.16.tar.gz.

File metadata

  • Download URL: radiens_drive_catalog-0.0.16.tar.gz
  • Upload date:
  • Size: 154.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for radiens_drive_catalog-0.0.16.tar.gz
Algorithm Hash digest
SHA256 60b348a912856e14738da0bf03fb80bff7ac7d78bffe524a5c116b47162082d5
MD5 a21a54359579aa51071f08dbd6760151
BLAKE2b-256 c6dfdd9e725cd27c4da77eb87a865f1e8aea8eb3f87aa3c63beb594f38e3c094

See more details on using hashes here.

Provenance

The following attestation bundles were made for radiens_drive_catalog-0.0.16.tar.gz:

Publisher: publish.yml on NeuroNexus/radiens-drive-catalog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file radiens_drive_catalog-0.0.16-py3-none-any.whl.

File metadata

File hashes

Hashes for radiens_drive_catalog-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 830002076d31f78e603424825cab3ae6541ad16d855df7a35a4ab039ba60bd8c
MD5 c0d10de97abe29dec59fabc1d71c6c8a
BLAKE2b-256 5bdd3c97454484123393bd1bf6cfba59b3ffab67a5a047a8a80ac14c51e32348

See more details on using hashes here.

Provenance

The following attestation bundles were made for radiens_drive_catalog-0.0.16-py3-none-any.whl:

Publisher: publish.yml on NeuroNexus/radiens-drive-catalog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.18

2 files

0.0.17

2 files

This release

0.0.16 This release

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page