#!/usr/local/bin/python3.1
# -*- coding: utf-8 -*-
from mosaicData import MosaicData
import json

data_filepath = "../data/raw_data/Mosaic 2012.csv"
mapping_filepath = "../data/mapping/2012.csv"
values_filepath = "../data/values.csv"
output_filepath = "../data/output.json"
value_method = 'score'
data_type = 'raw'


mosaic2012 = MosaicData(data_filepath, data_type, mapping_filepath, values_filepath)
results1 = mosaic2012.import_raw_data()
results2 = mosaic2012.convert_to_values(results1, value_method)
results3 = mosaic2012.aggregate_scores(results2, "Municipality")
results4 = mosaic2012.return_json(results3, output_filepath)
#!/usr/local/bin/python3.1
# -*- coding: utf-8 -*-
from mosaicData import MosaicData
import json

data_filepath = "../data/raw_data/Mosaic 2012.csv"
mapping_filepath = "../data/mapping/2012.csv"
values_filepath = "../data/values.csv"
output_filepath = "../data/output.json"
value_method = 'score'
data_type = 'raw'

mosaic2012 = MosaicData(data_filepath, data_type, mapping_filepath,
                        values_filepath)
results1 = mosaic2012.import_raw_data()
results2 = mosaic2012.convert_to_values(results1, value_method)
results3 = mosaic2012.aggregate_scores(results2, "Municipality")
results4 = mosaic2012.return_json(results3, output_filepath)
parser.add_argument('--s', type=str, help="Including this parameter will cause the script to refresh the satisfied indicators data. The parameter should immediately be followed by the file path of the file with the new satisfied indicators data. This file should be a csv in the same format as satisfied.csv.")
parser.add_argument('--d', type=str, help="Including this parameter will cause the script to refresh the dissatisfied indicators data. The parameter should immediately be followed by the file path of the file with the new dissatisfied indicators data. This file should be a csv in the same format as dissatisfied.csv.")
parser.add_argument('--p', type=str, help="Including this parameter will cause the script to refresh the problems data. The parameter should immediately be followed by the file path of the file with the new problems data. This file should be a csv file in the same format as problems.csv.")
parser.add_argument('--w', type=str, help="Including this parameter will cause the script to refresh the standard lists used by the visualization. The parameter should immediately be followed by the file path of the file with the new standard lists. This file should be an xlsx file in the same format as whitelist.xlsx.")
args = parser.parse_args()

# Check at least one parameter is not empty
if not args.s and not args.d and not args.p and not args.w:
    print("At least one parameter is required to run this script. Please type 'python create_data.py -h' for more information.")

else: 
    msg_text = ""

    # Indicators Data Update
    if args.s:
        mosaicS = MosaicData(data_filepath = args.s, data_type = 'consolidated', sat_or_dis = 's')
        mosaicS.import_consolidated_data(tab="satisfied")
        mosaicS.transform_consolidated_data(scalar = 100)
        mosaicS.output_data()
        msg_text = msg_text + "satisfied, "
    
    if args.d: 
        mosaicD = MosaicData(data_filepath = args.d, data_type = 'consolidated', sat_or_dis = 'd')
        mosaicD.import_consolidated_data(tab="dissatisfied")
        mosaicD.transform_consolidated_data(scalar = 100)
        mosaicD.output_data()
        msg_text = msg_text + "dissatisfied, "

    # Problems Data Update
    if args.p:
        mosaicP = MosaicData(data_filepath = args.p, data_type = 'problems')