|
@@ -0,0 +1,265 @@
|
|
|
+# Access Scopus database
|
|
|
+#
|
|
|
+
|
|
|
+import requests
|
|
|
+import json
|
|
|
+from my_scopus import MY_API_KEY
|
|
|
+from my_scopus import ak, pdv, ufo, ufo_ips
|
|
|
+
|
|
|
+
|
|
|
+#
|
|
|
+# Get the last N publications of an given author list
|
|
|
+#
|
|
|
+# Arguments: list of scopus author ids (e.g. "35313939900")
|
|
|
+# Returns: list of scopus article ids ('SCOPUS_ID:0037368024')
|
|
|
+# The result can be used in the display functions like get_scopus_brief()
|
|
|
+#
|
|
|
+def get_scopus_list(author_list, opt='', n=5):
|
|
|
+
|
|
|
+ if isinstance(author_list, list):
|
|
|
+ #print "Length of author list %d" % len(author_list)
|
|
|
+ query = ' OR '.join(['AU-ID('+au+')' for au in author_list])
|
|
|
+ else:
|
|
|
+ query = 'AU-ID('+author_list+')'
|
|
|
+
|
|
|
+ if len(opt) > 0:
|
|
|
+ query = query + " AND " + opt
|
|
|
+
|
|
|
+ #print "Query: " + query
|
|
|
+ url = ("http://api.elsevier.com/content/search/scopus?query="
|
|
|
+ +query+ "&field=dc:identifier&count=" + str(n))
|
|
|
+ #print "URL: " + url
|
|
|
+ resp = requests.get(url,
|
|
|
+ headers={'Accept':'application/json',
|
|
|
+ 'X-ELS-APIKey': MY_API_KEY})
|
|
|
+ #print resp
|
|
|
+ results = resp.json()
|
|
|
+ return [[str(r['dc:identifier'])] for r in results['search-results']["entry"]]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+def get_scopus_info(SCOPUS_ID):
|
|
|
+ url = ("http://api.elsevier.com/content/abstract/scopus_id/"
|
|
|
+ + SCOPUS_ID
|
|
|
+ + "?field=article-number,title,publicationName,volume,issueIdentifier,"
|
|
|
+ + "prism:pageRange,coverDate,article-number,doi,citedby-count,prism:aggregationType,url,identifier,description,authors,prism:issn")
|
|
|
+ #print url
|
|
|
+ resp = requests.get(url,
|
|
|
+ headers={'Accept':'application/json',
|
|
|
+ 'X-ELS-APIKey': MY_API_KEY})
|
|
|
+ results = json.loads(resp.text.encode('utf-8'))
|
|
|
+ #print resp
|
|
|
+ print results
|
|
|
+
|
|
|
+ fstring = '{authors}, {title}, {journal}, {volume}, {articlenum}, ({date}). {doi} (cited {cites} times).\n{abstract}\n\n'
|
|
|
+
|
|
|
+ return fstring.format(authors=', '.join([au['ce:indexed-name'] for au in results['abstracts-retrieval-response']['authors']['author']]),
|
|
|
+ title=results['abstracts-retrieval-response']['coredata']['dc:title'].encode('utf-8'),
|
|
|
+ journal=results['abstracts-retrieval-response']['coredata']['prism:publicationName'].encode('utf-8'),
|
|
|
+ volume=results['abstracts-retrieval-response']['coredata']['prism:volume'].encode('utf-8'),
|
|
|
+ articlenum=(results['abstracts-retrieval-response']['coredata'].get('prism:pageRange') or
|
|
|
+ results['abstracts-retrieval-response']['coredata'].get('article-number')).encode('utf-8'),
|
|
|
+ date=results['abstracts-retrieval-response']['coredata']['prism:coverDate'].encode('utf-8'),
|
|
|
+ doi='doi:' + results['abstracts-retrieval-response']['coredata']['prism:doi'].encode('utf-8'),
|
|
|
+ cites=int(results['abstracts-retrieval-response']['coredata']['citedby-count'].encode('utf-8')),
|
|
|
+ abstract=results['abstracts-retrieval-response']['coredata']['dc:description'].encode('utf-8'))
|
|
|
+
|
|
|
+
|
|
|
+#
|
|
|
+# Display a list of publications in plain text format
|
|
|
+#
|
|
|
+# Argement: scopus id of the publication
|
|
|
+#
|
|
|
+# Todo: Implement other formats (e.g. html, bibtex)
|
|
|
+# Format publications as articles, Title, Abstract
|
|
|
+#
|
|
|
+def get_scopus_brief(SCOPUS_ID, max_authors=1000):
|
|
|
+ id = SCOPUS_ID
|
|
|
+ if isinstance(id, list):
|
|
|
+ id = id[0]
|
|
|
+
|
|
|
+ url = ("http://api.elsevier.com/content/abstract/scopus_id/"
|
|
|
+ + id
|
|
|
+ + "?field=authors,article-number,title,publicationName,volume,issueIdentifier,"
|
|
|
+ + "prism:pageRange,coverDate,article-number,doi,citedby-count,prism:aggregationType,url,identifier,description,prism:issn")
|
|
|
+
|
|
|
+ #print url
|
|
|
+ resp = requests.get(url,
|
|
|
+ headers={'Accept':'application/json',
|
|
|
+ 'X-ELS-APIKey': MY_API_KEY})
|
|
|
+ results = json.loads(resp.text.encode('utf-8'))
|
|
|
+ #print resp
|
|
|
+ #print results
|
|
|
+
|
|
|
+ coredata = results['abstracts-retrieval-response']['coredata']
|
|
|
+
|
|
|
+ pub = ''
|
|
|
+ authors = results['abstracts-retrieval-response']['authors']['author']
|
|
|
+ #print "Number of authors: %d" %len(authors)
|
|
|
+
|
|
|
+ if len(authors) > max_authors:
|
|
|
+ return ''
|
|
|
+
|
|
|
+ if len(authors) > 20:
|
|
|
+ pub = pub + authors[0]['ce:indexed-name'] + ' et.al.: '
|
|
|
+ else:
|
|
|
+ pub = ', '.join([au['ce:indexed-name'] for au in authors]) + ': '
|
|
|
+
|
|
|
+ try:
|
|
|
+ if coredata.get('dc:title'):
|
|
|
+ pub = pub + coredata.get('dc:title').encode('utf-8')
|
|
|
+ except ValueError:
|
|
|
+ print "!!! Error encoding title of publication !!!"
|
|
|
+ #print coredata.get('dc:title')
|
|
|
+ pub = pub + coredata.get('dc:title')
|
|
|
+
|
|
|
+ if coredata.get('prism:publicationName'):
|
|
|
+ pub = pub + ', ' + coredata.get('prism:publicationName').encode('utf-8')
|
|
|
+
|
|
|
+ if coredata.get('prism:volume'):
|
|
|
+ pub = pub + ', ' + coredata.get('prism:volume').encode('utf-8')
|
|
|
+
|
|
|
+ if coredata.get('prism:issueIdentifier'):
|
|
|
+ pub = pub + ', ' + coredata.get('prism:issueIdentifier').encode('utf-8')
|
|
|
+
|
|
|
+ if coredata.get('prism:coverDate'):
|
|
|
+ pub = pub + ' (' + coredata.get('prism:coverDate').encode('utf-8') + ') '
|
|
|
+
|
|
|
+ if coredata.get('prism:pageRange'):
|
|
|
+ pub = pub + coredata.get('prism:pageRange').encode('utf-8')
|
|
|
+ elif coredata.get('article-number'):
|
|
|
+ pub = pub + coredata.get('article-number').encode('utf-8')
|
|
|
+
|
|
|
+ if coredata.get('prism:doi'):
|
|
|
+ pub = pub + ', doi:' + coredata.get('prism:doi').encode('utf-8')
|
|
|
+
|
|
|
+ if coredata.get('citedby-count'):
|
|
|
+ pub = pub + ' (cited ' + coredata.get('citedby-count').encode('utf-8') + ' times)'
|
|
|
+
|
|
|
+ pub = pub + '.\n'
|
|
|
+
|
|
|
+
|
|
|
+ return pub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+# What kind of lists are interesting for a group website?
|
|
|
+
|
|
|
+
|
|
|
+# Organisation:
|
|
|
+#
|
|
|
+# Latest publications | Contact person
|
|
|
+# List of 3-5 with titles first
|
|
|
+# First lines of the abtract | Events:
|
|
|
+# Number of citations | Upcoming event
|
|
|
+# (Blog format)
|
|
|
+#
|
|
|
+# Lately cited papers | Featured publications
|
|
|
+# List of 3-5 papers updated cites|
|
|
|
+# in the last N month
|
|
|
+# Format: Blog
|
|
|
+#
|
|
|
+#
|
|
|
+
|
|
|
+# List of the latest N publications (N = 3-5)
|
|
|
+# List of the latest publications without big collaboration papers?
|
|
|
+# List of collaboration papers
|
|
|
+# List of publication of the last N month (N = 6-12)
|
|
|
+# List split by sub groups
|
|
|
+
|
|
|
+# List of all publication of one year, that can be selected
|
|
|
+# List of featured publications (selected by a list of Scopus-Ids / or Blog with Scopus-Id)
|
|
|
+
|
|
|
+
|
|
|
+# Problem: If the people are in too many differnent projects
|
|
|
+# How to list only this ones of a certain topic?
|
|
|
+# Is there a subgroup, that is only involved in one project?
|
|
|
+# Try: Leave out ak, csa, we, baumbach, etc?
|
|
|
+
|
|
|
+
|
|
|
+#print "LUMINEU 0\u03bd2\u03b2 project".encode('utf-8')
|
|
|
+
|
|
|
+
|
|
|
+# get number of publications?
|
|
|
+# order by date?
|
|
|
+# limit to certain interval
|
|
|
+
|
|
|
+
|
|
|
+#
|
|
|
+# Save publications with their number of citations in JSON file of SQLITE database?!
|
|
|
+# List of newly cited publications
|
|
|
+#
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+resp = requests.get("http://api.elsevier.com/content/author?author_id="+ak+"&view=metrics",
|
|
|
+ headers={'Accept':'application/json',
|
|
|
+ 'X-ELS-APIKey': MY_API_KEY})
|
|
|
+
|
|
|
+#print resp
|
|
|
+
|
|
|
+#print json.dumps(resp.json(),
|
|
|
+# sort_keys=True,
|
|
|
+# indent=4, separators=(',', ': '))
|
|
|
+
|
|
|
+
|
|
|
+#print get_scopus_info('SCOPUS_ID:0037368024')
|
|
|
+
|
|
|
+#publist = get_scopus_list(ak)
|
|
|
+#publist = get_scopus_list([ak,ak2], 'PUBYEAR = 2014', 30)
|
|
|
+
|
|
|
+#publist = get_scopus_list(pdv, 'PUBYEAR = 2015', 30)
|
|
|
+
|
|
|
+#publist = get_scopus_list(ufo_ipe, 'PUBYEAR = 2015', 30)
|
|
|
+#publist = get_scopus_list(ufo_ips, 'PUBYEAR = 2015', 30)
|
|
|
+
|
|
|
+# Exclude authors?
|
|
|
+publist = get_scopus_list(pdv, 'NOT AU-ID(7006284555)', 10)
|
|
|
+
|
|
|
+
|
|
|
+# Author ausschliessen - black list !!!
|
|
|
+
|
|
|
+
|
|
|
+#
|
|
|
+# Display the result
|
|
|
+#
|
|
|
+print "Number of publications: %d" % len(publist)
|
|
|
+
|
|
|
+for pub in publist:
|
|
|
+ print get_scopus_brief(pub,10000)
|
|
|
+
|
|
|
+
|
|
|
+# Test printing functions
|
|
|
+
|
|
|
+#print publist[2][0]
|
|
|
+#print get_scopus_info('SCOPUS_ID:0037368024')
|
|
|
+#print get_scopus_info(publist[2][0])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+# Merge publications
|
|
|
+# Search for all publications? Elimintate dublicates
|
|
|
+# Format abstract
|
|
|
+#
|
|
|
+# There seem to be also preformatted output?
|
|
|
+# Is output in BibTeX possible?
|
|
|
+#
|
|
|
+# Impact-Factor of the journal?
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+# Queries:
|
|
|
+
|
|
|
+# List all publications
|
|
|
+# List the lastest publications
|
|
|
+# List list publications of the group wo double entries
|
|
|
+# List latest pubs
|
|
|
+# List publication with higest citation count
|
|
|
+# List publication in magazines with highest impact value
|
|
|
+# Print collaborator network of institutions
|
|
|
+# Print list of collaborations wo large collabs
|
|
|
+
|
|
|
+#
|
|
|
+
|