Skip to content

Commit 14d6250

Browse files
authored
Ensure unique DOI from PubMed API (#71)
* fix: ensure unique DOIs in PubMed * chore: patch release prep * fix: skip None * chore: bump pymed
1 parent 3c3bb80 commit 14d6250

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

paperscraper/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Initialize the module."""
22

33
__name__ = "paperscraper"
4-
__version__ = "0.2.15"
4+
__version__ = "0.2.16"
55

66
import logging
77
import os

paperscraper/pubmed/pubmed.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"date": lambda date: (
2727
date.strftime("%Y-%m-%d") if isinstance(date, datetime.date) else date
2828
),
29+
"doi": lambda doi: doi.split("\n")[0] if isinstance(doi, str) else doi,
2930
}
3031

3132

paperscraper/pubmed/tests/test_pubmed.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
class TestPubMed:
11-
1211
def test_get_and_dump_pubmed(self):
1312
with tempfile.TemporaryDirectory() as temp_dir:
1413
output_filepath = os.path.join(temp_dir, "tmp.jsonl")
@@ -30,3 +29,8 @@ def test_email(self):
3029
df = get_pubmed_papers(query, fields=["emails", "title", "authors"])
3130
assert "emails" in df.columns
3231

32+
def test_doi(self):
33+
query = "CRISPR-based gene editing in plants: Focus on reagents and their delivery tools"
34+
df = get_pubmed_papers(query, fields=["doi", "title", "authors"])
35+
for i, r in df.iterrows():
36+
assert "\n" not in r.doi

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
arxiv>=1.4.7
2-
pymed-paperscraper>=1.0.2
2+
pymed-paperscraper>=1.0.3
33
pandas>=1.0.4
44
requests==2.32.0
55
tqdm>=4.51.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
license="MIT",
2929
install_requires=[
3030
"arxiv>=1.4.2",
31-
"pymed-paperscraper>=1.0.2",
31+
"pymed-paperscraper>=1.0.3",
3232
"pandas",
3333
"requests",
3434
"tqdm",

0 commit comments

Comments
 (0)