ICSAC commited on
Commit
46002b0
·
1 Parent(s): b55004d

Zenodo archive copy of an ICSAC-registered work takes the type of its Crossref record: a Persistence article is a journal article in Persistence with its volume, whatever the form's resource type

Browse files
intake/scripts/test_crossref_supplement.py CHANGED
@@ -107,6 +107,34 @@ finally:
107
  else:
108
  config.CROSSREF_JOURNAL_DOI = saved
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  print()
111
  if failures:
112
  print(f"FAILED: {len(failures)}")
 
107
  else:
108
  config.CROSSREF_JOURNAL_DOI = saved
109
 
110
+ print("4. the Zenodo archive copy follows the Crossref record")
111
+ import repository_deposit as rd # noqa: E402
112
+ sub = dict(BASE, resource_type="preprint", publication_date="2026-09-29")
113
+ md = rd._build_metadata(sub, external_doi="10.67697/icsac.2026.099")
114
+ check(md.get("upload_type") == "publication" and md.get("publication_type") == "article",
115
+ "with an ICSAC DOI, a form 'preprint' becomes a journal article")
116
+ check(md.get("journal_title") == getattr(config, "CROSSREF_JOURNAL_TITLE", "Persistence")
117
+ and md.get("journal_volume") == str(getattr(config, "CROSSREF_JOURNAL_VOLUME", "1")),
118
+ "it names the journal and the volume from config")
119
+ check(md.get("doi") == "10.67697/icsac.2026.099", "the external DOI still rides on the draft")
120
+ md = rd._build_metadata(dict(sub, resource_type="dataset"), external_doi="10.67697/icsac.2026.099")
121
+ check(md.get("upload_type") == "publication" and md.get("publication_type") == "article",
122
+ "any form type is overridden once the work is an ICSAC-registered article")
123
+ md = rd._build_metadata(sub)
124
+ check(md.get("publication_type") == "preprint" and "journal_title" not in md,
125
+ "without an ICSAC DOI (Zenodo mints its own), the author's type stands")
126
+ saved_ct = getattr(config, "CROSSREF_CONTENT_TYPE", None)
127
+ try:
128
+ config.CROSSREF_CONTENT_TYPE = "report-paper"
129
+ md = rd._build_metadata(sub, external_doi="10.67697/icsac.2026.099")
130
+ check(md.get("publication_type") == "report" and "journal_title" not in md,
131
+ "a report-paper deployment archives a report, with no journal fields")
132
+ finally:
133
+ if saved_ct is None:
134
+ delattr(config, "CROSSREF_CONTENT_TYPE")
135
+ else:
136
+ config.CROSSREF_CONTENT_TYPE = saved_ct
137
+
138
  print()
139
  if failures:
140
  print(f"FAILED: {len(failures)}")
repository_deposit.py CHANGED
@@ -45,6 +45,13 @@ ZENODO_RESOURCE_TYPE = {
45
  "other": ("other", None),
46
  }
47
 
 
 
 
 
 
 
 
48
 
49
  class DepositFailed(RuntimeError):
50
  """Raised when the Zenodo deposit pipeline can't reach a published
@@ -171,6 +178,19 @@ def _build_metadata(submission: dict, *, external_doi: str | None = None,
171
  # ICSAC record before 2026-09-27 reads publisher = "Zenodo" because
172
  # this was never set.
173
  metadata["imprint_publisher"] = publisher
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  if publication_type:
175
  metadata["publication_type"] = publication_type
176
  if keywords:
 
45
  "other": ("other", None),
46
  }
47
 
48
+ # Crossref content type of the ICSAC record -> Zenodo publication_type of its archival copy.
49
+ CROSSREF_TO_ZENODO_TYPE = {
50
+ "journal-article": "article",
51
+ "report-paper": "report",
52
+ "posted_content": "preprint",
53
+ }
54
+
55
 
56
  class DepositFailed(RuntimeError):
57
  """Raised when the Zenodo deposit pipeline can't reach a published
 
178
  # ICSAC record before 2026-09-27 reads publisher = "Zenodo" because
179
  # this was never set.
180
  metadata["imprint_publisher"] = publisher
181
+ if external_doi:
182
+ # The archival copy of an ICSAC-registered work takes the type of its
183
+ # Crossref record, not the form's resource type (whose default is
184
+ # "preprint"): a Persistence article is a journal article in Persistence,
185
+ # volume N, on Zenodo too (2026-09-29).
186
+ ct = getattr(config, "CROSSREF_CONTENT_TYPE", "journal-article")
187
+ metadata["upload_type"] = "publication"
188
+ publication_type = CROSSREF_TO_ZENODO_TYPE.get(ct, "article")
189
+ if ct == "journal-article":
190
+ metadata["journal_title"] = getattr(config, "CROSSREF_JOURNAL_TITLE", "Persistence")
191
+ volume = str(getattr(config, "CROSSREF_JOURNAL_VOLUME", "") or "").strip()
192
+ if volume:
193
+ metadata["journal_volume"] = volume
194
  if publication_type:
195
  metadata["publication_type"] = publication_type
196
  if keywords: