ebird-api-data 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/PKG-INFO +1 -1
  2. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/pyproject.toml +3 -3
  3. ebird_api_data-0.2.2/src/ebird/api/data/__init__.py +1 -0
  4. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/loaders.py +7 -7
  5. ebird_api_data-0.2.2/src/ebird/api/data/migrations/0010_alter_species_category.py +18 -0
  6. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/checklist.py +16 -0
  7. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/species.py +6 -3
  8. ebird_api_data-0.2.1/src/ebird/api/data/__init__.py +0 -1
  9. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/.gitignore +0 -0
  10. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/LICENSE +0 -0
  11. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/README.md +0 -0
  12. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/admin.py +0 -0
  13. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/apps.py +0 -0
  14. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/fields.py +0 -0
  15. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/locale/en/LC_MESSAGES/django.mo +0 -0
  16. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/locale/en/LC_MESSAGES/django.po +0 -0
  17. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/management/__init__.py +0 -0
  18. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/management/commands/__init__.py +0 -0
  19. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/management/commands/add_checklists.py +0 -0
  20. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0001_initial.py +0 -0
  21. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0002_convert_foreign_keys_to_integers.py +0 -0
  22. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0003_make_codes_and_identifiers_primary_keys.py +0 -0
  23. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0004_rename_foreign_keys.py +0 -0
  24. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0005_add_new_foreign_keys.py +0 -0
  25. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0006_set_new_foreign_keys.py +0 -0
  26. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0007_remove_old_fields_and_ids.py +0 -0
  27. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0008_rename_created_checklist_added.py +0 -0
  28. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/0009_add_created_timestamps.py +0 -0
  29. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/migrations/__init__.py +0 -0
  30. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/__init__.py +0 -0
  31. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/country.py +0 -0
  32. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/county.py +0 -0
  33. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/filter.py +0 -0
  34. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/location.py +0 -0
  35. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/observation.py +0 -0
  36. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/observer.py +0 -0
  37. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/models/state.py +0 -0
  38. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/templates/admin/data/species/change_list_object_tools.html +0 -0
  39. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/templates/admin/data/species/fetch_species.html +0 -0
  40. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/templates/data/widgets/translation_field.html +0 -0
  41. {ebird_api_data-0.2.1 → ebird_api_data-0.2.2}/src/ebird/api/data/widgets.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ebird-api-data
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: eBird API Data is a reusable Django app for loading data from eBird into a database.
5
5
  Author-email: Stuart MacKay <smackay@flagstonesoftware.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ebird-api-data"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "eBird API Data is a reusable Django app for loading data from eBird into a database."
5
5
  keywords = ["checklists", "observations", "species", "Django", "eBird", "models"]
6
6
  license = "MIT"
@@ -65,7 +65,7 @@ dev-dependencies = [
65
65
  ]
66
66
 
67
67
  [tool.bumpversion]
68
- current_version = "0.2.1"
68
+ current_version = "0.2.2"
69
69
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
70
70
  serialize = ["{major}.{minor}.{patch}"]
71
71
  ignore_missing_version = false
@@ -97,7 +97,7 @@ search = """
97
97
  replace = """
98
98
  ## Latest
99
99
 
