Skip to content

Commit

Permalink
move doi settings into their own block
Browse files Browse the repository at this point in the history
  • Loading branch information
peetucket committed Oct 25, 2016
1 parent 1b1fa59 commit c341658
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/models/pubmed_source_record.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'nokogiri'
require 'nokogiri'

class PubmedSourceRecord < ActiveRecord::Base
# validates_uniqueness_of :pmid
Expand Down Expand Up @@ -152,7 +153,7 @@ def convert_pubmed_publication_doc_to_hash(publication)
# the DOI can be in one of two places: ArticleId or ELocationID
doi = publication.at_xpath('//ArticleId[@IdType="doi"]')
doi = publication.at_xpath('//ELocationID[@EIdType="doi"]') unless doi.present? && doi.text.present?
record_as_hash[:identifier] << { type: 'doi', id: doi.text, url: "#{Settings.SCIENCEWIRE.DOI_BASE_URL}#{doi.text}" } if doi.present? && doi.text.present?
record_as_hash[:identifier] << { type: 'doi', id: doi.text, url: "#{Settings.DOI.BASE_URI}#{doi.text}" } if doi.present? && doi.text.present?

record_as_hash
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/sciencewire_source_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def self.convert_sw_publication_doc_to_hash(publication)
swid = extract_swid(publication)
wosid = extract_wosid(publication)

doi_identifier = { type: 'doi', id: doi, url: "#{Settings.SCIENCEWIRE.DOI_BASE_URL}#{doi}" } unless doi.blank?
doi_identifier = { type: 'doi', id: doi, url: "#{Settings.DOI.BASE_URL}#{doi}" } unless doi.blank?
issn_identifier = { type: 'issn', id: issn, url: Settings.SULPUB_ID.SEARCHWORKS_URI + issn } unless issn.blank?

identifiers = []
Expand Down
4 changes: 3 additions & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ SCIENCEWIRE:
RECOMMENDATION_PATH: /PublicationCatalog/MatchedPublicationItemIdsForAuthor?format=xml
TMPDIR: /tmp
ARTICLE_BASE_URI: https://ws.isiknowledge.com/cps/openurl/service?url_ver=Z39.88-2004&rft_id=info:ut/
DOI_BASE_URL: https://dx.doi.org/

DOI:
BASE_URI: https://dx.doi.org/

HARVESTER:
USE_MIDDLE_NAME: true
Expand Down
2 changes: 1 addition & 1 deletion lib/bibtex_ingester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def convert_bibtex_record_to_pub_hash(record, author)
identifiers << isbn_for_id_array
end
unless doi.blank?
doi_for_id_array = { type: 'doi', id: doi, url: "#{Settings.SCIENCEWIRE.DOI_BASE_URL}#{doi}" }
doi_for_id_array = { type: 'doi', id: doi, url: "#{Settings.DOI.BASE_URI}#{doi}" }
identifiers << doi_for_id_array
record_as_hash[:doi] = doi
end
Expand Down

0 comments on commit c341658

Please sign in to comment.