-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (44 loc) · 2.05 KB
/
main.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
from normalizer import normalizer
from reader import htmlInfos
from transcriber import insertData
from analyzer import parsePublication
import argparse
def main():
parser = argparse.ArgumentParser(description='PONDOC')
parser.add_argument('-y','--year', type=str, help='ex: "2017" or "2021-2024"')
parser.add_argument('-f','--file', type=str, default='default.xlsx', help="file's name + .xlsx")
args = parser.parse_args()
anos = args.year
file = args.file
if len(str(anos))==4: period = [str(anos)]*2
elif len(anos)==9: period = anos.split('-')
resultsJournals, resultsConferences = [], []
rJauthorsnorm, rCauthorsnorm, discauthorsJ, discauthorsC= [], [], [], []
for ano in range(int(period[0]), int(period[1])+1):
infosp = htmlInfos(str(f'https://eic.cefet-rj.br/lattes/ppcic-{ano}/PB0-0.html'))
infosa = htmlInfos(str(f'https://eic.cefet-rj.br/lattes/ppcic-{ano}/PB7-0.html'))
infosc = htmlInfos(str(f'https://eic.cefet-rj.br/lattes/ppcic-{ano}/PB4-0.html'))
print(f'Tratando dados de Periodicos - {ano}')
for i in infosp:
result = parsePublication(i.upper())
resultsJournals.append(result)
doc, dis = normalizer(result[0])
rJauthorsnorm.append(doc)
discauthorsJ.append(dis)
print(f'Tratando dados de Publicações Aceitas - {ano}')
for i in infosa:
result = parsePublication(i.upper())
resultsJournals.append(result)
doc, dis = normalizer(result[0])
rJauthorsnorm.append(doc)
discauthorsJ.append(dis)
print(f'Tratando dados de Conferência - {ano}')
for i in infosc:
result = parsePublication(i.upper())
resultsConferences.append(result)
doc, dis = normalizer(result[0])
rCauthorsnorm.append(doc)
discauthorsC.append(dis)
print('Inserindo dados...')
insertData(period, file, rJauthorsnorm, resultsJournals, discauthorsJ, rCauthorsnorm, resultsConferences, discauthorsC)
main()