Skip to content
Snippets Groups Projects
Commit a530d8dd authored by Cristian Weiland's avatar Cristian Weiland
Browse files

Issue #41: Improve script to insert data


Signed-off-by: default avatarCristian Weiland <cw14@inf.ufpr.br>
parent 256c636d
No related branches found
No related tags found
No related merge requests found
......@@ -7,20 +7,33 @@
# - Filter: An array of n values, that will create n indexes in ElasticSearch, each one filtering data from Portal Transparencia using its corresponding string. Ex: "UNIVERSIDADE FEDERAL DO PARANA"
# - University: An array of n values, with n being the same n as Filter's array. This array should contain the initials from Universities declared in Filter array, in the same order.
if [ "$#" -ne 4 ]; then
echo "Usage: $0 <year> <month> <user> <password>"
echo "Example: $0 2016 12 myuser mypass"
if [[ "$#" -ne 5 || "$1" == "-help" || "$1" == "--help" ]]; then
echo " Usage: $0 <year> <month> <user> <password> <insertions>"
echo " Insertions must be one between: expenses, travel_allowances, workers, ministry_of_health, all"
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# First, insert Expenses data.
(cd expenses && ./insert_expenses.sh $1 $2 $3 $4)
if [[ "$5" == "all" || "$5" == "expenses" ]]; then
# First, insert Expenses data.
echo "Inserting Expenses from ${1}-${2}..."
(cd expenses && ./insert_expenses.sh $1 $2 $3 $4)
fi
# We should now insert Travel allowance data.
(cd travel_allowances && ./insert_travel_allowances.sh $1 $2 $3 $4)
if [[ "$5" == "all" || "$5" == "travel_allowances" ]]; then
# We should now insert Travel allowance data.
echo "Inserting Travel Allowances from ${1}-${2}..."
(cd travel_allowances && ./insert_travel_allowances.sh $1 $2 $3 $4)
fi
# Now, insert Workers data.
(cd workers && ./insert_register_payment.sh $1 $2 $3 $4)
if [[ "$5" == "all" || "$5" == "workers" ]]; then
# Now, insert Workers data.
echo "Inserting Workers from ${1}-${2}..."
(cd workers && ./insert_register_payment.sh $1 $2 $3 $4)
fi
# Last but not least, insert data from Health Ministry.
(cd ministry_of_health && ./insert_ministry_of_health.sh $1 $2 $3 $4)
if [[ "$5" == "all" || "$5" == "ministry_of_health" ]]; then
# Last but not least, insert data from Health Ministry.
echo "Inserting data from Ministry Of Health from ${1}-${2}..."
(cd ministry_of_health && ./insert_ministry_of_health.sh $1 $2 $3 $4)
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment