-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map some additional orcid pub types #1438
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,16 @@ module Orcid | |
# Maps work / publication types between ORCID and SUL-PUB. | ||
class PublicationTypeMapper | ||
# Note that this is limited to the work types for which mapping is supported. | ||
# Full list of work types at ORCID: see https://info.orcid.org/faq/what-work-types-does-orcid-support/ | ||
PUB_TYPE_TO_WORK_TYPE = { | ||
'article' => 'journal-article', | ||
'book' => 'book', | ||
'caseStudy' => 'research-tool', | ||
'inbook' => 'book-chapter', | ||
'inproceedings' => 'conference-paper' | ||
'inproceedings' => 'conference-paper', | ||
'otherPaper' => 'other', | ||
'technicalReport' => 'report', | ||
'workingPaper' => 'working-paper' | ||
}.freeze | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the extra mappings from ORCID works to pub types in sul-pub |
||
|
||
# @return [String] ORCID work type or nil if no matching | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ def map | |
title: work.title, | ||
identifier: map_identifiers(work.self_external_ids), | ||
abstract: work.short_description, | ||
provenance: 'orcid', | ||
provenance: Settings.orcid_source, | ||
doi: work.external_id_value('doi'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this matches how we set provenance for other source types |
||
isbn: work.external_id_value('isbn'), | ||
issn: work.external_id_value('issn'), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,14 +119,14 @@ properties: | |
enum: | ||
- article | ||
- book | ||
- caseStudy # Legacy. Not in current code. | ||
- caseStudy # Only set via manual pub submission (provenance = cap) | ||
- inproceedings | ||
- inbook # Legacy. Not in current code. | ||
- otherpaper # Legacy. Not in current code. | ||
- otherPaper # Legacy. Not in current code. | ||
- technicalReport # Legacy. Not in current code. | ||
- workingPaper # Legacy. Not in current code. | ||
- null # Legacy. Not in current code. | ||
- inbook # Only set via manual pub submission (provenance = cap) | ||
- otherpaper # Legacy. Not in current code, likely bad data. | ||
- otherPaper # Only set via manual pub submission (provenance = cap) or via ORCID harvest (provenance = orcid) | ||
- technicalReport # Only set via manual pub submission (provenance = cap) or via ORCID harvest (provenance = orcid) | ||
- workingPaper # Only set via manual pub submission (provenance = cap) or via ORCID harvest (provenance = orcid) | ||
- null # Legacy. Not in current code, likely bad data. | ||
wos_item_id: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updates to documentation |
||
type: string | ||
wos_uid: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,14 +121,24 @@ | |
|
||
context 'when unmappable type' do | ||
let(:pub_hash) do | ||
base_pub_hash.dup.tap { |pub_hash| pub_hash[:type] = 'workingPaper' } | ||
base_pub_hash.dup.tap { |pub_hash| pub_hash[:type] = 'unknownType' } | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. workingPaper is now mappable so let's use some other bad data type to prove we raise the error |
||
|
||
it 'raises' do | ||
expect { work }.to raise_error(Orcid::PubMapper::PubMapperError, 'Unmapped publication type') | ||
end | ||
end | ||
|
||
context 'when mappable type' do | ||
let(:pub_hash) do | ||
base_pub_hash.dup.tap { |pub_hash| pub_hash[:type] = 'workingPaper' } | ||
end | ||
|
||
it 'maps correctly' do | ||
expect(work['type']).to eq('working-paper') | ||
end | ||
end | ||
|
||
context 'when missing title' do | ||
let(:pub_hash) { base_pub_hash.except(:title) } | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additional convenience method like we have for other sources