Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def source_id(self):
"""Scopus source ID of the document."""
return chained_get(self._json, ['coredata', 'source-id'])
def given_name(self):
"""Author's preferred given name."""
path = ['author-profile', 'preferred-name', 'given-name']
return chained_get(self._json, path)
def status(self):
"""The status of the author profile."""
return chained_get(self._json, ["author-profile", "status"])
def publicationName(self):
"""Name of source the document is published in."""
return chained_get(self._json, ['coredata', 'prism:publicationName'])
def publisher(self):
"""Name of the publisher of the document.
Note: Information provided in the FULL view of the article might be
more complete.
"""
# Return information from FULL view, fall back to other views
full = chained_get(self._head, ['source', 'publisher', 'publishername'])
if full is None:
return chained_get(self._json, ['coredata', 'dc:publisher'])
else:
return full
def url(self):
"""URL to the API view of the document."""
return chained_get(self._json, ['coredata', 'prism:url'])
def authors(self):
"""A list of namedtuples representing the article's authors, in the
form (auid, indexed_name, surname, given_name, affiliation_id,
affiliation, city, country).
Note: The affiliation referred to here is what Scopus' algorithm
determined as the main affiliation. Property `authorgroup` provides
all affiliations.
"""
out = []
fields = 'auid indexed_name surname given_name affiliation'
auth = namedtuple('Author', fields)
for item in chained_get(self._json, ['authors', 'author'], []):
affs = [a for a in listify(item.get('affiliation')) if a]
if affs:
aff = [aff.get('@id') for aff in affs]
else:
aff = None
new = auth(auid=item['@auid'], surname=item.get('ce:surname'),
indexed_name=item.get('ce:indexed-name'), affiliation=aff,
given_name=chained_get(item, ['preferred-name', 'ce:given-name']))
out.append(new)
return out or None
def subject_areas(self):
"""List of named tuples of subject areas in the form
(area, abbreviation, code) of author's publication.
"""
path = ['subject-areas', 'subject-area']
area = namedtuple('Subjectarea', 'area abbreviation code')
areas = [area(area=item['$'], code=item['@code'],
abbreviation=item['@abbrev'])
for item in chained_get(self._json, path, [])]
return areas or None
def subject_areas(self):
"""List of namedtuples containing subject areas of the article
in the form (area abbreviation code).
Note: Requires the FULL view of the article.
"""
area = namedtuple('Area', 'area abbreviation code')
path = ['subject-areas', 'subject-area']
out = [area(area=item['$'], abbreviation=item['@abbrev'],
code=item['@code'])
for item in listify(chained_get(self._json, path, []))]
return out or None