Skip to content

Commit

Permalink
adding search_orcid to Authors
Browse files Browse the repository at this point in the history
  • Loading branch information
J-A-Ha committed Jul 15, 2024
1 parent 0e90c74 commit 9453a1f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Binary file modified classes/__pycache__/results.cpython-39.pyc
Binary file not shown.
18 changes: 18 additions & 0 deletions classes/authors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

from ..utils.cleaners import deduplicate
from ..importers.orcid import lookup_orcid, get_author, get_author_works
from ..importers.orcid import search as search_orcid # type: ignore
from .entities import Entity, Entities
from .results import Results
from .affiliations import Affiliation, Affiliations, format_affiliations
Expand Down Expand Up @@ -886,6 +887,19 @@ def affiliations(self, drop_duplicates = False, drop_empty_rows=False):
output[auth_id] = affiliation

return output

def search_orcid(self, query: str = 'request_input', add_to_authors: bool = True):

res = search_orcid(query=query)
res = res.rename({'credit-name': 'full_name', 'given-names': 'given_name', 'family-name': 'family_name', 'institution-name': 'affiliations', 'orcid-id': 'orcid'}) # type: ignore

if add_to_authors == True:

self.all = pd.concat([self.all, res])
self.sync_details()
self.drop_empty_rows()

return res

def format_authors(author_data, drop_duplicates = False, drop_empty_rows=False):

Expand Down Expand Up @@ -918,3 +932,7 @@ def format_authors(author_data, drop_duplicates = False, drop_empty_rows=False):
result.remove_duplicates(drop_empty_rows=drop_empty_rows)

return result




0 comments on commit 9453a1f

Please sign in to comment.