# Higher level interface for interacting with specific classes of events import pyalm as alm import cleanup from utils import dictmapper, MappingRule as to ContributorBase = dictmapper( 'ContributorBase', { 'contributor_role': ['contributor_role'], 'first_author': to(['first_author'], cleanup._text_to_bool), 'given_name': ['given_name'], 'sequence': ['sequence'], 'surname': ['surname'] }) class Contributor(ContributorBase): def __repr__(self): return '<%s: %s%s>' % (type(self).__name__, self.given_name, self.surname) CrossrefBase = dictmapper( 'CrossrefBase', { 'article_title': ['event', 'article_title'], 'doi': ['event', 'doi'], 'fl_count': to(['event', 'fl_count'], cleanup._parse_numbers_to_int), 'issn': ['event', 'issn'], 'journal_abbreviation': ['event', 'journal_abbreviation'], 'journal_title': ['event', 'journal_title'], 'publication_type': ['event', 'publication_type'],
import requests from utils import dictmapper, MappingRule as to import cleanup import config BASE_HEADERS = {'Accept': 'application/json'} MetricsBase = dictmapper( 'MetricsBase', { 'citations': to(['citations'], cleanup._parse_numbers_to_int), 'comments': to(['comments'], cleanup._parse_numbers_to_int), 'html': to(['html'], cleanup._parse_numbers_to_int), 'likes': to(['likes'], cleanup._parse_numbers_to_int), 'pdf': to(['pdf'], cleanup._parse_numbers_to_int), 'readers': to(['readers'], cleanup._parse_numbers_to_int), 'shares': to(['shares'], cleanup._parse_numbers_to_int), 'total': to(['total'], cleanup._parse_numbers_to_int) }) class Metrics(MetricsBase): def __repr__(self): return """ <%s total:%s readers:%s pdf:%s html:%s comments:%s likes:%s> """ % (type(self).__name__, self.total, self.readers, self.pdf, self.html, self.comments, self.likes) SourceBase = dictmapper( 'SourceBase', { 'name': ['name'],
# Higher level interface for interacting with specific classes of events import pyalm as alm import cleanup from utils import dictmapper, MappingRule as to ContributorBase = dictmapper('ContributorBase', { 'contributor_role' : ['contributor_role'], 'first_author': to(['first_author'], cleanup._text_to_bool), 'given_name': ['given_name'], 'sequence': ['sequence'], 'surname': ['surname'] } ) class Contributor(ContributorBase): def __repr__(self): return '<%s: %s%s>' % (type(self).__name__, self.given_name, self.surname) CrossrefBase = dictmapper('CrossrefBase', { 'article_title' : ['event','article_title'], 'doi' : ['event','doi'], 'fl_count' : to(['event','fl_count'], cleanup._parse_numbers_to_int), 'issn' : ['event','issn'], 'journal_abbreviation' : ['event','journal_abbreviation'], 'journal_title' : ['event','journal_title'], 'publication_type' : ['event','publication_type'],
from utils import dictmapper, MappingRule as to import cleanup import config BASE_HEADERS = {'Accept': 'application/json'} MetricsBase = dictmapper('MetricsBase', {'citations': to(['citations'], cleanup._parse_numbers_to_int), 'comments': to(['comments'], cleanup._parse_numbers_to_int), 'html': to(['html'], cleanup._parse_numbers_to_int), 'likes': to(['likes'], cleanup._parse_numbers_to_int), 'pdf': to(['pdf'], cleanup._parse_numbers_to_int), 'readers': to(['readers'], cleanup._parse_numbers_to_int), 'shares': to(['shares'], cleanup._parse_numbers_to_int), 'total': to(['total'], cleanup._parse_numbers_to_int) } ) class Metrics(MetricsBase): def __repr__(self): return """ <%s total:%s readers:%s pdf:%s html:%s comments:%s likes:%s>
# Higher level interface for interacting with specific classes of events import pyalm as alm import cleanup from utils import dictmapper, MappingRule as to ContributorBase = dictmapper('ContributorBase', { 'contributor_role' : ['contributor_role'], 'first_author': to(['first_author'], cleanup._text_to_bool), 'given_name': ['given_name'], 'sequence': ['sequence'], 'surname': ['surname'] } ) class Contributor(ContributorBase): def __repr__(self): return '<%s: %s%s>' % (type(self).__name__, self.given_name, self.surname) CitationBase = dictmapper('CitationBase', { 'article_title' : ['event','article_title'], 'doi' : ['event','doi'], 'fl_count' : to(['event','fl_count'], cleanup._parse_numbers_to_int), 'issn' : ['event','issn'], 'journal_abbreviation' : ['event','journal_abbreviation'], 'journal_title' : ['event','journal_title'], 'publication_type' : ['event','publication_type'],
import requests from utils import dictmapper, MappingRule as to import cleanup import config BASE_HEADERS = {'Accept': 'application/json'} MetricsBase = dictmapper('MetricsBase', {'citations': to(['citations'], cleanup._parse_numbers_to_int), 'comments': to(['comments'], cleanup._parse_numbers_to_int), 'groups': to(['groups'], cleanup._parse_numbers_to_int), 'likes': to(['likes'], cleanup._parse_numbers_to_int), 'pdf': to(['pdf'], cleanup._parse_numbers_to_int), 'shares': to(['shares'], cleanup._parse_numbers_to_int), 'total': to(['total'], cleanup._parse_numbers_to_int) } ) class Metrics(MetricsBase): def __repr__(self): return """ <%s total:%s shares:%s citations:%s comments:%s> """ % (type(self).__name__, self.total, self.shares, self.citations, self.comments)