dronefly
dronefly copied to clipboard
obs: Random observation
[6:23 PM] Nudge || NSW 🇦🇺: Would be really cool if we had a command that randomly generated unsolved observations. Could almost make a game out of it [10:44 PM] Auradyme || Brisbane: "Who's That Pokemon!" [1:01 AM] afid || Montana: that would be cool! [1:58 AM] aispinsects || Florida: Pog [5:07 AM] reosarevok || Estonia: @SyntheticBee || Nova Scotia how easy would that be? ^ [6:00 AM] SyntheticBee || Nova Scotia: Something similar has been requested before. See https://discordapp.com/channels/525711945270296587/633990651519696926/663642928832577537 [6:02 AM] SyntheticBee || Nova Scotia: You can see where I worked through the problem for taxa & the steps needed for that. I'd need some similar approach for observations. [6:02 AM] SyntheticBee || Nova Scotia: i.e. first challenge is: come up with the algorithm. then it's a small matter of code. how easy? i guess i won't know until it is tried. :) [6:15 AM] reosarevok || Estonia: As a start it might be much simpler to query for the most recent unknown obs, or most recent unknown added by a relatively new user [6:15 AM] reosarevok || Estonia: Rather than making it random [6:18 AM] reosarevok || Estonia: Alternatively, choose a randomized date and query for the first unknown on that date [6:26 AM] SyntheticBee || Nova Scotia: Yep.
If you query for observations (possibly with filters applied) then get the total# of observations, then it's just a matter of generating a random number from 1 and the number of observations, do the page math to get the right API page, and bam, you have a randomly-selected observation in 2 api calls.
In the first call, set per_page=0
to limit the amount of work the iNat servers need to do (since we actually discard that result most of the time).