scverse / scverse/spatialdata

Include name of index column for Parquet tables in `spatialdata_attrs` for shapes/points

Open
#958 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
394
Forks
95
Avg merge
4d 3h
Merged PRs (30d)
7

Description

Is your feature request related to a problem? Please describe.

When accessing the Parquet data for points and shapes on-disk (for Vitessce), it is currently unclear which column of the Parquet table to treat as the dataframe index column.

Describe the solution you'd like

Similar to how AnnData's on-disk representation for dataframes (e.g., adata.obs) specifies the name of the index column in the Zarr attributes _index field, SpatialData could do this as well, with an _index field in the spatialdata_attrs metadata.

Image

My current workaround is to look for the field index_columns of the Parquet tables' pandas metadata, but it is unclear to me if this will always work as I do not see this documented. This approach also requires loading the Parquet table schema first, whereas storing in .zattrs would allow to directly specify Parquet columns to load (without always needing to load the Parquet metadata as a first step).

Image

Describe alternatives you've considered
Continue to use the pandas metadata and document it in the Design Doc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the repository's Design Doc and locating the code that writes spatialdata_attrs for Parquet-backed shapes and points. Check how the dataframe index is currently represented, then define and validate an _index metadata field so consumers can identify the index column without first loading the Parquet schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.