Esempio n. 1
0
def proc_data_dash(request):
    passed_data_name = request.session.get('passed_data_name')
    up_data = DataDescriberUI()
    up_data.read_dataset_from_csv(passed_data_name)
    up_data.get_dataset_meta_info()
    up_data.get_json_data()

    json_header = []
    att_list = up_data.dataset_description['meta']['attribute_list']
    for i in range(len(att_list)):
        json_header.append({"data": str(att_list[i])})

    request.session['passed_json_columns'] = json_header
    request.session['passed_column_name'] = att_list

    json_cate_info = wrapper.get_dataset_info(passed_data_name + ".csv")
    cat_att_list = json_cate_info["categorical_attributes"]

    data_type_list = []
    for i in att_list:
        data_type_list.append(json_cate_info["attribute_datatypes"][i])
    tuple_n = json_cate_info["number_of_tuples"]

    context = {
        'passed_data_name': passed_data_name,
        "passed_json_columns": json_header,
        "passed_column_name": att_list,
        "passed_cat_atts": cat_att_list,
        "passed_att_types": data_type_list,
        "tuple_n": tuple_n
    }

    return render(request, "synthesizer/proc_data_dash.html", context)
Esempio n. 2
0
def proc_data_dash(request):
    passed_data_name = request.session.get('passed_data_name')
    json_cate_info = wrapper.get_dataset_info(passed_data_name + ".csv")
    att_list = json_cate_info["attribute_list"]
    cat_att_list = json_cate_info["categorical_attributes"]
    key_att_list = json_cate_info['candidate_attributes']
    # json_header = []
    # for i in range(len(att_list)):
    #     json_header.append({"data": str(att_list[i])})
    # initialize json data and header for dataTables
    json_data_table = []
    json_header_table = []
    for i in range(len(att_list)):
        json_data_table.append({"data": str(att_list[i])})
        json_header_table.append({"title": str(att_list[i]), "targets": i})

    request.session['passed_json_columns'] = json_data_table
    request.session['passed_column_name'] = att_list

    data_type_list = []
    for i in att_list:
        data_type_list.append(json_cate_info["attribute_datatypes"][i])
    tuple_n = json_cate_info["number_of_tuples"]

    context = {'passed_data_name': passed_data_name, "passed_json_columns": json_data_table,
               "passed_column_name": att_list, "passed_json_columns_header": json_header_table,
               "passed_cat_atts": cat_att_list, "passed_att_types": data_type_list, "tuple_n": tuple_n,
               "passed_key_atts": key_att_list}

    return render(request, "synthesizer/proc_data_dash.html", context)