Observation tied to missing photo records cannot be retrieved properly by v2 API

Platform: Web

Browser, if a website issue: Vivaldi but irrelevant

URLs (aka web addresses) of any relevant observations or pages:

https://www.inaturalist.org/observations/identify?per_page=100&nelat=21.027425570491193&nelng=91.48025537114941&not_in_place=6681&swlat=-4.319755102567338&swlng=62.91580224614941&taxon_id=319384&place_id=any

Screenshots of what you are seeing:

Description of problem:

Step 1: I chained per_page with a rectangle map boundary and not_in_place for a taxon and so no results from such identify mode - https://www.inaturalist.org/observations/identify?per_page=100&nelat=21.027425570491193&nelng=91.48025537114941&not_in_place=6681&swlat=-4.319755102567338&swlng=62.91580224614941&taxon_id=319384&place_id=any

Step 2: Interestingly, I do get results from same url when removing just taxon_id -

https://www.inaturalist.org/observations/identify?per_page=100&nelat=21.027425570491193&nelng=91.48025537114941&not_in_place=6681&swlat=-4.319755102567338&swlng=62.91580224614941&place_id=any

step 3: likewise, I also get results if removing only per_page too -

https://www.inaturalist.org/observations/identify?place_id=any&nelat=21.027425570491193&nelng=91.48025537114941&not_in_place=6681&swlat=-4.319755102567338&swlng=62.91580224614941&taxon_id=319384

step 4: the browse mode displaying default 100 observations works fine anyway without per_page filter for this goal but I like to use identify mode for this url job.

Strangely, it works if per_page is <65

1 Like

ohh same url? for me it worked until 52 - no results from 53 in per_page

its really odd bug then lol, I would love if anyone can identify the reason from inat public codebase or personal experiences?

probably there’s bad data in this set. for example, the observation below seems to have null items in its photos array, which you wouldn’t think would be possible. the v2 API fails altogether when photos is included in the results, but the v1 API will show you the bad data.

comparing the observation_photos vs photos, it sort of looks like the observation is connected to photos that no longer exist (ex. https://www.inaturalist.org/photos/601209232).

    "observation_photos": [
        {
          "id": 566637984,
          "position": 0,
          "uuid": "8bc42b9f-6712-42df-9c91-00fb0fccbeed",
          "photo_id": 601209232
        },
        {
          "id": 566637985,
          "position": 1,
          "uuid": "ac44d572-f2d2-4b63-9e9a-ee0f1f87284a",
          "photo_id": 601209245
        },
        {
          "id": 566637986,
          "position": 2,
          "uuid": "b0c19a8f-b272-4b5a-b76d-ef29f038f8a5",
          "photo_id": 601209251
        },
        {
          "id": 566637987,
          "position": 3,
          "uuid": "beac60a0-2087-4c00-beae-251e09d15416",
          "photo_id": 610916484,
          "photo": {
            "id": 610916484,
            "license_code": "cc-by-nc",
            "original_dimensions": {
              "width": 1274,
              "height": 1593
            },
            "url": "https://inaturalist-open-data.s3.amazonaws.com/photos/610916484/square.jpg",
            "attribution": "(c) Uriel Levy, some rights reserved (CC BY-NC)",
            "flags": [],
            "moderator_actions": [],
            "hidden": false
          }
        },
        {
          "id": 566637997,
          "position": 4,
          "uuid": "6455254e-45d5-48c4-b75f-0ad6ffe4b022",
          "photo_id": 610916488,
          "photo": {
            "id": 610916488,
            "license_code": "cc-by-nc",
            "original_dimensions": {
              "width": 1609,
              "height": 1287
            },
            "url": "https://inaturalist-open-data.s3.amazonaws.com/photos/610916488/square.jpg",
            "attribution": "(c) Uriel Levy, some rights reserved (CC BY-NC)",
            "flags": [],
            "moderator_actions": [],
            "hidden": false
          }
        }
      ],
      "photos": [null, null, null, {
          "id": 610916484,
          "license_code": "cc-by-nc",
          "original_dimensions": {
            "width": 1274,
            "height": 1593
          },
          "url": "https://inaturalist-open-data.s3.amazonaws.com/photos/610916484/square.jpg",
          "attribution": "(c) Uriel Levy, some rights reserved (CC BY-NC)",
          "flags": [],
          "moderator_actions": [],
          "hidden": false
        },
        {
          "id": 610916488,
          "license_code": "cc-by-nc",
          "original_dimensions": {
            "width": 1609,
            "height": 1287
          },
          "url": "https://inaturalist-open-data.s3.amazonaws.com/photos/610916488/square.jpg",
          "attribution": "(c) Uriel Levy, some rights reserved (CC BY-NC)",
          "flags": [],
          "moderator_actions": [],
          "hidden": false
        }
      ],

as a workaround for now, you might be able to get the other stuff in the Identify screen by adding not_id=336209968 to your parameter list.

1 Like

ohh cool diagnosis! for some reason not_id is also not chaining here - maybe bcoz of the order of flow of photos check failing before filters applying with not_id on background? - https://www.inaturalist.org/observations/identify?not_id=336209968&per_page=100&nelat=21.027425570491193&nelng=91.48025537114941&not_in_place=6681&swlat=-4.319755102567338&swlng=62.91580224614941&taxon_id=319384&place_id=any

I guess that 336209968 observation is the 53rd observation in the filtered sequence then (in my url), i cant move to second page with 52 per page but can move from 3rd page again and 100 per_page too if skipping this by jumping to later pages.

oh… yuck. the v2 API is expecting UUIDs in not_id. so then it would be not_id=df9d9f4e-09b1-48a4-b2b2-48dab9ef7e22. i would think that the v2 API probably should keep not_id functioning using the numeric obs ID, and create a separate not_uuid if they want to have that function on obs UUID.

Oof! Thanks again!

I think I faced that issue too once when I was using not_id and it not filtering things although I havent bothered to figure out why as its just a rare filter in usage terms.

you or moderators may want to change the title to reflect what the underlying problem probably is – observation tied to missing photo records cannot be retrieved properly by v2 API, causes issues in observation detail screen, Explore, and Identify.

2 Likes

Thanks, I made an issue for our engineers.

1 Like