I created a list of vascular plants endemic to the Northeastern US and Canada and want to move it to a project without rewriting 100+ species. Is there a way to do this all at once or do I need to do it the long way? Thanks
i wrote something a while back that i think will do this: https://jumear.github.io/stirpy/lab?path=iNat_update_project.ipynb.
here’s what you would do:
- click the link above to open up the Jupyter workbook in a web-based JupyterLite instance.
- run the first two cells with code in them. the first starts with
# load required modules
, and the second starts with# define custom functions used for getting data
- in the third code cell that begins with
# define the parameters needed for your request
:
a. setproject_id = 'project-slug'
replacingproject-slug
with the slug of your project
b. get your JWT by opening https://www.inaturalist.org/users/api_token in your browser while logged into iNaturalist. you’ll get a string that looks something like{"api_token":"j.w.t"}
. copy thej.w.t
part.
c. back in the Jupyter workbook, setjwt = 'j.w.t'
, replacingj.w.t
with the value that you copied earlier
d. run the cell - in the next cell that begins
# define the model rules that you want to replicate into your project
, comment out (or delete) the sample rule definitions and add your required rule definition, which i think would besource_rules['taxon']['include']['ids'] = await get_taxon_ids_from_list(4512268)
. then run the cell. - run the next cell that begins
# Compare the source rules vs the existing target project rules
, and this will give you a summary of the changes that will be applied. - when you’re ready to finalize the changes, run the next cell that begins
# Execute the request(s)
the same workbook can also copy rules from another project (instead of from a list), if you wanted to do that instead. (that might help in situations like the one described in https://forum.inaturalist.org/t/duplicate-project/62144/5 .)
1 Like