-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrunAll.py
79 lines (46 loc) · 1.78 KB
/
runAll.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 18 11:30:46 2016
@author: Andris Piebalgs
Extract research articles from multiple sources
Science Direct: Max, 200, need API key
PubMed : Max, 1000
Google Scholar: No max
Saves results to CSVs and stores results in RAM
"""
import os
import sys
import configparser
sys.path.append('searchTools')
from googleScholar import googleScholarSearch
from pubmed import pubmedSearch
from science_direct import scienceDirectSearch
# ---------------------------------------------------------------------------
# INPUTS
# ---------------------------------------------------------------------------
search_terms = 'abdominal aortic aneurysm'
numRes = 100;
saveDir = 'testResults2'
# ---------------------------------------------------------------------------
# CHECK
# ---------------------------------------------------------------------------
# Where the API Key is stored
config = configparser.ConfigParser();
config.read('toolbox/keys.ini')
APIKEY = config['Science Direct']['API Key']
# Checking if file exists, creating one if not
if not os.path.exists(saveDir):
os.makedirs(saveDir)
# ---------------------------------------------------------------------------
# SIMULATION ENGINE
# ---------------------------------------------------------------------------
print('Retrieving results from Science Direct')
scienceDirectResults = scienceDirectSearch(search_terms,numRes,APIKEY,saveDir);
SDtitles = scienceDirectResults[0];
SDabstract = scienceDirectResults[1];
print('Retrieving results from PubMed')
pubmedResults = pubmedSearch(search_terms,numRes, saveDir);
PMtitles = pubmedResults[0];
PMabstract = pubmedResults[1];
print('Retrieving results from Google Scholar')
scholarResults = googleScholarSearch(search_terms,numRes,saveDir);