Bulk Selection of Observations to Add to a Project

Hi all, I’m resurrecting this old thread to again reiterate my agreement we need a bulk select → add to project feature.

Right now I have this project tracking aquatic animals of a river system. The river is not a searchable location within iNat, and it involves aquatic animals only (eg birds, but only aquatic birds so you can’t just select the whole ‘Bird’ taxa to add).

As it stands:
Project page →
1- “Find observations to add to project” (right, so, system already knows what task I’m trying to do here)
2- Zoom into relevant area
3- Basic filter for taxa likely to contain aquatic organisms
4- Receive list of candidate observations. Here’s where we get bogged down- I need the dolphins, not the rats. I need the cormorants, not the pigeons. I need the aquatic molluscs, not the garden snails.
5- New tab any obs I want to add and manually add to project from there. There’s a LOT of tabbing going on. Its VERY time consuming.

Why on earth would you have the ‘Find Observations to Add to Project’ link and then not make it simple to add obs in/out from the one page?? Why doesn’t the list of candidates involve a simple checkbox → add selected function? As @jeanphilippeb has reminded me it is possible to do it from individual user profiles, so why not from multiple users at once when running the specific ‘Add Observations to Project’ task? Drives me nuts.

4 Likes

Hi all,

I wanted to add another plea for the ability of curators to bulk add observations to a traditional project. I regularly run bioblitzes on private properties (20 - 1,500 acres in size) and traditional projects are the best way to compile observations. Collection projects don’t work well because people are bad at checking their GPS accuracy before taking photos with their phone (despite coaching from me ahead of time). So we miss a lot of observations that way. The other issue is that records with obscured geoprivacy don’t make it in.

I’m working on herding the cats for two bioblitzes currently. Several participants uploaded hundreds of observations but forgot to add them to the project. Now it is like pulling teeth to get the observations into the project (lots of emails back and forth with participants and still not all have been added). If I as the curator could use the same batch add tools as an observer, this would have been solved weeks ago.

Thank you so much for considering this!!
Bert

4 Likes

Would you like a Windows software that put all observations matching a search query (URL) into a project?
I could do that soon and give it to you.

I am already using a software for adding specific observations to specific projects (see 1, 2).

2 Likes

Is this software available right now?

1 Like

Download it from “Transfer Big Files” (link expiring on 28th March):
http://tbf.me/a/I6mF8

Instructions in the “Release Notes” file.

3 Likes


It says the transfer has already expired.

1 Like

I have just updated the link above.

1 Like

Thank you!

conceptually, it’s relatively straightforward to add an observation to a traditional project via the API. the most basic way for a Windows user to do this is probably to just run this from the command prompt (cmd.exe):

