def drawFromDatabase(): # Get the results from the database succ_rate = open("database/completion_time.sql", "r") sql_sr = succ_rate.read() rows = db.selectFromDB(sql_sr) # [group, task, time] # Add 'OVERALL' overall = [[row[0], 'OVERALL', row[2]] for row in rows] rowsAndOverall = rows + overall # Transform to correct format groups = ["NOHINT", "SPECIFICHINT", "GENERICHINT", "ADVERSARIALHINT"] tasks = [1, 2, 3, 4, 'OVERALL'] for row in rowsAndOverall: print(row) # Group by task/group data = rowsToNestedData(rowsAndOverall, groups, tasks) print(data) # Plot data drawTaskCompletionTimeChart(data)
def renderFromDatabase(): # Get the results from the database succ_rate = open("database/success_per_group_per_task.sql", "r") sql_sr = succ_rate.read() rows = db.selectFromDB(sql_sr) # Transform to correct format groups = ["NOHINT", "SPECIFICHINT", "GENERICHINT", "ADVERSARIALHINT"] tasks = [1, 2, 3, 4] # 0: Overall # Group by task/group data = db.rowsToNestedData(rows, groups, tasks) # Plot data drawSuccessPerGroupPerTask(data)
def drawDifficultyChart(): # Get the results from the database succ_rate = open("database/difficulty.sql", "r") sql_sr = succ_rate.read() rows = db.selectFromDB(sql_sr) # [participant_type, score, count] groups = ["NOHINT", "SPECIFICHINT", "GENERICHINT", "ADVERSARIALHINT"] scores = ['1', '2', '3', '4', '5'] # Flip the columns to [score, participant_type, count] groupedCount = db.rowsToNestedData([[row[1], row[0], row[2]] for row in rows], scores, groups) groupsLabels = ["No tip", "Specific tip", "Generic tip", "Adversarial tip"] scoreLabels = [ "Very difficult", "Difficult", "So and so", "Easy", "Extremely Easy" ] drawStackedBarChart(groupedCount, groupsLabels, scoreLabels, "")
def drawUsefulnessChart(): # Get the results from the database succ_rate = open("database/usefulness.sql", "r") sql_sr = succ_rate.read() rows = db.selectFromDB(sql_sr) # [participant_type, score, count] groups = ["SPECIFICHINT", "GENERICHINT", "ADVERSARIALHINT"] scores = ['1', '2', '3', '4', '5'] # Flip the columns to [score, participant_type, count] groupedCount = db.rowsToNestedData([[row[1], row[0], row[2]] for row in rows], scores, groups) groupsLabels = ["Specific tip", "Generic tip", "Adversarial tip"] scoreLabels = [ "Detrimental", "Distracting", "Not really", "Useful", "Extremely Useful" ] drawStackedBarChart(groupedCount, groupsLabels, scoreLabels, "")
def renderFromDatabase(): # Get the results from the database succ_rate = open("database/success_rate.sql", "r") sql_sr = succ_rate.read() rows = db.selectFromDB(sql_sr) # Transform to correct format groups = ["NOHINT", "SPECIFICHINT", "GENERICHINT", "ADVERSARIALHINT"] tasks = [1, 2, 3, 4, 0] # 0: Overall # Map to separate mean/variance lists [group, task, mean/var] means = [[row[0], row[1], row[3]] for row in rows] variances = [[row[0], row[1], row[2]] for row in rows] # Group by task/group meansGrouped = db.rowsToNestedData(means, groups, tasks) variancesGrouped = db.rowsToNestedData(variances, groups, tasks) # Plot data drawAverageTaskSuccessRateChart(meansGrouped, variancesGrouped)