-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: master
Are you sure you want to change the base?
Conversation
Getting closer to completion now, but there are a few things I have not yet been able to verify:
|
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
3c25172
to
a7a113c
Compare
- 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
a7a113c
to
8b125d5
Compare
The datacite_client_unsafe bypasses the safety check, but can still be used safely when mocking requests.
5316e66
to
73de829
Compare
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) |
There was a problem hiding this comment.
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
138e463
to
c1a0215
Compare
There was a problem hiding this 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( |
There was a problem hiding this comment.
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
+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. |
Example of Dandiset DOI (note -- no version) : 10.80507/dandi.000004
Remaining TODOs:
audit
related records on DOI operations