Skip to content

Commit

Permalink
Modificação no script que faz o parse das votações para remover o \r\…
Browse files Browse the repository at this point in the history
…n do resumo das mesmas que estava gerando inconsistências no arquivo csv das votações.
  • Loading branch information
tarcisobraz committed Dec 3, 2015
1 parent 2f62d0c commit 4079db5
Show file tree
Hide file tree
Showing 2 changed files with 807 additions and 1,599 deletions.
12 changes: 9 additions & 3 deletions python/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
header = 'tipo,num_pro,ano,id_votacao,resumo,data,hora,objetivo,sessao,nome,id_dep,partido,uf,voto,orientacao_partido,orientacao_gov,cunha'
fileToWrite.write(header + '\n')

total_num_votacoes = 0
for file in files:

try:
xmldoc = minidom.parse(file)
except:
txt = open(file)
if ("xml") not in txt.readline():
print "ERROR: NOT A XML >>> " + file
print "ERROR: NOT AN XML >>> " + file
continue
else:
print "ERROR: >>>" + file
Expand All @@ -46,7 +47,7 @@
to_print.append(ano)

i += 1
resumo = votacao.attributes['Resumo'].value.strip().replace(',','.')
resumo = votacao.attributes['Resumo'].value.strip().replace(',','.').replace("\r\n",'')
data_prop = votacao.attributes['Data'].value.strip()
hora_prop = votacao.attributes['Hora'].value.strip()
objetivo = votacao.attributes['ObjVotacao'].value.strip().replace(',','.')
Expand Down Expand Up @@ -106,5 +107,10 @@
to_print_final = ','.join(to_print + to_print_dep)
fileToWrite.write(to_print_final + "\n")

total_num_votacoes += i

fileToWrite.close()
print "total_num_votacoes: ", total_num_votacoes



fileToWrite.close()
Loading

0 comments on commit 4079db5

Please sign in to comment.