if (s == "y" or s == "Y"): ## Read all documents for example author, then write to disk if my_auth.read_docs(client): print ("my_auth.doc_list has " + str(len(my_auth.doc_list)) + " items.") my_auth.write_docs() else: print ("Read docs for author failed.") ## Read all documents for example affiliation, then write to disk if my_aff.read_docs(client): print ("my_aff.doc_list has " + str(len(my_aff.doc_list)) + " items.") my_aff.write_docs() else: print ("Read docs for affiliation failed.") ## Initialize author search object and execute search auth_srch = ElsSearch('authlast(keuskamp)','author') auth_srch.execute(client) print ("auth_srch has", len(auth_srch.results), "results.") ## Initialize affiliation search object and execute search aff_srch = ElsSearch('affil(amsterdam)','affiliation') aff_srch.execute(client) print ("aff_srch has", len(aff_srch.results), "results.") ## Initialize doc search object and execute search, retrieving all results doc_srch = ElsSearch('star+trek+vs+star+wars','scopus') doc_srch.execute(client, get_all = True) print ("doc_srch has", len(doc_srch.results), "results.")
# if my_auth.read_docs(client): # print ("my_auth.doc_list has " + str(len(my_auth.doc_list)) + " items.") # my_auth.write_docs() # else: # print ("Read docs for author failed.") # ## Read all documents for example affiliation, then write to disk # if my_aff.read_docs(client): # print ("my_aff.doc_list has " + str(len(my_aff.doc_list)) + " items.") # my_aff.write_docs() # else: # print ("Read docs for affiliation failed.") ## Initialize author search object and execute search # auth_srch = ElsSearch('authlast(keuskamp)','author') # auth_srch.execute(client) # print ("auth_srch has", len(auth_srch.results), "results.") # ## Initialize affiliation search object and execute search # aff_srch = ElsSearch('affil(amsterdam)','affiliation') # aff_srch.execute(client) # print ("aff_srch has", len(aff_srch.results), "results.") ## Initialize doc search object and execute search, retrieving all results doc_srch = ElsSearch('virtual reality', 'scopus') print('searching...') doc_srch.execute(client, get_all=False) print("doc_srch has", len(doc_srch.results), "results.") for doc in doc_srch.results: print(doc)
from elsapy.elssearch import ElsSearch import json from Bio import Entrez ## Load configuration con_file = open("config.json") config = json.load(con_file) con_file.close() ## Initialize client client = ElsClient(config['apikey']) client.inst_token = config['insttoken'] str='SRCTITLE(IEEE Transactions on Pattern Analysis and Machine Intelligence) AND PUBYEAR > 2018 ' myDocSearch=ElsSearch(str, 'scopus') myDocSearch.execute(client, get_all=False) myDocSearch.results pii_doc = FullDoc(sd_pii='0181551220301406') if pii_doc.read(client): print("pii_doc.title: ", pii_doc.title) pii_doc.write() else: print("Read document failed.") str='affil(Public Health and Infection Research Group, Faculty of Health Sciences)' myDocSearch=ElsSearch(str, 'affiliation') myDocSearch.execute(client, get_all=False) myDocSearch.results
string_2 = search_string.search_string_for_references string_2 = 'REF' + '%28' + quote_plus(string_2) + '%29' # Search for publications from this year. If the final search of the year is not exactly at the end of the year, then some publications could be missed. Therefore, we use a different PUBYEAR string in January (month == 1) of the following year (assuming that searches are done at least once per month). if month == 1: year = year - 2 year = 'PUBYEAR > ' + str(year) else: year = 'PUBYEAR = ' + str(year) year = quote_plus(year) encoded_search_string = string_1 + '+OR+' + string_2 + '+AND+' + year # Initialize doc search object and execute search, retrieving <=25 results if # get_all=False or <=5000 results if get_all=True. search = ElsSearch(encoded_search_string, 'scopus') search.execute(client, get_all=True) # Save the results as a new record in the Search table results = search.results source = Source.objects.get(source='Scopus') topic = search_string.topic record = Search( topic=topic, search_string=search_string, source=source, results=results, ) record.save()