Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update asset metadata for older exported NWBs at DANDI #548

Open
tmchartrand opened this issue Oct 27, 2022 · 0 comments
Open

Update asset metadata for older exported NWBs at DANDI #548

tmchartrand opened this issue Oct 27, 2022 · 0 comments

Comments

@tmchartrand
Copy link
Collaborator

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."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant