Example #1
0
def launch_UpdData6(request):
    res6 = launch_UpdData.launch_UpdData_constraint_tables(
        'verif_field_mesh',
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests']['Request_field_mesh'],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_field_mesh'])
    return render(request, 'accueil.html', {'res6': res6})
Example #2
0
def launch_UpdData7(request):
    res7 = launch_UpdData.launch_UpdData_constraint_tables(
        'verif_household',
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests']['Request_household'],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_household'])
    return render(request, 'accueil.html', {'res7': res7})
Example #3
0
def launch_UpdData3(request):
    res3 = launch_UpdData.launch_UpdData(
        'verif_type_inductry_sector',
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests']['Request_type_sector'],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_type_sector'])
    return render(request, 'accueil.html', {'res3': res3})
Example #4
0
def launch_UpdData2(request):
    res2 = launch_UpdData.launch_UpdData(
        'verif_urban_project_capacity',
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests']['Request_urban_city'],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_urban_city'])
    return render(request, 'accueil.html', {'res2': res2})
Example #5
0
def launch_UpdData1(request):
    res1 = launch_UpdData.launch_UpdData(
        'verif_nombre_entites',
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests']['Request_count'],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_count'])
    return render(request, 'accueil.html', {'res1': res1})
Example #6
0
def launch_UpdData5(request):
    res5 = launch_UpdData.launch_UpdData(
        'verif_projection',
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests']
        ['Request_projection_verif'],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_projection_verif'])
    return render(request, 'accueil.html', {'res5': res5})
Example #7
0
def launch_UpdData4(request):
    res4 = launch_UpdData.launch_UpdData(
        'verif_invalid_geometry',
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests']
        ['Request_invalid_geometry'],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_invalid_geometry'])
    return render(request, 'accueil.html', {'res4': res4})
Example #8
0
def launch_UpdData8(request):
    res8 = launch_UpdData.launch_UpdData_stat(
        'verif_count_statistics', [
            model_params.MODEL_CONFIG_PARAMS_FUNCTION(
                model_params.MODEL_BDD_PARAMS)['Requests']
            ['Request_count_household'],
            model_params.MODEL_CONFIG_PARAMS_FUNCTION(
                model_params.MODEL_BDD_PARAMS)['Requests']
            ['Request_employment']
        ],
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_into_count_statistics'])
    return render(request, 'accueil.html', {'res8': res8})
Example #9
0
def launch_UpdData_stat(table_to_truncate, requests_list, table_to_insert):
    start_time = time.time()
    #connection to city_context
    connectors = connection()
    cur = connectors[0]
    #connection to verif_shema
    target_cur = connectors[1]
    target_connection = connectors[2]
    #delete all table content
    try:
        target_cur.execute("truncate {0}.count_statistics".format(
            model_params.MODEL_BDD_PARAMS['verif_quality_schema']))
        target_connection.commit()
    except Exception as e:
        print("erreur :" + str(e))
    #execute household request
    arrays_list = []
    for i in requests_list:
        array_values = exec_request(cur, i)
        arrays_list.append(array_values)
        print(arrays_list)
    res_values = np.vstack(arrays_list)
    #insert household request
    insert_into_statistics_table(
        res_values, target_cur,
        model_params.MODEL_CONFIG_PARAMS_FUNCTION(
            model_params.MODEL_BDD_PARAMS)['Requests_params']
        ['Request_insert_into_count_statistics'])
    seven_request_time = time.time()
    res = ("Statistics Request done in %s seconds!" %
           (seven_request_time - start_time))
    #target_connection commit
    target_connection.commit()
    print("commit ok. All data loaded successfully")
    return res