Skip to content

Commit

Permalink
integrate datacite utils in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jarosenb committed Dec 19, 2024
1 parent 047c41a commit 679dadb
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from portal.apps._custom.drp import constants
from portal.libs.agave.utils import user_account, service_account
from portal.apps.publications.models import Publication, PublicationRequest
from portal.apps.projects.workspace_operations.datacite_operations import get_datacite_json, upsert_datacite_json, publish_datacite_doi
from django.db import transaction
from portal.apps.projects.workspace_operations.graph_operations import remove_trash_nodes
from portal.apps.search.tasks import index_publication
Expand Down Expand Up @@ -118,7 +119,12 @@ def publish_project(self, project_id: str, version: Optional[int] = 1):
value=nx.node_link_data(publication_tree),
)

doi = 'test_doi' # Replace with actual DOI retrieval logic
# Mint a DataCite DOI
existing_doi = source_project.value.get("doi", None)

datacite_json = get_datacite_json(publication_tree)
datacite_resp = upsert_datacite_json(datacite_json, doi=existing_doi)
doi = datacite_resp["data"]["id"]

# Update project metadata with datacite doi
source_project_id = f'{settings.PORTAL_PROJECTS_SYSTEM_PREFIX}.{project_id}'
Expand All @@ -140,6 +146,9 @@ def publish_project(self, project_id: str, version: Optional[int] = 1):
defaults={"value": published_project.value, "tree": nx.node_link_data(pub_tree), "version": version},
)

if not settings.DEBUG:
publish_datacite_doi(doi)

index_publication(project_id)

# transfer files
Expand Down

0 comments on commit 679dadb

Please sign in to comment.