-
Notifications
You must be signed in to change notification settings - Fork 9
Parser Cei Controller
- Does the parser with the file in the csv format, importing all the data from the open data website of the federal government of Brazil. The data in question is, Data of sanctions suffered from the enterprises, and data from the payments received by the same enterprises in question. These two being two different parser files.
-
def check_nil_ascii( text )
-
Makes sure that there isn't empty ascii characters in the csv file, in the case there is, it return "Não Informado" .
-
def check_date( text )
-
Checks the date, and transforms it to the format date of the ruby language.
-
def import()
-
Imports the parser file from the filesystem of the ruby on rails, and invokes all the methods created that manipulates the data.
-
def build_state( row_data )
-
Creates a classe State and takes the value regarding the state from the file on the row "UF Órgão Sancionador" and puts it on the class created before.
-
def build_sanction_type( row_data )
-
Creates a classe SanctionType and takes the value regarding the Sanction Type from the file on the row "Tipo Sanção" and puts it on the class created before.
-
def build_enterprise( row_data )
-
Creates a classe Enterprise and takes the value regarding the enterprise from the file on the row "Razão Social - Cadastro Receita" and "CPF ou CNPJ do Sancionado" and puts it on the class created before.
-
def build_sanction( row_data, sanction_type, state, enterprise )
-
Takes the value regarding the sanction from the file and puts it on a variable.
-
def check_and_save( c )
-
Checks and save the data from the file.
-
enterprise
-
Stores the enterprise.
-
s
-
Stores the state.
-
s
-
Stores the sanction.
-
e
-
Stores the enterprise .
-
c
-
Stores all the data from the parser.
-
filename
-
Stores the .csv file.
-
sanction_type
-
Stores the sanction type.
-
state
-
Stores the state.