Example #1
0
 def test_load_society_locations(self):
     load_regions(data_path('test_geo.json'))
     load_societies(csv_dict_reader(data_path('societies.csv')))
     res = society_locations(csv_dict_reader(data_path('society_locations.csv')))
Example #2
0
 def test_load_regions(self):
     self.assertEqual(load_regions(data_path('test_geo.json')), 2)
     self.assertEqual(
         GeographicRegion.objects.filter(region_nam='Northern Europe').count(), 1)
Example #3
0
    def setUp(self):
        sources._SOURCE_CACHE = {}
        load_regions(data_path('regions.geojson'))
        load_environmental_var(csv_dict_reader(data_path('envvariables.csv')))
        load_vars(csv_dict_reader(data_path('variables.csv')))
        source_ea = Source.objects.get(name='Ethnographic Atlas')
        load_codes(csv_dict_reader(data_path('codes.csv')))

        family1 = self.set(LanguageFamily, 1, name='family1')
        family2 = self.set(LanguageFamily, 2, name='family2')
        iso_code = self.set(ISOCode, 1, iso_code='abc')
        language1 = self.set(Language,
                             1,
                             name='language1',
                             family=family1,
                             glotto_code='aaaa1234',
                             iso_code=iso_code)
        language2 = self.set(Language,
                             2,
                             name='language2',
                             family=family2,
                             glotto_code='dddd1234')
        language3 = self.set(Language,
                             3,
                             name='language3',
                             family=family2,
                             glotto_code='cccc1234',
                             iso_code=iso_code)
        tree1 = self.set(
            LanguageTree,
            1,
            newick_string='((aaaa1234:1,abc:1,abun1254:1)abun1252:1);',
            name='tree',
            source=source_ea)
        tree2 = self.set(
            LanguageTree,
            2,
            newick_string='((aaaa1234:1,abc:1,abun1254:1)abun1252:1);',
            name='tree.glotto.trees',
            source=source_ea)

        label1 = self.set(LanguageTreeLabels,
                          1,
                          languageTree=tree1,
                          label='aaaa1234',
                          language=language1)
        label2 = self.set(LanguageTreeLabels,
                          2,
                          languageTree=tree1,
                          label='abun1254',
                          language=language2)
        label3 = self.set(LanguageTreeLabels,
                          3,
                          languageTree=tree2,
                          label='abun1252',
                          language=language3)
        tree1.taxa.add(label1)
        tree1.taxa.add(label2)
        tree2.taxa.add(label3)

        society1 = self.set(
            Society,
            1,
            ext_id='society1',
            xd_id='xd1',
            name='Söciety1',
            region=GeographicRegion.objects.get(region_nam='Region1'),
            source=source_ea,
            language=language1,
            focal_year='2016',
            alternate_names='Society 1')
        society2 = self.set(
            Society,
            2,
            ext_id='society2',
            xd_id='xd2',
            region=GeographicRegion.objects.get(region_nam='Region2'),
            name='Society2',
            source=source_ea,
            language=language2)
        # Society 3 has the same language characteristics as society 1
        # but different EA Vars
        self.set(Society,
                 3,
                 ext_id='society3',
                 xd_id='xd1',
                 region=GeographicRegion.objects.get(region_nam='Region1'),
                 name='Society3',
                 source=source_ea,
                 language=language3)

        sequenceLabel1 = self.set(LanguageTreeLabelsSequence,
                                  1,
                                  society=society1,
                                  labels=label1,
                                  fixed_order=0)
        sequenceLabel2 = self.set(LanguageTreeLabelsSequence,
                                  2,
                                  society=society1,
                                  labels=label2,
                                  fixed_order=0)
        sequenceLabel3 = self.set(LanguageTreeLabelsSequence,
                                  3,
                                  society=society2,
                                  labels=label3,
                                  fixed_order=0)
        sequenceLabel4 = self.set(LanguageTreeLabelsSequence,
                                  4,
                                  society=society2,
                                  labels=label3,
                                  fixed_order=1)

        load_data(csv_dict_reader(data_path('data.csv')))
        load_environmental(csv_dict_reader(data_path('envdata.csv')))
