Skip to content

Commit

Permalink
support crossref dissertation type
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Aug 22, 2020
1 parent f64bab7 commit 5c3c5b0
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 4 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.8)
bolognese (1.8.9)
activesupport (>= 4.2.5)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
Expand Down
6 changes: 4 additions & 2 deletions lib/bolognese/readers/crossref_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def read_crossref(string: nil, **options)
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
bibliographic_metadata = meta.dig("crossref", "peer_review")
when "dissertation"
bibliographic_metadata = meta.dig("crossref", "dissertation")
end

resource_type = (resource_type || model).to_s.underscore.camelcase.presence
Expand Down Expand Up @@ -236,7 +238,7 @@ def crossref_license(program_metadata)
end

def crossref_people(bibliographic_metadata, contributor_role)
person = bibliographic_metadata.dig("contributors", "person_name")
person = bibliographic_metadata.dig("contributors", "person_name") || bibliographic_metadata.dig("person_name")
organization = Array.wrap(bibliographic_metadata.dig("contributors", "organization"))
person = [{ "name" => ":(unav)", "contributor_role"=>"author" }] if contributor_role == "author" && Array.wrap(person).select { |a| a["contributor_role"] == "author" }.blank? && Array.wrap(organization).select { |a| a["contributor_role"] == "author" }.blank?

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.8"
VERSION = "1.8.9"
end

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

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

it "dissertation" do
input = "https://doi.org/10.14264/uql.2020.791"
subject = Bolognese::Metadata.new(input: input)
expect(subject.valid?).to be true
expect(subject.url).to eq("http://espace.library.uq.edu.au/view/UQ:23a1e74")
expect(subject.types).to eq("bibtex"=>"phdthesis", "citeproc"=>"thesis", "resourceType"=>"Dissertation", "resourceTypeGeneral"=>"Text", "ris"=>"THES", "schemaOrg"=>"Thesis")
expect(subject.creators).to eq([{"familyName"=>"Collingwood",
"givenName"=>"Patricia Maree",
"name"=>"Collingwood, Patricia Maree",
"nameIdentifiers"=>
[{"nameIdentifier"=>"https://orcid.org/0000-0003-3086-4443",
"nameIdentifierScheme"=>"ORCID",
"schemeUri"=>"https://orcid.org"}],
"nameType"=>"Personal"}])
expect(subject.titles).to eq([{"title"=>"School truancy and financial independence during emerging adulthood: a longitudinal analysis of receipt of and reliance on cash transfers"}])
expect(subject.id).to eq("https://doi.org/10.14264/uql.2020.791")
expect(subject.identifiers).to be_empty
expect(subject.descriptions).to be_empty
expect(subject.dates).to include({"date"=>"2020-06-08", "dateType"=>"Issued"})
expect(subject.publication_year).to eq("2020")
expect(subject.publisher).to eq("University of Queensland Library")
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 5c3c5b0

Please sign in to comment.