Sha256: 85af697353956b49e4af3add39e6d70bcb0f27fcddc90799b011e562b6b5c15f

Contents?: true

Size: 1.22 KB

Versions: 73

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

module Commonmeta
  module Pubmed
    # def get_pubmed_metadata(pmid, options = {})
    #   return {} if pmid.blank?

    #   url = "http://www.ebi.ac.uk/europepmc/webservices/rest/search/query=ext_id:#{pmid}&format=json"
    #   response = Maremma.get(url, options)

    #   metadata = response.body.fetch("data", {}).fetch("resultList", {}).fetch("result", []).first
    #   return { error: 'Resource not found.', status: 404 } if metadata.blank?

    #   metadata["issued"] = metadata.fetch("pubYear", nil)

    #   author_string = metadata.fetch("authorString", "").chomp(".")
    #   metadata["author"] = get_authors(author_string.split(", "))

    #   metadata["title"] = metadata.fetch("title", "").chomp(".")
    #   metadata["container-title"] = metadata.fetch("journalTitle", nil)
    #   metadata["volume"] = metadata.fetch("journalVolume", nil)
    #   metadata["page"] = metadata.fetch("pageInfo", nil)
    #   metadata["type"] = "article-journal"

    #   metadata
    # end

    def pmid_as_url(pmid)
      "http://www.ncbi.nlm.nih.gov/pubmed/#{pmid}" if pmid.present?
    end

    def pmcid_as_url(pmcid)
      "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC#{pmcid}" if pmcid.present?
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
commonmeta-ruby-3.13 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.12.1 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.12.0 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.11.0 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.9.0 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.8.3 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.8.2 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.8.1 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.8.0 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.7.3 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.7.2 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.7.1 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.7.0 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.6.1 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.6 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.5.5 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.5.4 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.5.3 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.5.2 lib/commonmeta/pubmed.rb
commonmeta-ruby-3.5.1 lib/commonmeta/pubmed.rb