Example #4
0
    def setUp(self):
        sources._SOURCE_CACHE = {}
        load_regions(data_path('regions.geojson'))
        load_environmental_var(csv_dict_reader(data_path('envvariables.csv')))
        load_vars(csv_dict_reader(data_path('variables.csv')))
        source_ea = Source.objects.get(name='Ethnographic Atlas')
        load_codes(csv_dict_reader(data_path('codes.csv')))

        family1 = self.set(LanguageFamily, 1, name='family1')
        family2 = self.set(LanguageFamily, 2, name='family2')
        iso_code = self.set(ISOCode, 1, iso_code='abc')
        language1 = self.set(
            Language, 1,
            name='language1', family=family1, glotto_code='aaaa1234', iso_code=iso_code)
        language2 = self.set(
            Language, 2,
            name='language2', family=family2, glotto_code='dddd1234')
        language3 = self.set(
            Language, 3,
            name='language3', family=family2, glotto_code='cccc1234', iso_code=iso_code)    
        tree1 = self.set(
            LanguageTree, 1,
            newick_string='((aaaa1234:1,abc:1,abun1254:1)abun1252:1);',
            name='tree',
            source=source_ea)
        tree2 = self.set(
            LanguageTree, 2,
            newick_string='((aaaa1234:1,abc:1,abun1254:1)abun1252:1);',
            name='tree.glotto.trees',
            source=source_ea)

        label1 = self.set(
            LanguageTreeLabels, 1,
            languageTree=tree1, label='aaaa1234',
            language=language1
        )
        label2 = self.set(
            LanguageTreeLabels, 2, 
            languageTree=tree1, label='abun1254',
            language=language2
        )
        label3 = self.set(
            LanguageTreeLabels, 3,
            languageTree=tree2, label='abun1252',
            language=language3
        )
        tree1.taxa.add(label1)
        tree1.taxa.add(label2)
        tree2.taxa.add(label3)

        society1 = self.set(
            Society, 1,
            ext_id='society1',
            xd_id='xd1',
            name='Söciety1',
            region=GeographicRegion.objects.get(region_nam='Region1'),
            source=source_ea,
            language=language1,
            focal_year='2016',
            alternate_names='Society 1')
        society2 = self.set(
            Society, 2,
            ext_id='society2',
            xd_id='xd2',
            region=GeographicRegion.objects.get(region_nam='Region2'),
            name='Society2',
            source=source_ea,
            language=language2)
        # Society 3 has the same language characteristics as society 1
        # but different EA Vars
        self.set(
            Society, 3,
            ext_id='society3',
            xd_id='xd1',
            region=GeographicRegion.objects.get(region_nam='Region1'),
            name='Society3',
            source=source_ea,
            language=language3)

        sequenceLabel1 = self.set(
            LanguageTreeLabelsSequence, 1,
            society = society1, labels = label1,
            fixed_order=0
        )
        sequenceLabel2 = self.set(
            LanguageTreeLabelsSequence, 2,
            society = society1, labels = label2,
            fixed_order=0
        )
        sequenceLabel3 = self.set(
            LanguageTreeLabelsSequence, 3,
            society = society2, labels = label3,
            fixed_order=0
        )
        sequenceLabel4 = self.set(
            LanguageTreeLabelsSequence, 4,
            society = society2, labels = label3,
            fixed_order=1
        )

        load_data(csv_dict_reader(data_path('data.csv')))
        load_environmental(csv_dict_reader(data_path('envdata.csv')))
Example #5
0
 def test_load_regions(self):
     self.assertEqual(load_regions(data_path('regions.geojson')), 2)
     self.assertEqual(
         GeographicRegion.objects.filter(region_nam='Region1').count(), 1)
Example #6
0
 def test_load_regions(self):
     self.assertEqual(load_regions(data_path('regions.geojson')), 2)
     self.assertEqual(
         GeographicRegion.objects.filter(region_nam='Region1').count(), 1)
Example #7
0
 def test_load_society_locations(self):
     load_regions(data_path('regions.geojson'))
     load_societies(csv_dict_reader(data_path('societies.csv')))
     society_locations(csv_dict_reader(data_path('society_locations.csv')))