api request: asset blob id to asset/dandiset/version

未关闭
#1,671 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
api

调研方向

首先跟踪 DandiAPIClient 如何公开 get_dandisets()、get_versions() 和 get_assets(),以及 API 请求的定义位置。将提议的 assets/blob/{blob_id}/ endpoint 与现有的 asset 元数据流程进行比较。当 blob ID 能够返回其 asset 元数据,以及包含它的每个 dandiset 和版本,且无需扫描所有 dandiset 时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

I need to build a map from asset blob id to dandiset(s). Currently, I am doing this by:

client = DandiAPIClient()

with shelve.open("asset_blob_to_dandiset") as db:
    for dandiset in tqdm(list(client.get_dandisets()), position=1):
        for version in tqdm(list(dandiset.get_versions()), position=2, leave=False):
            dandiset = client.get_dandiset(dandiset_id=dandiset.identifier, version_id=version.identifier)
            for asset in tqdm(list(dandiset.get_assets()), position=3, leave=False):
                blob_id = asset.zarr if ".zarr" in pathlib.Path(asset.path).suffixes else asset.blob
                db[blob_id] = dandiset.identifier

This works, but feels terrible inefficient because I really only need the map for a subset of assets, but since I don't know which dandisets they belong to I am forced to iterate over all of them in order to create a reverse map. It would be great if I could have an endpoint like assets/blob/{blob_id}/ which would return asset metadata. Ideally, this would include the ids of each dandiset that contains this asset and versions within each of those dandisets that contain this asset.

主要语言
Python
星标
28
派生
37
平均合并
2 天 12 小时
30 天内合并 PR
9

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dandi/dandi-cli 的其他 Issue

查看 dandi/dandi-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。