From ab63f21ae9de71a7d993226a870edb7ce3ae603e Mon Sep 17 00:00:00 2001 From: Peter Mangiafico Date: Wed, 15 Nov 2023 12:31:11 -0800 Subject: [PATCH 1/2] deal with another alternate orcid format for contributors --- app/services/orcid_builder.rb | 3 +++ spec/indexers/descriptive_metadata_indexer_spec.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/services/orcid_builder.rb b/app/services/orcid_builder.rb index a3d9c7de..06111f3d 100644 --- a/app/services/orcid_builder.rb +++ b/app/services/orcid_builder.rb @@ -48,6 +48,9 @@ def orcidid(contributor) return identifier.uri if identifier.uri return identifier.value if identifier.value.start_with?('https://orcid.org/') + # some records have just the ORCIDID without the URL prefix, add it if so, e.g. druid:tp865ng1792 + return URI.join('https://orcid.org/', identifier.value).to_s if identifier.source.uri.blank? + URI.join(identifier.source.uri, identifier.value).to_s end end diff --git a/spec/indexers/descriptive_metadata_indexer_spec.rb b/spec/indexers/descriptive_metadata_indexer_spec.rb index 1ae61dd6..da2fb1b5 100644 --- a/spec/indexers/descriptive_metadata_indexer_spec.rb +++ b/spec/indexers/descriptive_metadata_indexer_spec.rb @@ -124,7 +124,7 @@ ], identifier: [ { - value: 'https://orcid.org/0000-0001-5321-289X', + value: '0000-0001-5321-289X', type: 'ORCID', source: { code: 'orcid' From baf31f3fb16342292b8934cc9f38e951ae374c43 Mon Sep 17 00:00:00 2001 From: Peter Mangiafico Date: Wed, 15 Nov 2023 13:38:54 -0800 Subject: [PATCH 2/2] just assume all ORCIDs that with https://orcid.org --- app/services/orcid_builder.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/services/orcid_builder.rb b/app/services/orcid_builder.rb index 06111f3d..22fd5e82 100644 --- a/app/services/orcid_builder.rb +++ b/app/services/orcid_builder.rb @@ -48,9 +48,6 @@ def orcidid(contributor) return identifier.uri if identifier.uri return identifier.value if identifier.value.start_with?('https://orcid.org/') - # some records have just the ORCIDID without the URL prefix, add it if so, e.g. druid:tp865ng1792 - return URI.join('https://orcid.org/', identifier.value).to_s if identifier.source.uri.blank? - - URI.join(identifier.source.uri, identifier.value).to_s + URI.join('https://orcid.org/', identifier.value).to_s end end