Exemple #1
0
def getStudentTTestGroupDBList(group1, group2):
    list_group_queue = []
    try:
        conn = mysql_connect.connect()
        sql = mysql_connect.get_student_ttest_sql_group_select()
        conn.autocommit = True
        cursor = conn.cursor()
        cursor.execute(sql, (group1, group2,))
        
        if cursor :
            for row in cursor:
                group_test_row = Tsparkcore.print_Group_DB(row)
                list_group_queue.append(group_test_row)
                print row
            
    except:
        import traceback
        traceback.print_exc()
        conn.rollback()
    
    finally:
        if cursor :
            cursor.close()
        conn.close()
    return list_group_queue
Exemple #2
0
def saveDescribeAnalysisResultToDB(idKey, uuId, dict_id, result_dict):
    if result_dict is None:
        return
    conn = None
    cursor = None
    try:
        conn = mysql_connect.connect()

        sql = mysql_connect.get_Describe_Analysis_result_sql_replace()
        conn.autocommit = True
        cursor = conn.cursor()

        cursor.execute(
            sql,
            (idKey, uuId, dict_id, result_dict,
             time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))))
        conn.commit()

    except:
        import traceback
        traceback.print_exc()
        if conn:
            conn.rollback()

    finally:
        if cursor:
            cursor.close()
        if conn:
            conn.close()
    return
Exemple #3
0
def saveStudentTtestResultToDB(idKey, uuId, dict_id, result_dict):       
    try:
        conn = mysql_connect.connect()
      
        sql = mysql_connect.get_student_Ttest_result_sql_replace()
        conn.autocommit = True
        cursor = conn.cursor()
        
        cursor.execute(sql, (idKey, 
                             uuId, dict_id,
                             result_dict['group_1_N'], result_dict['group_2_N'], 
                             result_dict['group_1_mean'], result_dict['group_2_mean'], 
                             result_dict['group_1_std'], result_dict['group_2_std'],
                             result_dict['group_1_std_error'],result_dict['group_2_std_error'],
                             result_dict['F'],result_dict['sig'],
                             result_dict['group_equal_t'],result_dict['group_unequal_t'],
                             result_dict['group_equal_free_degree'],result_dict['group_unequal_free_degree'],
                             result_dict['group_equal_p'],result_dict['group_unequal_p'],
                             result_dict['group_equal_mean_error'],result_dict['group_unequal_mean_error'],
                             result_dict['group_equal_std_error'],result_dict['group_unequal_std_error'],
                             result_dict['group_equal_low'],result_dict['group_equal_up'],
                             result_dict['group_unequal_low'],result_dict['group_unequal_up'],
                             time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
                             ))
        conn.commit()
      
    except:
        import traceback
        traceback.print_exc()
        conn.rollback()
    
    finally:
        cursor.close()
        conn.close()
    return 
Exemple #4
0
def getStudentTTestDBAskCalcList():
    list_ask_queue = []
    conn = None
    cursor = None
    try:
        conn = mysql_connect.connect()
        sql = mysql_connect.get_student_ttest_sql_select()
        conn.autocommit = True
        cursor = conn.cursor()
        cursor.execute(sql)
        if cursor : 
            for row in cursor:
                list_ask_queue.append(print_StudentTtest_DB(row))
                print row
            
    except:
        import traceback
        traceback.print_exc()
        if conn :
            conn.rollback()
    
    finally:
        if cursor : 
            cursor.close()
        if conn:
            conn.close()
    return list_ask_queue
Exemple #5
0
def updateDescribeAnalysisStatus(uuID):
    conn = None
    cursor = None
    try:
        conn = mysql_connect.connect()

        sql = mysql_connect.get_Describe_Analysis_update()
        conn.autocommit = True
        cursor = conn.cursor()

        cursor.execute(sql, (time.strftime('%Y-%m-%d %H:%M:%S',
                                           time.localtime(time.time())), uuID))
        conn.commit()

    except:
        import traceback
        traceback.print_exc()
        if conn:
            conn.rollback()

    finally:
        if cursor:
            cursor.close()
        if conn:
            conn.close()
    return
Exemple #6
0
def getDescribeAnalysiscList():
    list_ask_queue = []
    cursor = None
    conn = None
    try:
        conn = mysql_connect.connect()
        sql = mysql_connect.get_describe_analysisc_sql_select()
        conn.autocommit = True
        cursor = conn.cursor()
        cursor.execute(sql)
        if cursor:
            for row in cursor:
                list_ask_queue.append(print_DescribeAnalysis_DB(row))
                print row

    except:
        import traceback
        traceback.print_exc()
        if conn:
            conn.rollback()

    finally:
        if cursor:
            cursor.close()
        if conn:
            conn.close()
    return list_ask_queue