curl "https://api.inaturalist.org/v1/projects/%project_id%/add" -X "POST" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: %jwt%" -d "{\"observation_id\": %observation_id%}"

… substituting the three parameters above for appropriate values:

  • %project_id% for the numeric id of your project
  • %jwt% for a JSON web token, which can be obtained from: https://www.inaturalist.org/users/api_token
  • %observation_id% for the numeric id of the observation you want to add

if you have another observation, just run the same command again, this time with the new %observation_id% value. keep repeating, as needed.

you could prepare multiple command lines – one for each observation – and paste them all to the command prompt, and they will execute one after the other. (i might do up to 100 at a time, just to make sure you’re not exceeding API request limits and so that you can catch errors as they occur.) or you could do some fancier scripting to make this a little more automated / parameterized. or you could adapt the same concepts to your scripting language or other tool of choice…

here are some ideas for how to get a list of observation ids: https://forum.inaturalist.org/t/search-by-location-accuracy-under-edit-observations-batch-edit/21399/5.

1 Like

That’s certainly doable, but for the majority of users it’s not exactly practical or time-smart for most users.

you could prepare multiple command lines – one for each observation – and paste them all to the command prompt,

That would take more time than simply adding the observation to the project directly.

What would be user-friendly and save time is something along the lines of a system where users could click on a check-box, or otherwise select multiple observations at once, and hit an “add to project” button.

There is a ton than can be done in iNat ‘under the hood’ but most users not only don’t know about that, they don’t have the CS skills to take advantage of those options. The accessibility of some of them would be greatly enhanced by creating a GUI to access that functionality.

This sort of, “Oh, it’s easy, just do XYZ,” is something I see often with people who have a lot of experience working in CS, or who have a coding background. Because something is easy for them they forget that the skills and knowledge they have took a lot of time and specialized training to gather and that most other people don’t have that set of skills. To be fair, it’s not just CS folks, it’s something that’s relatively widespread among many professions, but online it shows up really often among CS folks.

substituting the three parameters above for appropriate values

Hell, I’ll bet that a majority of users wouldn’t even know off hand which are the “three parameters” in the bit of code that would need to be substituted.

just offering folks options and knowledge. sure, some folks might just look at this and throw up their hands, but others might decide they can do something with it. who knows? maybe someone might use the knowledge to make something to help others.

seems a bit odd to me to take the view that providing knowledge is a bad thing if it’s not going to take 100% of the people 100% of the way to a goal. if that’s the bar for sharing knowledge, then why would anybody ever share anything?

3 Likes

here’s a version of this using Windows batch files:

  1. open Notepad or some other plain text editor
  2. copy and paste the following lines into your text editor:
    @echo off
    set jwt=redacted
    set project_id=63299
    set observation_id=151385912 151363952 151363946
    for %%o in (%observation_id%) do (
      echo Adding observation %%o to project %project_id%
      curl "https://api.inaturalist.org/v1/projects/%project_id%/add" -X "POST" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: %jwt%" -d "{\"observation_id\": %%o}"
      timeout 1
    )
    pause
    
  3. in lines 2-4 above, replace the values with values appropriate for your use case. note that you can specify multiple observation ids by setting observation_id to a space-separated list of observation ids. (if jwt value above was valid, the code above would attempt to add 3 observations – 151385912, 151363952, and 151363946 – to project 63299.)
  4. save the file with a .bat extension. (in Notepad, you may have to explicitly set the file type to All Files in order to add a .bat extension to your filename properly.)
  5. find your .bat file, and double-click it to execute it.

EDIT: in case you need to remove observations in bulk, here are the lines you would use in step 2 above:

@echo off
set jwt=redacted
set project_id=63299
set observation_id=151385912 151363952 151363946
for %%o in (%observation_id%) do (
  echo Removing observation %%o from project %project_id%
  curl "https://api.inaturalist.org/v1/projects/%project_id%/remove" -X "DELETE" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: %jwt%" -d "{\"observation_id\": %%o}"
  timeout 1
)
pause

also, if you want to skip the batch file and run directly in the command prompt, you can use this code to add:

set jwt=redacted
set project_id=63299
set observation_id=151385912 151363952 151363946
for %o in (%observation_id%) do ( echo Adding observation %o to project %project_id% & curl "https://api.inaturalist.org/v1/projects/%project_id%/add" -X "POST" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: %jwt%" -d "{\"observation_id\": %o}" & timeout 1 )
pause

and this code to remove:

set jwt=redacted
set project_id=63299
set observation_id=151385912 151363952 151363946
for %o in (%observation_id%) do ( echo Removing observation %o from project %project_id% & curl "https://api.inaturalist.org/v1/projects/%project_id%/remove" -X "DELETE" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: %jwt%" -d "{\"observation_id\": %o}" & timeout 1 )
pause
1 Like

That was not the assertion, that’s a strawman argument.

here’s a way to accomplish this using the Windows command prompt:

set request_parameters="user_id=pisum&per_page=200&page=1"
set request_url_base=https://api.inaturalist.org/v1/observations
set request_url="%request_url_base%?only_id=true&%request_parameters:"=%"
for /f "delims=" %r in ('curl %request_url%') do (set response_json=%r)
set observation_id=%response_json%
set observation_id=%observation_id:*[=%
set observation_id=%observation_id:]=%
set observation_id=%observation_id:{"id":=%
set observation_id=%observation_id:}=%
set observation_id=%observation_id:,= %
echo %observation_id%
pause

just replace the value in line 1 with the parameters appropriate for your use case, and this will return a space-separated list of observation ids from that result set. (if you want a comma-separated list instead, eliminate line 10.)

you could also use this code in place of the set observation_id= line in the Windows batch example(s) that i posted above, if you wanted to take all the observations from the result set automatically.

if you use the code above in a Windows batch file, replace the fourth line above with this:

for /f "delims=" %%r in ('curl %request_url%') do (set response_json=%%r)

So if I made this into a formula in excel that had my project ID and the token from that link and inserted observation IDs from an adjacent column I could just copy and paste 100 or so at a time and they would add?

are you asking because you tried it and it didn’t work? or are you asking for reassurance or something else?

typically when trying something new, i would try doing one first. then if successful, 2-3 more. then if successful, up to the suggested max (100 in this case).

I was asking to make sure that I was understanding correctly as I didn’t think that anything like this was possible and it gets around the huge limitation of traditional projects.

it’s definitely possible, and the three posts above with Windows command statements provide some examples of what is possible. if you get around to trying it out, write back and tell us how it goes.

It will likely be lat next week, cuz I have a deadline for something else, but definitely will and thanks.

I deleted a post that inadvertantly contained some sensitive information.