Skip to content

Introducing Dandiset DOIs #2350

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

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

Conversation

asmacdo
Copy link
Member

@asmacdo asmacdo commented Apr 22, 2025

Example of Dandiset DOI (note -- no version) : 10.80507/dandi.000004

Remaining TODOs:

  • Update Design document for the Zenodo like DOI per dandiset #2012, which should be merged before this comes out of "draft PR"
  • Implement support in to_datacite within dandi-schema: enh: allow creation of dandiset dois (contrasted to a version doi) dandi-schema#297
  • Use DJANGO_DANDI_DOI_PUBLISH to determine whether DOIs are Findable
  • Handle Datacite validation failures (if not enough to make findable, revert to draft)
  • On update, if draft doi, "publish" to Findable
  • Reduce repetition in Datacite API usage, probably create a minimal client?
  • add tests
  • Move (and combine?) "mid level" functions from publish/ dandiset/ views/version/ unembargo/ to doi.py
  • dd Dandset DOI to vue for draft version
  • management command ot populate DOIs for existing public dandisets
  • Audit code comments-- this stuff moved around a lot, and also theres a lot of AI verbosity
  • Add hand-QA checklist to this PR
  • For handle publication does, catch datacite client exceptions since we are creating 2 dois
  • Rebase schema PR on Isaac's changes
  • Be more consistent about exception handling and logging
  • consider adding audit related records on DOI operations
  • reconsider using schema's Dandiset instead of constructing unvalidated
  • Decide how to handle "delete" there is no usage of the REST endpoint AFAICT! Admin delete uses a different endpoint

@asmacdo
Copy link
Member Author

asmacdo commented May 14, 2025

Getting closer to completion now, but there are a few things I have not yet been able to verify:

  • Deletion of dandisets: I should have superuser but I dont see anything on /admin so I cant actually delete the dandisets to verify DOI delete/hide behavior.
  • Findable/Registered DOIs: when DANDI_DOI_PUBLISH is true, we create findable DOIs which might behave differently. I'll need to patch the DOIs manually to prevent collisions in our test datacite api, and modify dandischema to allow that. A PITA, so I'm doing other stuff first.
  • Unembargo workflow: I ran into 3 issues:

self.api_url = settings.DANDI_DOI_API_URL
self.api_user = settings.DANDI_DOI_API_USER
self.api_password = settings.DANDI_DOI_API_PASSWORD
self.api_prefix = settings.DANDI_DOI_API_PREFIX
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, we would use settings.DANDI_DOI_API_PREFIX or '10.80507'

If api prefix is not set, DOI API operations should be prevented by is_configured() so I think this is appropriate

try:
doi.delete_or_hide_doi(draft_version.doi)
except Exception:
pass # doi operation should not stop deletion. delete_or_hide will log the exception.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that we should actually abort deletion of dandiset if something goes wrong with DOI deletion so we do not cause inconsistency

@asmacdo asmacdo force-pushed the enh-dandiset-dois branch 3 times, most recently from 3c25172 to a7a113c Compare May 21, 2025 21:12
- Dandiset DOI will redirect to the DLP
- Example: 10.80507/dandi.000004
- Dandiset DOI is stored in the doi field of the draft version
- Dandiset DOI metadata (on Datacite) will match the draft version until
  first publication
- Once a Dandiset is published, the Dandiset DOI metadata will match the
  latest publication

See the design document for more details: dandi#2012
@asmacdo asmacdo force-pushed the enh-dandiset-dois branch from a7a113c to 8b125d5 Compare May 21, 2025 21:20
@asmacdo asmacdo force-pushed the enh-dandiset-dois branch from 5316e66 to 73de829 Compare May 22, 2025 20:29
draft_version = dandiset.versions.filter(version='draft').first()
if draft_version and draft_version.doi is not None:
# Call DOI deletion prior to delete so if this raises, we do not proceed
doi.delete_or_hide_doi(draft_version.doi)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo should still be a celery task, but we should make sure it passes or roll back transaction

@asmacdo asmacdo force-pushed the enh-dandiset-dois branch from 138e463 to c1a0215 Compare May 22, 2025 22:47
Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just posting an exception we observerd while trying locally. Ideally should be more graceful I think

draft_version: The draft version of the dandiset.
"""
# Generate a Draft DOI (event=None)
dandiset_doi, dandiset_doi_payload = datacite_client.generate_doi_data(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ran into

[2025-06-02 19:39:54,744: ERROR/ForkPoolWorker-8] dandiapi.api.tasks.create_dandiset_draft_doi_task[202f05fc-00ae-4f02-8a16-6ff97cf39bcd]: Failed to create Draft DOI for dandiset 000001
Traceback (most recent call last):
  File "/home/yoh/proj/dandi/dandi-archive-master/dandiapi/api/tasks/__init__.py", line 124, in create_dandiset_draft_doi_task
    _create_dandiset_draft_doi(version)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/yoh/proj/dandi/dandi-archive-master/dandiapi/api/doi.py", line 52, in _create_dandiset_draft_doi
    dandiset_doi, dandiset_doi_payload = datacite_client.generate_doi_data(
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        draft_version,
        ^^^^^^^^^^^^^^
        version_doi=False,
        ^^^^^^^^^^^^^^^^^^
        event=None,  # Draft DOI
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/yoh/proj/dandi/dandi-archive-master/dandiapi/api/datacite.py", line 115, in generate_doi_data
    datacite_payload = to_datacite(metadata, event=event)
  File "/home/yoh/proj/dandi/dandischema/dandischema/datacite/__init__.py", line 248, in to_datacite
    ).pop()
      ~~~^^
IndexError: pop from empty list

@asmacdo
Copy link
Member Author

asmacdo commented Jun 3, 2025

+1 we can handle that more gracefully. This exception occurred because the Dandiset was created by the superuser without a name. So FWIW even if we relax how to_datacite sets that value it will still be an invalid DOI payload.

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

Successfully merging this pull request may close these issues.

2 participants