100
- ## {new_version}
100
+ ## {new_version} ({now:%Y-%m-%d})
101
101
  """
102
102
 
103
103
  [[tool.bumpversion.files]]
@@ -0,0 +1 @@
1
+ __version__ = "0.2.2"
@@ -308,10 +308,7 @@ class APILoader:
308
308
  identifier = self.get_observer_identifier(data)
309
309
  observer, created = Observer.objects.get_or_create(
310
310
  identifier=identifier,
311
- defaults={
312
- "name":name,
313
- "original": random_word(8)
314
- }
311
+ defaults={"name": name, "original": random_word(8)},
315
312
  )
316
313
  else:
317
314
  if observer := Observer.objects.filter(original=name).first():
@@ -320,7 +317,7 @@ class APILoader:
320
317
  identifier = self.get_observer_identifier(data)
321
318
  observer, created = Observer.objects.get_or_create(
322
319
  identifier=identifier,
323
- defaults={"name": name, "original":name,}
320
+ defaults={"name": name, "original": name},
324
321
  )
325
322
 
326
323
  if created:
@@ -392,15 +389,18 @@ class APILoader:
392
389
  if duration := data.get("durationHrs"):
393
390
  values["duration"] = int(duration * 60.0)
394
391
 
395
- if data["protocolId"] == "P22":
392
+ if data["protocolId"] == Checklist.Protocol.TRAVELLING.value:
396
393
  # The distance travelled might not be reported.
397
394
  if "effortDistanceKm" in data:
398
395
  dist: str = data["effortDistanceKm"]
399
396
  values["distance"] = round(Decimal(dist), 3)
400
- elif data["protocolId"] == "P23":
397
+ elif data["protocolId"] == Checklist.Protocol.AREA.value:
401
398
  area: str = data["effortAreaHa"]
402
399
  values["area"] = round(Decimal(area), 3)
403
400
 
401
+ if data["protocolId"] not in Checklist.Protocol.values:
402
+ logger.info("New protocol: %s", data["protocolId"])
403
+
404
404
  if "comments" in data:
405
405
  values["comments"] = data["comments"]
406
406
 
@@ -0,0 +1,18 @@
1
+ # Generated by Django 5.2.4 on 2025-07-23 12:44
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('data', '0009_add_created_timestamps'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='species',
15
+ name='category',
16
+ field=models.TextField(blank=True, choices=[('species', 'Species'), ('slash', 'Species pairs'), ('issf', 'Subspecies'), ('domestic', 'Domestic species'), ('hybrid', 'Hybrids'), ('form', 'Species forms'), ('spuh', 'Unidentified species'), ('intergrade', 'Intergrades')], help_text='The category from the eBird/Clements taxonomy.', verbose_name='category'),
17
+ ),
18
+ ]
@@ -3,6 +3,19 @@ from django.utils.translation import gettext_lazy as _
3
3
 
4
4
 
5
5
  class Checklist(models.Model):
6
+ class Protocol(models.TextChoices):
7
+ INCIDENTAL = "P20", _("Incidental")
8
+ STATIONARY = "P21", _("Stationary")
9
+ TRAVELLING = "P22", _("Travelling")
10
+ AREA = "P23", _("Area")
11
+ BANDING = "P33", _("Banding")
12
+ NOCTURNAL = "P54", _("Nocturnal Flight Call Count")
13
+ PELAGIC = "P60", _("Pelagic")
14
+ HISTORICAL = "P62", _("Historical")
15
+ BREEDING_BIRD_ATLAS = "P65", _("Breeding Bird Atlas")
16
+ COMMON_BIRD_SURVEY = "P67", _("Common Bird Survey")
17
+ RAM = "P68", _("RAM--Iberian Seawatch Network")
18
+
6
19
  class Meta:
7
20
  verbose_name = _("checklist")
8
21
  verbose_name_plural = _("checklists")
@@ -116,6 +129,9 @@ class Checklist(models.Model):
116
129
  help_text=_("The code used to identify the protocol."),
117
130
  )
118
131
 
132
+ # Protocol is not used to set the choices, as we still want to load
133
+ # the checklist when a protocol not defined in the class is used.
134
+
119
135
  project_code = models.TextField(
120
136
  blank=True,
121
137
  verbose_name=_("project code"),
@@ -12,11 +12,14 @@ log = logging.getLogger(__name__)
12
12
 
13
13
  class Species(models.Model):
14
14
  class Category(models.TextChoices):
15
- ALL = "", _("All categories")
16
15
  SPECIES = "species", _("Species")
16
+ SLASH = "slash", _("Species pairs")
17
17
  SUBSPECIES = "issf", _("Subspecies")
18
- DOMESTIC = "domestic", _("Domestic")
19
- HYBRID = "hybrid", _("Hybrid")
18
+ DOMESTIC = "domestic", _("Domestic species")
19
+ HYBRID = "hybrid", _("Hybrids")
20
+ FORM = "form", _("Species forms")
21
+ SPUH = "spuh", _("Unidentified species")
22
+ INTERGRADE = "intergrade", _("Intergrades")
20
23
 
21
24
  class Meta:
22
25
  verbose_name = _("species")
@@ -1 +0,0 @@
1
- __version__ = "0.2.1"
File without changes
File without changes