pubmedly 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +1 -1
- data/README.md +6 -8
- data/lib/pubmedly/parsers/article.rb +16 -0
- data/lib/pubmedly/version.rb +1 -1
- data/lib/pubmedly.rb +52 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 931f21135967ca4a8f8fd133e6381be02a5da461f71dcae1bd1c716900be29ab
|
4
|
+
data.tar.gz: 6f12c9b994516417d2d247577b35f8d52272b92da6f36643638ed415a8ba5f99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64174015e0bbc4b7baa4d2bb62a018d5fc16896ab76ddea8464316e08d9eb2a72c4d8866bb44ffa3863fe063173ebe18112a2dedd7fb7aa347e26b37508439ee
|
7
|
+
data.tar.gz: e2543ae0797da9d3a6213a6374e25a6fc18c763bc806b09122314dff82a6ccfe4829853f916a44df1a56aa4e614efcf1545255115d0479d9c3671e4496f4a3b7
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# Pubmedly
|
2
|
-
|
3
|
-
**WIP**
|
2
|
+

|
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:
|
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
|
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
|
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,10 +40,26 @@ 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
|
46
54
|
end
|
55
|
+
|
56
|
+
def pmcid
|
57
|
+
@xml.xpath(".//PubmedData/ArticleIdList/ArticleId [@IdType='pmc']")&.text
|
58
|
+
end
|
59
|
+
|
60
|
+
def doi
|
61
|
+
@xml.xpath(".//ELocationID [@EIdType='doi']")&.text
|
62
|
+
end
|
47
63
|
end
|
48
64
|
end
|
49
65
|
end
|
data/lib/pubmedly/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.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:
|
11
|
+
date: 2024-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: '0'
|
225
225
|
requirements: []
|
226
|
-
rubygems_version: 3.4.
|
226
|
+
rubygems_version: 3.4.19
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: Ruby client for the NCBI eutils Pubmed API
|