Skip to content

Commit 14c969e

Browse files
committed
default to CONUS_SAMPLE_FRAME_ID=14 for unknown sample_frame_ids
1 parent 7dfd479 commit 14c969e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

bats_ai/core/views/species.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
router = RouterPaginated()
2121

22+
# Continental US sample frame ID, defaulting to CONUS GRTS when not specified.
23+
CONUS_SAMPLE_FRAME_ID = 14
24+
2225
_SPECIES_SCHEMA_FIELDS = (
2326
"species_code",
2427
"family",
@@ -73,7 +76,7 @@ def _species_values_qs(qs):
7376
def get_species(
7477
request: HttpRequest,
7578
grts_cell_id: int | None = Query(None),
76-
sample_frame_id: int = Query(14),
79+
sample_frame_id: int = Query(CONUS_SAMPLE_FRAME_ID),
7780
recording_id: int | None = Query(None),
7881
):
7982
if recording_id is not None:
@@ -82,7 +85,11 @@ def get_species(
8285
pk=recording_id,
8386
)
8487
grts_cell_id = recording.grts_cell_id
85-
sample_frame_id = recording.sample_frame_id if recording.sample_frame_id is not None else 14
88+
sample_frame_id = (
89+
recording.sample_frame_id
90+
if recording.sample_frame_id is not None
91+
else CONUS_SAMPLE_FRAME_ID
92+
)
8693

8794
null_in_range = Value(None, output_field=BooleanField(null=True))
8895

0 commit comments

Comments
 (0)