diff --git a/app/services/orcid_builder.rb b/app/services/orcid_builder.rb index 22fd5e8..06111f3 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/') - URI.join('https://orcid.org/', identifier.value).to_s + # 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 4e0a9af..eb583a5 100644 --- a/spec/indexers/descriptive_metadata_indexer_spec.rb +++ b/spec/indexers/descriptive_metadata_indexer_spec.rb @@ -99,7 +99,7 @@ type: 'person', identifier: [ { - uri: 'https://orcid.org/1111-2222-3333-4444', + uri: 'https://sandbox.orcid.org/1111-2222-3333-4444', type: 'ORCID', source: { code: 'orcid' @@ -404,7 +404,7 @@ 'originInfo_place_placeTerm_tesim' => 'Garden City, N. Y', 'topic_ssim' => %w[Economics cats], 'topic_tesim' => %w[cats Economics], - 'contributor_orcids_ssim' => ['https://orcid.org/0000-1111-2222-3333', 'https://orcid.org/1111-2222-3333-4444', 'https://orcid.org/0000-0001-5321-289X'] + 'contributor_orcids_ssim' => ['https://orcid.org/0000-1111-2222-3333', 'https://sandbox.orcid.org/1111-2222-3333-4444', 'https://orcid.org/0000-0001-5321-289X'] ) end # rubocop:enable Style/StringHashKeys