Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatch in records downloaded by get_inat_obs_user #55

Open
azizka opened this issue Jul 26, 2022 · 3 comments
Open

Mismatch in records downloaded by get_inat_obs_user #55

azizka opened this issue Jul 26, 2022 · 3 comments

Comments

@azizka
Copy link

azizka commented Jul 26, 2022

The number of records downloaded with get_inat_obs_user can mismatch with the number of records displayed for a user by iNaturalist.

For example, username == "christiangross4", retrieves 390 records, but www.inaturalist.org shows 430 observations for this user.

Where does the mismatch come from? Is there an additional filter? If so, it would be great to indicate this in the documentation.

Thanks!

@mdahirel
Copy link

mdahirel commented Oct 2, 2022

Just chiming in to say I also got this issue

Going through my own observations (username =="msjdahirel"), both research-grade and non-research grade observations get dropped, both older and newer observations...

Still from my observations, comparing the iconic_taxon_name column in the output of get_inat_obs_user against the seemingly equivalent filter ("categories") on the iNat website, it looks like birds and mammals get disproportionately dropped, but that just feels weird to me?

@Louis-Backstrom
Copy link

Also getting this issue on v0.1.9

Seems to be the same records retrieved/dropped each time you run the function too - not just randomly dropping things each time.

> obs1 <- get_inat_obs_user(username = "louisb", maxresults = 10000)
> Sys.sleep("60")
> obs2 <- get_inat_obs_user(username = "louisb", maxresults = 10000)
> identical(obs1, obs2)
[1] TRUE

@chleeb
Copy link

chleeb commented Mar 5, 2023

I also have this problem with get_inat_obs_user, but I can provide a solution.

In general, this might not be a rinat issue, but an iNaturalist issue.

In the end get_inat_obs_user is a GET request:

username <- "hannelore13"   # just an example for an account with only a few observations
base_url <- "http://www.inaturalist.org/"
data_path <- paste0(username, ".json")
data_query <- "&per_page=200&page=P1"
data <- GET(base_url, path = paste0("observations/", data_path), query = data_query)

Thus, it requests the page
http://www.inaturalist.org/observations/hannelore13.json?&per_page=200&page=1
iNaturalist returns only 1 observation, although the user has 7 observations.

The wrong number of observations is already given in the header:
data $headers$x-total-entries # returns 1

Interestingly, also
http://www.inaturalist.org/observations/hannelore13?&per_page=200&page=1
results in only 1 observation. Thus, the response from iNaturalist is just not what we expect. At that point I don't know why not all observations are shown.
When I want to download all observations of the user via the export tool, I am getting all 7 observations:
https://www.inaturalist.org/observations/export?verifiable=any&page=1&spam=&place_id=any&user_id=hannelore13&project_id=

A first workaround would be to use the other iNaturalist API (https://api.inaturalist.org/v1/).
For example:

library(httr)
data <- GET ("https://api.inaturalist.org/v1/observations?user_id=hannelore13")
data_parsed <- content(data, "parsed")
number_of_observations <- data_parsed$total_results
all_observations <- data_parsed$results

Note that only 200 observations will be returned, so &per_page=200&page=1 has to be used to get more results.

I hope this helps. In addition, I will link to this issue in the iNaturalist repository or the iNaturalist forum.

Best,
Christoph

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

No branches or pull requests

4 participants