Example #1
0
    def testBlindUserAggregation(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_blind_user'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_consensus = {x for x in actual['consensus_species']}
        expected_consensus = {'zebra'}

        actual_agg_info = actual['aggregation_info']
        expected_agg_info = {
            'n_species_ids_per_user_max': 1,
            'n_species_ids_per_user_median': 1,
            'n_users_classified_this_subject': 4,
            'n_users_saw_a_species': 3,
            'n_users_saw_no_species': 1,
            'p_users_saw_a_species': '0.75',
            'pielous_evenness_index': '0.00'}
        self.assertEqual(expected_agg_info, actual_agg_info)
        self.assertEqual(actual_consensus, expected_consensus)

        actual_species_aggs = actual['species_aggregations']
        expected_spcies_aggs = {'zebra': {
               'n_users_identified_this_species': 3,
               'p_users_identified_this_species': '1.00',
               'question__count_max': '4',
               'question__count_median': '1',
               'question__count_min': '1',
               'question__standing': '0.33'}}
        self.assertEqual(actual_species_aggs, expected_spcies_aggs)
Example #2
0
    def testNotBlankOn50To50(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_not_blank'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_consensus = {x for x in actual['consensus_species']}

        self.assertNotIn('blank', actual_consensus)
Example #3
0
    def testConsensusFirstOnTie2(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_tie_eland'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_consensus = {x for x in actual['consensus_species']}

        self.assertIn('eland', actual_consensus)
        self.assertEqual(1, len(actual_consensus))
Example #4
0
    def testIsBlank(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_blank'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_consensus = {x for x in actual['consensus_species']}

        self.assertIn('blank', actual_consensus)
        self.assertEqual(1, len(actual_consensus))
Example #5
0
    def testCountAgg(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_count_10'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_species_aggs = actual['species_aggregations']
        expected_spcies_aggs = {'zebra': {
               'n_users_identified_this_species': 4,
               'p_users_identified_this_species': '1.00',
               'question__count_max': '11-50',
               'question__count_median': '10',
               'question__count_min': '9',
               'question__standing': '0.00'}}

        self.assertEqual(actual_species_aggs, expected_spcies_aggs)
Example #6
0
    def testProportionAggPartial(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_prop_025'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_species_aggs = actual['species_aggregations']
        expected_spcies_aggs = {'zebra': {
               'n_users_identified_this_species': 4,
               'p_users_identified_this_species': '1.00',
               'question__count_max': '6',
               'question__count_median': '4',
               'question__count_min': '1',
               'question__standing': '0.25'}}

        self.assertEqual(actual_species_aggs, expected_spcies_aggs)
Example #7
0
    def testStandardAggregation(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_standard'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_consensus = actual['consensus_species'][0]
        actual_agg_info = actual['aggregation_info']
        expected_consensus = 'zebra'
        expected_agg_info = {
            'n_species_ids_per_user_max': 1,
            'n_species_ids_per_user_median': 1,
            'n_users_classified_this_subject': 3,
            'n_users_saw_a_species': 3,
            'n_users_saw_no_species': 0,
            'p_users_saw_a_species': '1.00',
            'pielous_evenness_index': '0.00'}
        self.assertEqual(expected_agg_info, actual_agg_info)
        self.assertEqual(actual_consensus, expected_consensus)
Example #8
0
    def testMulti2SpeciesAggregation(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_multi2'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_consensus = {x for x in actual['consensus_species']}
        expected_consensus = {'zebra', 'elephant'}

        actual_agg_info = actual['aggregation_info']
        expected_agg_info = {
            'n_species_ids_per_user_max': 3,
            'n_species_ids_per_user_median': 2,
            'n_users_classified_this_subject': 3,
            'n_users_saw_a_species': 3,
            'n_users_saw_no_species': 0,
            'p_users_saw_a_species': '1.00',
            'pielous_evenness_index': '0.91'}
        self.assertEqual(expected_agg_info, actual_agg_info)
        self.assertEqual(actual_consensus, expected_consensus)
Example #9
0
    def testMinorityAgg(self):
        actual = aggregate_subject_annotations(
                self.test_subjects['test_minority'],
                self.questions,
                self.question_type_map,
                self.question_main_id)

        actual_species_aggs = actual['species_aggregations']
        expected_spcies_aggs = {'zebra': {
               'n_users_identified_this_species': 2,
               'p_users_identified_this_species': '0.67',
               'question__count_max': '2',
               'question__count_median': '2',
               'question__count_min': '1',
               'question__standing': '0.00'},
               'eland': {
                  'n_users_identified_this_species': 1,
                  'p_users_identified_this_species': '0.33',
                  'question__count_max': '2',
                  'question__count_median': '2',
                  'question__count_min': '2',
                  'question__standing': '0.00'}}

        self.assertEqual(actual_species_aggs, expected_spcies_aggs)