def authorgroup(self) -> Optional[List[NamedTuple]]: """A list of namedtuples representing the article's authors organized by affiliation, in the form (affiliation_id, dptid, organization, city, postalcode, addresspart, country, collaboration, auid, orcid, indexed_name, surname, given_name). If "given_name" is not present, fall back to initials. Note: Affiliation information might be missing or mal-assigned even when it looks correct in the web view. In this case please request a correction. It is generally missing for collaborations. """ # Information can be one of three forms: # 1. A dict with one key (author) or two keys (affiliation and author) # 2. A list of dicts with as in 1, one for each affiliation (incl. missing) # 3. A list of two dicts with one key each (author and collaboration) # Initialization fields = 'affiliation_id dptid organization city postalcode '\ 'addresspart country collaboration auid orcid indexed_name '\ 'surname given_name' auth = namedtuple('Author', fields) items = listify(self._head.get('author-group', [])) index_path = ['preferred-name', 'ce:indexed-name'] # Check for collaboration keys = [k for x in items for k in list(x.keys())] if "collaboration" in keys: collaboration = items.pop(-1)['collaboration'] else: collaboration = {'ce:indexed-name': None} # Iterate through each author-affiliation combination out = [] for item in items: if not item: continue # Affiliation information aff = item.get('affiliation', {}) aff_id = make_int_if_possible(aff.get("@afid")) dep_id = make_int_if_possible(aff.get("@dptid")) org = _get_org(aff) # Author information (might relate to collaborations) authors = listify(item.get('author', item.get('collaboration', []))) for au in authors: try: given = au.get('ce:given-name', au['ce:initials']) except KeyError: # Collaboration given = au.get('ce:text') new = auth(affiliation_id=aff_id, organization=org, city=aff.get('city'), dptid=dep_id, postalcode=aff.get('postal-code'), addresspart=aff.get('address-part'), country=aff.get('country'), collaboration=collaboration.get('ce:indexed-name'), auid=int(au['@auid']), orcid=au.get('@orcid'), surname=au.get('ce:surname'), given_name=given, indexed_name=chained_get(au, index_path)) out.append(new) return out or None
def coauthor_count(self) -> Optional[int]: """Total number of coauthors.""" return make_int_if_possible(chained_get(self._json, ['coauthor-count']))
def h_index(self) -> Optional[str]: """The author's h-index.""" return make_int_if_possible(chained_get(self._json, ['h-index']))
def source_id(self) -> Optional[int]: """Scopus source ID of the document.""" path = ['coredata', 'source-id'] return make_int_if_possible(chained_get(self._json, path))
def pubmed_id(self) -> Optional[int]: """The PubMed ID of the document.""" path = ['coredata', 'pubmed-id'] return make_int_if_possible(chained_get(self._json, path))
def openaccess(self) -> Optional[int]: """The openaccess status encoded in single digits.""" path = ['coredata', 'openaccess'] return make_int_if_possible(chained_get(self._json, path))
def confcode(self) -> Optional[int]: """Code of the conference the document belongs to.""" return make_int_if_possible(self._confevent.get('confcode'))
def citedby_count(self) -> Optional[int]: """Number of articles citing the document.""" path = ['coredata', 'citedby-count'] return make_int_if_possible(chained_get(self._json, path))