Skip to content

Update asset metadata for older exported NWBs at DANDI #548

@tmchartrand

Description

@tmchartrand

This is not an IPFX issue per se, but is linked to #547 and the fact that the current metadata code doesn't save cell specimen IDs to file.
Once #547 is implemented, newer files will have that embedded, but we don't plan to fix and reupload older data. For older datasets, we should make sure metadata that contains both cell specimen and ephys roi result IDs (or at least asset-level DANDI links) is available, and also ideally add the cell IDs to the asset-level data stored in the DANDI databse. The following details from Satra outline the use of the Dandi API to do so directly (without reuploading data):

from dandi.dandiapi import DandiAPIClient
from dandischema.models import BioSample, SampleType, Asset
from dandischema import validate

api = DandiAPIClient("https://api.dandiarchive.org/api")
ds = api.get_dandiset("XXXXXX")
for asset in ds.get_assets():
  meta = asset.get_metadata()
  meta.wasDerivedFrom = [BioSample(identifier="cell1", sampleType=SampleType(name="cell"), wasDerivedFrom=None)]
  meta.schemaVersion = "0.6.2". # temporary kludge
  validate(meta.json_dict(), json_validation=True) # in case you want to check before you update.
  asset.set_metadata(meta)

He also added "the meta object is a pydantic object, and hence can be used to set other aspects of metadata, such wasAttributedTo. let me know if you have any questions."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions