ebird-api-data 0.3.1__tar.gz → 0.3.3__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.
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/PKG-INFO +1 -1
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/pyproject.toml +2 -2
- ebird_api_data-0.3.3/src/ebird/api/data/__init__.py +1 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/admin.py +13 -1
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/loaders.py +6 -7
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/migrations/0001_initial.py +1 -1
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/checklist.py +6 -1
- ebird_api_data-0.3.1/src/ebird/api/data/__init__.py +0 -1
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/.gitignore +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/LICENSE +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/README.md +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/apps.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/fields.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/locale/en/LC_MESSAGES/django.mo +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/locale/en/LC_MESSAGES/django.po +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/management/__init__.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/management/commands/__init__.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/management/commands/add_checklists.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/migrations/__init__.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/__init__.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/country.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/county.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/filter.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/location.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/observation.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/observer.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/species.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/models/state.py +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/templates/admin/data/species/change_list_object_tools.html +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/templates/admin/data/species/fetch_species.html +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/templates/data/widgets/translation_field.html +0 -0
- {ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/widgets.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebird-api-data"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.3"
|
|
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.3.
|
|
68
|
+
current_version = "0.3.3"
|
|
69
69
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
70
70
|
serialize = ["{major}.{minor}.{patch}"]
|
|
71
71
|
ignore_missing_version = false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.3"
|
|
@@ -13,7 +13,7 @@ from django.views import generic
|
|
|
13
13
|
from . import models
|
|
14
14
|
from .fields import TranslationCharField, TranslationTextField
|
|
15
15
|
from .loaders import APILoader
|
|
16
|
-
from .models import Observation, Species
|
|
16
|
+
from .models import Observation, Species, Checklist
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class ObservationInline(admin.TabularInline):
|
|
@@ -44,6 +44,17 @@ class ObservationInline(admin.TabularInline):
|
|
|
44
44
|
.order_by("species__taxon_order")
|
|
45
45
|
)
|
|
46
46
|
|
|
47
|
+
class ProtocolListFilter(admin.SimpleListFilter):
|
|
48
|
+
title = _("protocol")
|
|
49
|
+
parameter_name = "protocol_code"
|
|
50
|
+
|
|
51
|
+
def lookups(self, request, model_admin):
|
|
52
|
+
return Checklist.Protocol.choices
|
|
53
|
+
|
|
54
|
+
def queryset(self, request, queryset):
|
|
55
|
+
if value := self.value():
|
|
56
|
+
return queryset.filter(protocol_code=value)
|
|
57
|
+
|
|
47
58
|
|
|
48
59
|
@admin.register(models.Checklist)
|
|
49
60
|
class ChecklistAdmin(admin.ModelAdmin):
|
|
@@ -55,6 +66,7 @@ class ChecklistAdmin(admin.ModelAdmin):
|
|
|
55
66
|
"location",
|
|
56
67
|
"observer",
|
|
57
68
|
)
|
|
69
|
+
list_filter = [ProtocolListFilter]
|
|
58
70
|
ordering = ("-started",)
|
|
59
71
|
search_fields = ("identifier", "location__name", "observer__name")
|
|
60
72
|
autocomplete_fields = ("location", "observer")
|
|
@@ -8,6 +8,7 @@ import string
|
|
|
8
8
|
import time
|
|
9
9
|
|
|
10
10
|
from decimal import Decimal
|
|
11
|
+
from functools import cache
|
|
11
12
|
from typing import List, Optional
|
|
12
13
|
from urllib.error import HTTPError, URLError
|
|
13
14
|
|
|
@@ -389,13 +390,10 @@ class APILoader:
|
|
|
389
390
|
if duration := data.get("durationHrs"):
|
|
390
391
|
values["duration"] = int(duration * 60.0)
|
|
391
392
|
|
|
392
|
-
if data
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
values["distance"] = round(Decimal(dist), 3)
|
|
397
|
-
elif data["protocolId"] == Checklist.Protocol.AREA.value:
|
|
398
|
-
area: str = data["effortAreaHa"]
|
|
393
|
+
if dist := data.get("effortDistanceKm"):
|
|
394
|
+
values["distance"] = round(Decimal(dist), 3)
|
|
395
|
+
|
|
396
|
+
if area := data.get("effortAreaHa"):
|
|
399
397
|
values["area"] = round(Decimal(area), 3)
|
|
400
398
|
|
|
401
399
|
if data["protocolId"] not in Checklist.Protocol.values:
|
|
@@ -411,6 +409,7 @@ class APILoader:
|
|
|
411
409
|
|
|
412
410
|
return checklist
|
|
413
411
|
|
|
412
|
+
@cache
|
|
414
413
|
def fetch_subregions(self, region: str) -> List[str]:
|
|
415
414
|
region_types: list = ["subnational1", "subnational2", None]
|
|
416
415
|
levels: int = len(region.split("-", 2))
|
|
@@ -130,7 +130,7 @@ class Migration(migrations.Migration):
|
|
|
130
130
|
('protocol_code', models.TextField(blank=True, help_text='The code used to identify the protocol.', verbose_name='protocol code')),
|
|
131
131
|
('project_code', models.TextField(blank=True, help_text='The code used to identify the project (portal).', verbose_name='project code')),
|
|
132
132
|
('duration', models.IntegerField(blank=True, help_text='The number of minutes spent counting.', null=True, verbose_name='duration')),
|
|
133
|
-
('distance', models.DecimalField(blank=True, decimal_places=3, help_text='The distance, in
|
|
133
|
+
('distance', models.DecimalField(blank=True, decimal_places=3, help_text='The distance, in kilometres, covered while travelling.', max_digits=6, null=True, verbose_name='distance')),
|
|
134
134
|
('area', models.DecimalField(blank=True, decimal_places=3, help_text='The area covered, in hectares.', max_digits=6, null=True, verbose_name='area')),
|
|
135
135
|
('complete', models.BooleanField(default=False, help_text='All species seen are reported.', verbose_name='complete')),
|
|
136
136
|
('comments', models.TextField(blank=True, help_text='Any comments about the checklist.', verbose_name='comments')),
|
|
@@ -151,7 +151,7 @@ class Checklist(models.Model):
|
|
|
151
151
|
decimal_places=3,
|
|
152
152
|
max_digits=6,
|
|
153
153
|
verbose_name=_("distance"),
|
|
154
|
-
help_text=_("The distance, in
|
|
154
|
+
help_text=_("The distance, in kilometres, covered while travelling."),
|
|
155
155
|
)
|
|
156
156
|
|
|
157
157
|
area = models.DecimalField(
|
|
@@ -201,3 +201,8 @@ class Checklist(models.Model):
|
|
|
201
201
|
|
|
202
202
|
def __str__(self) -> str:
|
|
203
203
|
return str(self.identifier)
|
|
204
|
+
|
|
205
|
+
def get_protocol(self):
|
|
206
|
+
if self.protocol_code:
|
|
207
|
+
return self.Protocol[self.protocol_code].label if self.protocol_code else ""
|
|
208
|
+
return ""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/locale/en/LC_MESSAGES/django.mo
RENAMED
|
File without changes
|
{ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/locale/en/LC_MESSAGES/django.po
RENAMED
|
File without changes
|
|
File without changes
|
{ebird_api_data-0.3.1 → ebird_api_data-0.3.3}/src/ebird/api/data/management/commands/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|