crantpy.utils.seatable module#

This module contains functions to interact with the Seatable API for CRANTpy. It provides functionality to fetch annotations, handle pagination, and manage caching of results. It also includes a function to create SQL queries for Seatable.

crantpy.utils.seatable.get_all_seatable_annotations(dataset=None, proofread_only=False, clear_cache=False, check_stale=True)[source]#

Uses Seatable API to get the table object for the CRANTb project. Handles pagination to retrieve all rows even if exceeding the API limit. Caches the result to avoid redundant API calls.

Parameters:
  • proofread_only (bool, default False) – If True, only retrieve annotations marked as proofread.

  • clear_cache (bool, default False) – If True, bypass the cache and fetch fresh data from Seatable.

  • check_stale (bool, default True) – If True, check if the cache is stale before using it based on the maximum cache duration.

  • dataset (str, optional) – The dataset to use. If not provided, uses the default dataset from the environment variable.

Returns:

DataFrame containing the annotations.

Return type:

pd.DataFrame

crantpy.utils.seatable.get_proofread_neurons(dataset=None, clear_cache=False)[source]#

Get the root IDs of neurons that are proofread.

Parameters:
  • dataset (str, optional) – Dataset to fetch annotations from.

  • clear_cache (bool, default False) – Whether to force reloading annotations from Seatable, bypassing the cache.

Returns:

Array of root IDs of proofread neurons.

Return type:

numpy.ndarray

crantpy.utils.seatable.get_seatable_base_object()[source]#

Uses Seatable API to get the base object for the CRANTpy project.

Returns:

The authenticated Seatable Base object.

Return type:

seatable_api.Base

crantpy.utils.seatable.get_seatable_cache_name(*args, **kwargs)[source]#

Returns the name of the Seatable cache based on the dataset and proofread_only status.

Return type:

str