Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions deposit/datacite/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ function transformResourceKindToDataciteResourceType(kind: ResourceKind) {
return 'Journal';
case 'JournalArticle':
return 'JournalArticle';
case 'Preprint':
return 'Preprint';
default:
return 'Other';
}
Expand Down
2 changes: 2 additions & 0 deletions deposit/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const resourceKinds = [
'Conference',
'ConferenceProceeding',
'ConferencePaper',
'Preprint',
'Other',
] as const;

Expand All @@ -31,6 +32,7 @@ export const resourceKindToProperNoun: Record<ResourceKind, string> = {
Conference: 'Conference',
ConferenceProceeding: 'Conference Proceeding',
ConferencePaper: 'Conference Paper',
Preprint: 'Preprint',
Other: 'Other',
};

Expand Down
13 changes: 9 additions & 4 deletions deposit/transform/pub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function transformPubAttributionToResourceContribution(
function derivePubResourceKind(
pubPrimaryParentEdge?: types.PubEdge | null,
pubPrimaryCollection?: types.Collection | null,
pubCommunity?: types.Community | null,
): ResourceKind {
switch (pubPrimaryParentEdge?.relationType) {
case RelationType.Preprint:
Expand All @@ -85,7 +86,9 @@ function derivePubResourceKind(
switch (pubPrimaryCollection.kind) {
case 'issue':
case 'tag':
return 'JournalArticle';
return pubCommunity?.id === '1a71ef4d-f6fe-40d3-8379-42fa2141db58'
? 'Preprint'
: 'JournalArticle';
case 'book':
return 'BookChapter';
case 'conference':
Expand All @@ -94,7 +97,9 @@ function derivePubResourceKind(
throw new Error('Invalid primary collection kind');
}
}
return 'JournalArticle';
return pubCommunity?.id === '1a71ef4d-f6fe-40d3-8379-42fa2141db58'
? 'Preprint'
: 'JournalArticle';
}

function derivePubEdgeRelation(pubEdge: types.PubEdge): ResourceRelation {
Expand Down Expand Up @@ -153,7 +158,7 @@ export async function transformPubToPartialResource(
: null;
const pubResource: PartialResource = {
title: pub.title,
kind: derivePubResourceKind(pubPrimaryParentEdge, pubPrimaryCollection),
kind: derivePubResourceKind(pubPrimaryParentEdge, pubPrimaryCollection, pub.community),
identifiers: [
{
identifierKind: 'URL',
Expand Down Expand Up @@ -198,7 +203,7 @@ export async function transformPubToResource(
),
);
const pubResource: Resource = {
kind: derivePubResourceKind(pubPrimaryParentEdge, pubPrimaryCollection),
kind: derivePubResourceKind(pubPrimaryParentEdge, pubPrimaryCollection, pub.community),
title: pub.title,
timestamp: new Date().toUTCString(),
license: { spdxIdentifier: license.spdxIdentifier, uri: license.link },
Expand Down