Skip to content

Conversation

@mihow
Copy link
Collaborator

@mihow mihow commented Mar 7, 2025

Several endpoints in the interactive API browser time out and are unusable, however their json-only equivalents do not have this issue.

For example these never load:
https://api.beluga.insectai.org/api/v2/occurrences/?limit=1&offset=1000
https://api.beluga.insectai.org/api/v2/classifications/?limit=1

But these load fine:
https://api.beluga.insectai.org/api/v2/occurrences.jsonlimit=1&offset=1000
https://api.beluga.insectai.org/api/v2/classifications.json?limit=1

It turns out this is because the interactive API view populates the full list of choices available to users for the filters. And these two endpoints had filters that triggered a long full-scan query.

This PR disables those filters. It also adds two filters to the classifications endpoint, one for Project and one for Source Image Collection, based on a user request.

Follow-up TODOs

  • Use the auto-complete or another widget for the interactive API browser
  • Add a default time-limit to all DB queries
  • Find other endpoints with similar issues

@netlify
Copy link

netlify bot commented Mar 7, 2025

Deploy Preview for antenna-preview canceled.

Name Link
🔨 Latest commit 523b870
🔍 Latest deploy log https://app.netlify.com/sites/antenna-preview/deploys/67cc8160185d1200082c8f2a

@mihow mihow merged commit 9facbc9 into main Mar 10, 2025
6 checks passed
@mihow mihow deleted the fix/slow-api-views branch March 10, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants