Skip to content

Commit

Permalink
support crossref peer_review type
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Aug 22, 2020
1 parent c956bce commit f64bab7
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bolognese (1.8.7)
bolognese (1.8.8)
activesupport (>= 4.2.5)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
Expand Down
2 changes: 2 additions & 0 deletions lib/bolognese/readers/crossref_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def read_crossref(string: nil, **options)
when "report_paper"
bibliographic_metadata = meta.dig("crossref", "report_paper", "report_paper_metadata").to_h
resource_type = "report"
when "peer_review"
bibliographic_metadata = meta.dig("crossref", "peer_review").to_h
end

resource_type = (resource_type || model).to_s.underscore.camelcase.presence
Expand Down
4 changes: 3 additions & 1 deletion lib/bolognese/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ module Utils
"ReferenceEntry" => nil,
"JournalVolume" => "PublicationVolume",
"BookSet" => nil,
"PostedContent" => "ScholarlyArticle"
"PostedContent" => "ScholarlyArticle",
"PeerReview" => "Review"
}

CR_TO_BIB_TRANSLATIONS = {
Expand Down Expand Up @@ -219,6 +220,7 @@ module Utils
"ScholarlyArticle" => "Text",
"Thesis" => "Text",
"Service" => "Service",
"Review" => "Text",
"SoftwareSourceCode" => "Software",
"VideoObject" => "Audiovisual",
"WebPage" => "Text",
Expand Down
2 changes: 1 addition & 1 deletion lib/bolognese/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Bolognese
VERSION = "1.8.7"
VERSION = "1.8.8"
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions spec/readers/crossref_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,28 @@
expect(subject.agency).to eq("crossref")
end

it "peer review" do
input = "https://doi.org/10.7554/elife.55167.sa2"
subject = Bolognese::Metadata.new(input: input)
expect(subject.valid?).to be true
expect(subject.url).to eq("https://elifesciences.org/articles/55167#sa2")
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article-journal", "resourceType"=>"PeerReview", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"Review")
expect(subject.creators.count).to eq(8)
expect(subject.creators.last).to eq("affiliation" => [{"name"=>"Center for Computational Mathematics, Flatiron Institute, New York, United States"}],
"familyName" => "Barnett",
"givenName" => "Alex H",
"name" => "Barnett, Alex H",
"nameType" => "Personal")
expect(subject.titles).to eq([{"title"=>"Author response: SpikeForest, reproducible web-facing ground-truth validation of automated neural spike sorters"}])
expect(subject.id).to eq("https://doi.org/10.7554/elife.55167.sa2")
expect(subject.identifiers).to be_empty
expect(subject.descriptions).to be_empty
expect(subject.dates).to include({"date"=>"2020-05-19", "dateType"=>"Issued"})
expect(subject.publication_year).to eq("2020")
expect(subject.publisher).to eq("eLife Sciences Publications, Ltd")
expect(subject.agency).to eq("crossref")
end

it "DOI with SICI DOI" do
input = "https://doi.org/10.1890/0012-9658(2006)87[2832:tiopma]2.0.co;2"
subject = Bolognese::Metadata.new(input: input)
Expand Down

0 comments on commit f64bab7

Please sign in to comment.