Search by tags not present (not contain)

the system can return a filtered set of observations which have a particular tag. it does not provide a way to filter for observations which do not contain a particular tag on the server side, but you can get a list of observations and do your own filtering on the client side.

probably for most people in most cases, the easiest method for client-side filtering is described here: https://forum.inaturalist.org/t/search-self-observations-w-no-tag/39070/3.

if you know how to code, you can also do client-side filtering via the API in some cases. for example, i made a Jupyter Notebook (Python) which can retrieve observations and generate a CSV file. you could adapt that notebook to get your answer by making the following changes:

  • set req_params_string = 'taxon_id=48670&user_id=sylvainm_53'
  • in the # main execution section, use the following commands (lines 2 and 3 are optional):
    obs = await get_obs(req_params, get_all_pages=True, use_authorization=False, pre_parse_filter_function=(lambda x: 'light trap' not in [str(t).lower() for t in x['tags']]))
    obs_ids = [o.get('id') for o in obs]
    obs_id_sets = obs_ids_to_sets(obs_ids, prefix='https://www.inaturalist.org/observations?id=')
    

you’ll find that you have several observations that are tagged as “lignt trap” (misspelled) instead of “light trap” or are tagged as “piège lumineux” only.

2 Likes