Skip to content

feat(WEB-1059): add v2 iconic_taxa_counts endpoint#645

Merged
caseyhofford merged 5 commits into
mainfrom
web-1059-iconic-taxa-observation-counts-endpoint
Jul 9, 2026
Merged

feat(WEB-1059): add v2 iconic_taxa_counts endpoint#645
caseyhofford merged 5 commits into
mainfrom
web-1059-iconic-taxa-observation-counts-endpoint

Conversation

@caseyhofford

@caseyhofford caseyhofford commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Adds a category to the iconic_taxa_counts endpoint response for unknown taxa. This is identified by a result in the results list where taxon is null.

results [ 
    {
        "count": 2198,
        "taxon": null
    },
    ...
]

inaturalist/inaturalistjs#110 adds better handling of the Unknown Taxon in inaturalistjs.

@jwidness

jwidness commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

While you're working on the iconic_taxa_counts code, could you fix the bug that limits the result set for both this and iconic_taxa_species_counts to only 10, despite the fact that there are 14 iconic taxa?

Both of these terms aggregations use the ES default of 10 items, they need an explicit size of at least 14 to accommodate all the iconic taxa:

terms: { field: "taxon.iconic_taxon_id" }

terms: { field: "taxon.iconic_taxon_id" },

Thanks!

@caseyhofford

caseyhofford commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

While you're working on the iconic_taxa_counts code, could you fix the bug that limits the result set for both this and iconic_taxa_species_counts to only 10, despite the fact that there are 14 iconic taxa?

Both of these terms aggregations use the ES default of 10 items, they need an explicit size of at least 14 to accommodate all the iconic taxa:

terms: { field: "taxon.iconic_taxon_id" }

terms: { field: "taxon.iconic_taxon_id" },

Thanks!

Yes @jwidness, thanks for the suggestion! That should be handled here by setting size: 100 (https://github.com/inaturalist/iNaturalistAPI/pull/645/changes#diff-5d993c2b6e61f365a5f6758cb3612f39b26d3ee92c813066feb3bae301d23943R972), I'll add a spec to confirm this works.

@jwidness

jwidness commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Great! I obviously should have looked closer at the changed files 😅

@jwidness

jwidness commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Also, thanks for adding this to v2 -- I was told only a couple months ago that it wasn't on the agenda, so it's a nice surprise.

@caseyhofford

Copy link
Copy Markdown
Contributor Author

@jwidness no worries! Maybe I should set it to exactly 14 so it's clearer why this is a non default value, since it is not obvious. This change became necessary for the My Observations page in the react native app which got this prioritized, I'm glad to hear it's helpful for you too!

@caseyhofford caseyhofford force-pushed the web-1059-iconic-taxa-observation-counts-endpoint branch from 96b34f0 to a7a3bc3 Compare July 3, 2026 02:17
@caseyhofford caseyhofford force-pushed the web-1059-iconic-taxa-observation-counts-endpoint branch from 6cee7e3 to 5a42f1a Compare July 6, 2026 21:17
@caseyhofford caseyhofford marked this pull request as ready for review July 6, 2026 21:31
@caseyhofford caseyhofford requested a review from pleary July 6, 2026 21:31

@pleary pleary left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me. Thanks!

@caseyhofford caseyhofford changed the title Add iconic_taxa_counts endpoint feat(WEB-1059): add iconic_taxa_counts endpoint Jul 8, 2026
@caseyhofford caseyhofford changed the title feat(WEB-1059): add iconic_taxa_counts endpoint feat(WEB-1059): add v2 iconic_taxa_counts endpoint Jul 9, 2026
@caseyhofford caseyhofford merged commit 7a4c3bf into main Jul 9, 2026
5 checks passed
@caseyhofford caseyhofford deleted the web-1059-iconic-taxa-observation-counts-endpoint branch July 9, 2026 17:23
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.

3 participants