Skip to content

Commit 5326b5d

Browse files
committed
fix: update author extraction logic in RxivPublication class
The Rxiv server recently updated their API to remove the `preprint_` string pre-pended to various fields. This change removes the prepended string, allowing us to parse these fields out again.
1 parent 01321f1 commit 5326b5d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/mavedb/lib/external_publications.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
import logging
88
import re
99
from typing import Any, Optional, Union
10-
from typing_extensions import TypedDict
1110

1211
import requests
1312
from idutils import is_doi
13+
from typing_extensions import TypedDict
1414

1515
logger = logging.getLogger(__name__)
1616

@@ -118,7 +118,7 @@ def __init__(self, metadata: dict[str, str]) -> None:
118118
self.published_date = datetime.datetime.strptime(published_date, "%Y-%m-%d") if published_date else None
119119

120120
def generate_author_list(self, metadata: dict[str, str]) -> list[PublicationAuthors]:
121-
authors = [s.strip() for s in metadata.get("preprint_authors", "").split(";")]
121+
authors = [s.strip() for s in metadata.get("authors", "").split(";")]
122122
return [{"name": author, "primary": idx == 0} for idx, author in enumerate(authors)]
123123

124124

@@ -201,10 +201,10 @@ def __init__(self, metadata: dict[str, str]) -> None:
201201
not be the case for certain publications.
202202
"""
203203
super().__init__(metadata)
204-
self.author_corresponding = metadata.get("preprint_author_corresponding")
205-
self.author_corresponding_institution = metadata.get("preprint_author_corresponding_institution")
206-
self.platform = metadata.get("preprint_platform")
207-
self.abstract = metadata.get("preprint_abstract")
204+
self.author_corresponding = metadata.get("author_corresponding")
205+
self.author_corresponding_institution = metadata.get("author_corresponding_institution")
206+
self.platform = metadata.get("platform")
207+
self.abstract = metadata.get("abstract")
208208
self.published_journal = metadata.get("published_journal")
209209

210210
self.authors = self.generate_author_list(metadata)

0 commit comments

Comments
 (0)