def create_distribution_records(): """Create dummy distribution records for New England and beyond.""" taxa = { 'Dendrolycopodium dendroideum': 'Lycopodiaceae', 'Vaccinium vitis-idaea': 'Ericaceae' } for scientific_name, family_name in taxa.items(): family = Family(name=family_name) family.save() genus = Genus(name=scientific_name.split(' ')[0], family=family) genus.save() taxon = Taxon(scientific_name=scientific_name, family=family, genus=genus) taxon.save() taxon = Taxon.objects.get(scientific_name='Vaccinium vitis-idaea') synonym = Synonym( scientific_name='Vaccinium vitis-idaea ssp. minus', full_name='Vaccinium vitis-idaea ssp. minus (Lodd.) Hulten', taxon=taxon) synonym.save() # The county (or district) and state will not usually be lowercase, # but the code is case-insensitive to make both the map and data # more resilient. # # Currently, North America distribution data is at the state, # province, or territory level. These records will be present # alongside the New England records. # # format: county, state, present, native distribution_data = { 'Dendrolycopodium dendroideum': [ ('Piscataquis', 'ME', True, True), ('Coos', 'NH', True, True), ('Worcester', 'MA', True, True), ('Kent', 'RI', True, True), ('Orange', 'VT', True, True), ('New London', 'CT', True, True), ('', 'NS', True, True), ('', 'NB', True, True), ('', 'QC', True, True), ('', 'ON', True, True), ('', 'MB', True, True), ('', 'SK', True, True), ('', 'AB', True, True), ('', 'BC', True, True), ('', 'ME', True, True), ('', 'NH', True, True), ('', 'MA', True, True), ('', 'RI', True, True), ('', 'VT', True, True), ('', 'CT', True, True), ('', 'NY', True, True), ('', 'nj', True, True), ('', 'PA', True, True), ('', 'NC', True, True), ], 'Vaccinium vitis-idaea ssp. minus': [ ('Pistcataquis', 'ME', True, True), ('Coos', 'NH', True, True), ('Worcester', 'MA', True, True), ('Kent', 'RI', True, True), ('Orange', 'VT', True, True), ('New London', 'CT', True, True), ('', 'NS', True, True), ('', 'NB', True, True), ('', 'QC', True, True), ('', 'ON', True, True), ('', 'MB', True, True), ('', 'SK', True, True), ('', 'AB', True, True), ('', 'BC', True, True), ('', 'ME', True, True), ('', 'NH', True, True), ('', 'MA', True, True), ('', 'RI', True, True), ('', 'VT', True, True), ('', 'CT', False, False), ('', 'NY', False, False), ('', 'NJ', False, False), ('', 'pa', False, False), ], 'Sambucus nigra': [ ('', 'CT', True, False), ('Fairfield', 'CT', False, False), ('Hartford', 'CT', False, False), ('Litchfield', 'CT', False, False), ('Middlesex', 'CT', False, False), ('New Haven', 'CT', False, False), ('New London', 'CT', False, False), ('Tolland', 'CT', False, False), ('Windham', 'CT', False, False), ], 'Sambucus nigra ssp. canadensis': [ ('', 'CT', True, True), ('Fairfield', 'CT', True, True), ('Hartford', 'CT', True, True), ('Litchfield', 'CT', True, True), ('Middlesex', 'CT', True, True), ('New Haven', 'CT', True, True), ('New London', 'CT', True, True), ('Tolland', 'CT', True, True), ('Windham', 'CT', True, True), ], 'Sambucus nigra ssp. nigra': [ ('', 'CT', True, False), ('Fairfield', 'CT', False, False), ('Hartford', 'CT', False, False), ('Litchfield', 'CT', False, False), ('Middlesex', 'CT', False, False), ('New Haven', 'CT', False, False), ('New London', 'CT', False, False), ('Tolland', 'CT', False, False), ('Windham', 'CT', False, False), ], 'Leptochloa fusca': [ ('', 'MA', True, False), ('Middlesex', 'MA', True, False), ], 'Leptochloa fusca ssp. fascicularis': [ ('', 'CT', True, False), ('Fairfield', 'CT', True, True), ('New Haven', 'CT', True, True), ('New London', 'CT', True, True), ('', 'MA', True, False), ('Barnstable', 'MA', True, True), ('Dukes', 'MA', True, True), ('Franklin', 'MA', True, True), ('Middlesex', 'MA', True, True), ('Nantucket', 'MA', True, True), ('Suffolk', 'MA', True, True), ('Worcester', 'MA', True, True), ('', 'ME', True, False), ('', 'NH', True, False), ('Rockingham', 'NH', True, True), ('', 'RI', True, False), ('Newport', 'RI', True, True), ('Washington', 'RI', True, True), ('', 'VT', True, False), ('Chittenden', 'VT', True, True), ], 'Leptochloa fusca ssp. uninervia': [ ('', 'MA', True, False), ('Middlesex', 'MA', True, False), ], 'Carex arcta': [ ('Piscataquis', 'ME', True, True), ], 'Carex arctata': [ ('Barnstable', 'MA', True, True), ], } for scientific_name, data_list in distribution_data.items(): for entry in data_list: distribution = Distribution(scientific_name=scientific_name, county=entry[0], state=entry[1], present=entry[2], native=entry[3]) distribution.save()
def create_distribution_records(): """Create dummy distribution records for New England and beyond.""" taxa = {'Dendrolycopodium dendroideum': 'Lycopodiaceae', 'Vaccinium vitis-idaea': 'Ericaceae'} for scientific_name, family_name in taxa.items(): family = Family(name=family_name) family.save() genus = Genus(name=scientific_name.split(' ')[0], family=family) genus.save() taxon = Taxon(scientific_name=scientific_name, family=family, genus=genus) taxon.save() taxon = Taxon.objects.get(scientific_name='Vaccinium vitis-idaea') synonym = Synonym(scientific_name='Vaccinium vitis-idaea ssp. minus', full_name='Vaccinium vitis-idaea ssp. minus (Lodd.) Hulten', taxon=taxon) synonym.save() # The county (or district) and state will not usually be lowercase, # but the code is case-insensitive to make both the map and data # more resilient. # # Currently, North America distribution data is at the state, # province, or territory level. These records will be present # alongside the New England records. distribution_data = { 'Dendrolycopodium dendroideum': [ ('Piscataquis', 'ME', 'Species present and not rare'), ('Coos', 'NH', 'Species present and not rare'), ('Worcester', 'MA', 'Species present and not rare'), ('Kent', 'RI', 'Species present in state and native'), ('Orange', 'VT', 'Species present and not rare'), ('New London', 'CT', 'Species present in state and present'), ('', 'NS', 'Species present in state and native'), ('', 'NB', 'Species present in state and native'), ('', 'QC', 'Species present in state and native'), ('', 'ON', 'Species present in state and native'), ('', 'MB', 'Species present in state and native'), ('', 'SK', 'Species present in state and native'), ('', 'AB', 'Species present in state and native'), ('', 'BC', 'Species present in state and native'), ('', 'ME', 'Species present in state and native'), ('', 'NH', 'Species present in state and native'), ('', 'MA', 'Species present in state and native'), ('', 'RI', 'Species present in state and native'), ('', 'VT', 'Species present in state and native'), ('', 'CT', 'Species present in state and native'), ('', 'NY', 'Species present in state and native'), ('', 'nj', 'Species present in state and native'), ('', 'PA', 'Species present in state and native'), ('', 'NC', 'Species present and rare'), ], 'Vaccinium vitis-idaea ssp. minus': [ ('Pistcataquis', 'ME', 'Species present and not rare'), ('Coos', 'NH', 'Species present and not rare'), ('Worcester', 'MA', 'Species present and rare'), ('Kent', 'RI', 'Species not present in state'), ('Orange', 'VT', 'Species present in state and native'), ('New London', 'CT', 'Species present in state and native'), ('', 'NS', 'Species present in state and native'), ('', 'NB', 'Species present in state and native'), ('', 'QC', 'Species present in state and native'), ('', 'ON', 'Species present in state and native'), ('', 'MB', 'Species present in state and native'), ('', 'SK', 'Species present in state and native'), ('', 'AB', 'Species present in state and native'), ('', 'BC', 'Species present in state and native'), ('', 'ME', 'Species present in state and native'), ('', 'NH', 'Species present in state and native'), ('', 'MA', 'Species present and rare'), ('', 'RI', 'Species not present in state'), ('', 'VT', 'Species present and rare'), ('', 'CT', 'Species extirpated (historic)'), ('', 'NY', 'Species not present in state'), ('', 'NJ', 'Species not present in state'), ('', 'pa', 'Species not present in state') ] } for scientific_name, data_list in distribution_data.items(): for entry in data_list: distribution = Distribution(scientific_name=scientific_name, county=entry[0], state=entry[1], status=entry[2]) distribution.save()
def create_distribution_records(): """Create dummy distribution records for New England and beyond.""" taxa = {'Dendrolycopodium dendroideum': 'Lycopodiaceae', 'Vaccinium vitis-idaea': 'Ericaceae'} for scientific_name, family_name in taxa.items(): family = Family(name=family_name) family.save() genus = Genus(name=scientific_name.split(' ')[0], family=family) genus.save() taxon = Taxon(scientific_name=scientific_name, family=family, genus=genus) taxon.save() taxon = Taxon.objects.get(scientific_name='Vaccinium vitis-idaea') synonym = Synonym(scientific_name='Vaccinium vitis-idaea ssp. minus', full_name='Vaccinium vitis-idaea ssp. minus (Lodd.) Hulten', taxon=taxon) synonym.save() # The county (or district) and state will not usually be lowercase, # but the code is case-insensitive to make both the map and data # more resilient. # # Currently, North America distribution data is at the state, # province, or territory level. These records will be present # alongside the New England records. # # format: county, state, present, native distribution_data = { 'Dendrolycopodium dendroideum': [ ('Piscataquis', 'ME', True, True), ('Coos', 'NH', True, True), ('Worcester', 'MA', True, True), ('Kent', 'RI', True, True), ('Orange', 'VT', True, True), ('New London', 'CT', True, True), ('', 'NS', True, True), ('', 'NB', True, True), ('', 'QC', True, True), ('', 'ON', True, True), ('', 'MB', True, True), ('', 'SK', True, True), ('', 'AB', True, True), ('', 'BC', True, True), ('', 'ME', True, True), ('', 'NH', True, True), ('', 'MA', True, True), ('', 'RI', True, True), ('', 'VT', True, True), ('', 'CT', True, True), ('', 'NY', True, True), ('', 'nj', True, True), ('', 'PA', True, True), ('', 'NC', True, True), ], 'Vaccinium vitis-idaea ssp. minus': [ ('Pistcataquis', 'ME', True, True), ('Coos', 'NH', True, True), ('Worcester', 'MA', True, True), ('Kent', 'RI', True, True), ('Orange', 'VT', True, True), ('New London', 'CT', True, True), ('', 'NS', True, True), ('', 'NB', True, True), ('', 'QC', True, True), ('', 'ON', True, True), ('', 'MB', True, True), ('', 'SK', True, True), ('', 'AB', True, True), ('', 'BC', True, True), ('', 'ME', True, True), ('', 'NH', True, True), ('', 'MA', True, True), ('', 'RI', True, True), ('', 'VT', True, True), ('', 'CT', False, False), ('', 'NY', False, False), ('', 'NJ', False, False), ('', 'pa', False, False), ], 'Sambucus nigra': [ ('', 'CT', True, False), ('Fairfield', 'CT', False, False), ('Hartford', 'CT', False, False), ('Litchfield', 'CT', False, False), ('Middlesex', 'CT', False, False), ('New Haven', 'CT', False, False), ('New London', 'CT', False, False), ('Tolland', 'CT', False, False), ('Windham', 'CT', False, False), ], 'Sambucus nigra ssp. canadensis': [ ('', 'CT', True, True), ('Fairfield', 'CT', True, True), ('Hartford', 'CT', True, True), ('Litchfield', 'CT', True, True), ('Middlesex', 'CT', True, True), ('New Haven', 'CT', True, True), ('New London', 'CT', True, True), ('Tolland', 'CT', True, True), ('Windham', 'CT', True, True), ], 'Sambucus nigra ssp. nigra': [ ('', 'CT', True, False), ('Fairfield', 'CT', False, False), ('Hartford', 'CT', False, False), ('Litchfield', 'CT', False, False), ('Middlesex', 'CT', False, False), ('New Haven', 'CT', False, False), ('New London', 'CT', False, False), ('Tolland', 'CT', False, False), ('Windham', 'CT', False, False), ], 'Leptochloa fusca': [ ('', 'MA', True, False), ('Middlesex', 'MA', True, False), ], 'Leptochloa fusca ssp. fascicularis': [ ('', 'CT', True, False), ('Fairfield', 'CT', True, True), ('New Haven', 'CT', True, True), ('New London', 'CT', True, True), ('', 'MA', True, False), ('Barnstable', 'MA', True, True), ('Dukes', 'MA', True, True), ('Franklin', 'MA', True, True), ('Middlesex', 'MA', True, True), ('Nantucket', 'MA', True, True), ('Suffolk', 'MA', True, True), ('Worcester', 'MA', True, True), ('', 'ME', True, False), ('', 'NH', True, False), ('Rockingham', 'NH', True, True), ('', 'RI', True, False), ('Newport', 'RI', True, True), ('Washington', 'RI', True, True), ('', 'VT', True, False), ('Chittenden', 'VT', True, True), ], 'Leptochloa fusca ssp. uninervia': [ ('', 'MA', True, False), ('Middlesex', 'MA', True, False), ], 'Carex arcta': [ ('Piscataquis', 'ME', True, True), ], 'Carex arctata': [ ('Barnstable', 'MA', True, True), ], } for scientific_name, data_list in distribution_data.items(): for entry in data_list: distribution = Distribution(scientific_name=scientific_name, county=entry[0], state=entry[1], present=entry[2], native=entry[3]) distribution.save()