# These lines are needed so that this file can be run from the terminal
import os, sys

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

from mvp_individual_user_performance_datamv import collate_individual_user_results
from pybossautils import prolific_academic_ids
import numpy as np
import statsmodels.api as sm


if __name__ == "__main__":

    # Retrieve all individual user's statistical measure results
    all_project_results = collate_individual_user_results()

    list_of_f_measures = []
    list_of_sensitivity_values = []
    list_of_specificity_values = []
    list_of_accuracy_values = []
    list_of_precision_values = []
    list_of_kappa_values = []
    list_of_annotation_indicators = []
    list_of_feedback_indicators = []
    list_of_interaction_indicators = []
    list_of_prolific_academic_indicators = []

    # Make sure 4b and 4c are commented out in the project_results!!
    for project_results in all_project_results:
        for dictionary in project_results:
#### This code is used to test whether there are significant differences in the distribution of each of the statistical measures between two Trailblazer projects
#### It is a non-parametric test
#### You need to uncomment the projects of interest in the project_configuration list in the pybossautils.py file
#### You also need to ensure the collate_individual_user_results function within the mvp_individual_user_performance_datamv.py file is set to run and not export to csv!

# These lines are needed so that this file can be run from the terminal
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

from mvp_individual_user_performance_datamv import collate_individual_user_results

import numpy as np
import scipy.stats as stats

all_performance_data = collate_individual_user_results()


statistics = ["accuracy", "sensitivity", "specificity", "precision", "f-measure", "kappa"]

for statistic in statistics:
    overall_project_data = list()

    for trailblazer_iteration_data in all_performance_data:
        project_level_data = list()

        for user_performance_dictionary in trailblazer_iteration_data:
            statistical_measure_data = user_performance_dictionary[statistic]
            project_level_data.append(statistical_measure_data)
        overall_project_data.append(project_level_data)