pubmedly 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ce515f0fc81d823f6685a8711ea61113003ff1417de4b51981ed130f7f1b074
4
- data.tar.gz: 93feffd74c056084fee11e5bc75307ff9a91b5fc301da2082e36fb180b0da6fb
3
+ metadata.gz: e53e6275febdb64a857f7fa9945cd5f33872a3970812fea25c74467ba4f74114
4
+ data.tar.gz: a7d4a0f420fb810dee254e141789f608a58a21aecd7d08420de09a86a5972138
5
5
  SHA512:
6
- metadata.gz: e6bd4ef020f8e5f85d44843acd24170ae5d08b519944041b938055584e85fd92c1bb5674e457634eb4348caa7c9a113957fc2c01acaebb5242ca2179b37c55f8
7
- data.tar.gz: e53587fd6bf4d3070fa79a6e46d7f8fc825cf6086271ce7d13401bf2444a44661d8565dd8b59c005d790affe6155d4edcc917aab330a721c894d361e33456bfd
6
+ metadata.gz: df53c06ff3817ca214d3aa8a669dadb600b8c077244767373e023b082a1a3ee371ac80e94a5004efb904ec1b552b565b5df07176b267fcd38c278eff3bbb4855
7
+ data.tar.gz: acb868ee974088141abcf369bba847289495f9eafd6c9961c889bf9c0b0d1df287dde1f2672076e5185a8808823b8e9f9c2792e339f17436dc20c52b360e391c
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- ## [Unreleased]
1
+ ## [0.3.0] - 2023-05-29
2
+
3
+ - Add PUBMEDLY::FIELD_TAGS
4
+ - Add Article#first/last_author
2
5
 
3
6
  ## [0.2.0] - 2023-05-20
4
7
 
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # Pubmedly
2
-
3
- **WIP**
2
+ ![main](https://github.com/robsimpsondev/pubmedly/actions/workflows/main.yml/badge.svg)
4
3
 
5
4
  This gem provides a `Pubmedly::Client` with methods that get data from the NCBI's [Pubmed database](https://pubmed.ncbi.nlm.nih.gov/) using their [eutils APIs](https://www.ncbi.nlm.nih.gov/books/NBK25499/).
6
5
 
@@ -10,17 +9,16 @@ You will need an API key to use this gem; doing this is simple and described wit
10
9
 
11
10
  ## Installation
12
11
 
13
- Requirements: Ruby.
14
-
15
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
12
+ Requirements:
13
+ - Ruby 3.0+
16
14
 
17
15
  Install the gem and add to the application's Gemfile by executing:
18
16
 
19
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
17
+ $ bundle add pubmedly
20
18
 
21
19
  If bundler is not being used to manage dependencies, install the gem by executing:
22
20
 
23
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
21
+ $ gem install pubmedly
24
22
 
25
23
  ## Usage
26
24
 
@@ -86,7 +84,7 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
86
84
  - MAJOR version when you make incompatible API changes
87
85
  - MINOR version when you add functionality in a backward compatible manner
88
86
  - PATCH version when you make backward compatible bug fixes
89
-
87
+
90
88
  Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
91
89
 
92
90
  ## License
@@ -40,6 +40,14 @@ module Pubmedly
40
40
  end
41
41
  end
42
42
 
43
+ def first_author
44
+ authors.first
45
+ end
46
+
47
+ def last_author
48
+ authors.last
49
+ end
50
+
43
51
  def pmid
44
52
  id = @xml.xpath(".//PMID").text.to_i
45
53
  id.zero? ? nil : id
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pubmedly
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/pubmedly.rb CHANGED
@@ -9,4 +9,56 @@ require_relative "pubmedly/pubmed"
9
9
  module Pubmedly
10
10
  class ApiWarning < StandardError; end
11
11
  # Your code goes here...
12
+
13
+ # https://pubmed.ncbi.nlm.nih.gov/help/#search-tags
14
+ FIELD_TAGS = {
15
+ "Affiliation" => ["ad"],
16
+ "All Fields" => ["all"],
17
+ "Article Identifier" => ["aid"],
18
+ "Author" => ["au"],
19
+ "Author Identifier" => ["auid"],
20
+ "Book" => ["book"],
21
+ "Completion Date" => ["dcom"],
22
+ "Conflict of Interest Statement" => ["cois"],
23
+ "Corporate Author" => ["cn"],
24
+ "Create Date" => ["crdt"],
25
+ "EC/RN Number" => ["rn"],
26
+ "Editor" => ["ed"],
27
+ "Entry Date" => ["edat"],
28
+ "Filter" => %w[filter sb],
29
+ "First Author Name" => ["1au"],
30
+ "Full Author Name" => ["fau"],
31
+ "Full Investigator Name" => ["fir"],
32
+ "Grant Number" => ["gr"],
33
+ "Investigator" => ["ir"],
34
+ "ISBN" => ["isbn"],
35
+ "Issue" => ["ip"],
36
+ "Journal" => ["ta"],
37
+ "Language" => ["la"],
38
+ "Last Author Name" => ["lastau"],
39
+ "Location ID" => ["lid"],
40
+ "MeSH Date" => ["mhda"],
41
+ "MeSH Major Topic" => ["majr"],
42
+ "MeSH Subheadings" => ["sh"],
43
+ "MeSH Terms" => ["mh"],
44
+ "Modification Date" => ["lr"],
45
+ "NLM Unique ID" => ["jid"],
46
+ "Other Term" => ["ot"],
47
+ "Pagination" => ["pg"],
48
+ "Personal Name as Subject" => ["ps"],
49
+ "Pharmacological Action" => ["pa"],
50
+ "Place of Publication" => ["pl"],
51
+ "PMID" => ["pmid"],
52
+ "Publication Date" => ["dp"],
53
+ "Publication Type" => ["pt"],
54
+ "Publisher" => ["pubn"],
55
+ "Secondary Source ID" => ["si"],
56
+ "Subset" => ["sb"],
57
+ "Supplementary Concept" => ["nm"],
58
+ "Text Words" => ["tw"],
59
+ "Title" => ["ti"],
60
+ "Title/Abstract" => ["tiab"],
61
+ "Transliterated Title" => ["tt"],
62
+ "Volume" => ["vi"],
63
+ }.freeze
12
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubmedly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Simpson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-20 00:00:00.000000000 Z
11
+ date: 2023-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri