Beispiel #1
0
    def setUp(self):
        self.group, created = Group.objects.get_or_create(
            name=settings.AGREED_TO_TERMS_GROUP)

        self.user = User.objects.create_user(
            self.TEST_USERNAME, self.TEST_EMAIL, self.TEST_PASSWORD)

        # Add the test user to the "agreed to terms" group, so tests can
        # run as if the user already accepted the PlantShare Terms.
        self.group.user_set.add(self.user)

        # Set up test data.

        family = Family(name='TestFamily')
        family.save()
        genus = Genus(name='TestGenus', family=family)
        genus.save()

        taxon = Taxon(scientific_name='Calystegia spithamaea', family=family,
            genus=genus)
        taxon.save()
        common_name = CommonName(common_name='upright false bindweed',
            taxon=taxon)
        common_name.save()
        synonym = Synonym(scientific_name='Convolvulus spithamaeus',
            full_name='Convolvulus spithamaeus L.', taxon=taxon)
        synonym.save()

        conservation_status = ConservationStatus(taxon=taxon, region='CT',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='NH',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='MA',
            allow_public_posting=False)
        conservation_status.save()

        # From a bug fixed with Issue #526: a subsp., but without restriction
        conservation_status = ConservationStatus(taxon=taxon, region='MA',
            variety_subspecies_hybrid='ssp. spithamaea',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='ME',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='RI',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='VT',
            allow_public_posting=False)
        conservation_status.save()
Beispiel #2
0
    def setUp(self):
        self.group, created = Group.objects.get_or_create(
            name=settings.AGREED_TO_TERMS_GROUP)

        self.user = User.objects.create_user(
            self.TEST_USERNAME, self.TEST_EMAIL, self.TEST_PASSWORD)

        # Add the test user to the "agreed to terms" group, so tests can
        # run as if the user already accepted the PlantShare Terms.
        self.group.user_set.add(self.user)

        # Set up test data.

        family = Family(name='TestFamily')
        family.save()
        genus = Genus(name='TestGenus', family=family)
        genus.save()

        taxon = Taxon(scientific_name='Calystegia spithamaea', family=family,
            genus=genus)
        taxon.save()
        common_name = CommonName(common_name='upright false bindweed',
            taxon=taxon)
        common_name.save()
        synonym = Synonym(scientific_name='Convolvulus spithamaeus',
            full_name='Convolvulus spithamaeus L.', taxon=taxon)
        synonym.save()

        conservation_status = ConservationStatus(taxon=taxon, region='CT',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='NH',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='MA',
            allow_public_posting=False)
        conservation_status.save()

        # From a bug fixed with Issue #526: a subsp., but without restriction
        conservation_status = ConservationStatus(taxon=taxon, region='MA',
            variety_subspecies_hybrid='ssp. spithamaea',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='ME',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='RI',
            allow_public_posting=True)
        conservation_status.save()

        conservation_status = ConservationStatus(taxon=taxon, region='VT',
            allow_public_posting=False)
        conservation_status.save()
Beispiel #3
0
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()
Beispiel #4
0
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()
Beispiel #5
0
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()