Exemple #7
0
def save_result_db(inputID, result):
    conn = None
    cursor = None
    try:
        conn = mysql_connect.connect()

        sql = mysql_connect.update_math_in_out_sql_result()
        conn.autocommit = True
        cursor = conn.cursor()

        cursor.execute(sql,
                       (result,
                        time.strftime('%Y-%m-%d %H:%M:%S',
                                      time.localtime(time.time())), inputID))
        conn.commit()

    except:
        import traceback
        traceback.print_exc()
        if conn:
            conn.rollback()

    finally:
        if cursor:
            cursor.close()
        if conn:
            conn.close()
    return
Exemple #8
0
def get_math_input_list():
    list_ask_queue = []
    cursor = None
    conn = None
    try:
        conn = mysql_connect.connect()
        sql = mysql_connect.get_math_in_out_sql_list()
        conn.autocommit = True
        cursor = conn.cursor()
        cursor.execute(sql)

        if cursor:
            for row in cursor:
                list_ask_queue.append(print_math_in_DB(row))

    except:
        import traceback
        traceback.print_exc()
        if conn:
            conn.rollback()

    finally:
        if cursor:
            cursor.close()
        if conn:
            conn.close()
    return list_ask_queue
Exemple #9
0
def saveSampleResultToDB(idKey, uuId, dict_id, result_dict):
    if result_dict is None :
        result_dict = {}
        result_dict['N'] = -1, 
        result_dict['mean']= -1, 
        result_dict['stddev']= -1,
        result_dict['stddev_error']= -1,
        result_dict['statistic']= -1,
        result_dict["s_free_degree"]= -1,#s_free_degree
        result_dict['pvalue']= -1,
        result_dict['mean_dev']= -1,
        result_dict['confidence_low']= -1,
        result_dict['confidence_up']= -1,
        result_dict['confidence']= -1,
        result_dict['popmean']= -1,
       
    try:
        conn = mysql_connect.connect()
      
        sql = mysql_connect.get_sample_test_result_sql_replace()
        conn.autocommit = True
        cursor = conn.cursor()
        
        cursor.execute(sql, (idKey, uuId, 
                             dict_id,result_dict['N'], 
                             result_dict['mean'], 
                             result_dict['stddev'],
                             result_dict['stddev_error'],
                             result_dict['statistic'],
                             result_dict["s_free_degree"],#s_free_degree
                             result_dict['pvalue'],
                             result_dict['mean_dev'],
                             result_dict['confidence_low'],
                             result_dict['confidence_up'],
                             result_dict['confidence'],
                             result_dict['popmean'],
                             time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
                             ))
        conn.commit()
      
    except:
        import traceback
        traceback.print_exc()
        conn.rollback()
    
    finally:
        cursor.close()
        conn.close()
    return 
Exemple #10
0
def updateStudentTtestStatus(uuID):
    try:
        conn = mysql_connect.connect()
      
        sql = mysql_connect.get_student_Ttest_update()
        conn.autocommit = True
        cursor = conn.cursor()
        
        cursor.execute(sql, ( time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
                                           uuID)
                             )
        conn.commit()
      
    except:
        import traceback
        traceback.print_exc()
        conn.rollback()
    
    finally:
        cursor.close()
        conn.close()
    return
Exemple #11
0
def getDescribeAnalysisDBList(group):
    list_group_queue = []
    try:
        conn = mysql_connect.connect()
        sql = mysql_connect.get_describe_analysis_sql_group_select()
        conn.autocommit = True
        cursor = conn.cursor()
        cursor.execute(sql, (group, ))

        for row in cursor:
            group_test_row = Tsparkcore.print_Group_DB(row)
            list_group_queue.append(group_test_row)
            print row

    except:
        import traceback
        traceback.print_exc()
        conn.rollback()

    finally:
        cursor.close()
        conn.close()
    return list_group_queue
Exemple #12
0
def getSampleDBAskCalcList():
    list_ask_queue = []
    cursor = None
    try:
        conn = mysql_connect.connect()
        sql = mysql_connect.get_sample_test_sql_select()
        conn.autocommit = True
        cursor = conn.cursor()
        cursor.execute(sql)
        if cursor : 
            for row in cursor:
                list_ask_queue.append(print_Sample_DB(row))
                print row
        print list_ask_queue.__len__()
    except:
        import traceback
        traceback.print_exc()
        conn.rollback()
    
    finally:
        if cursor:
            cursor.close()
        conn.close()
    return list_ask_queue