dronefly-garden / dronefly

Red Discord Bot V3 cogs for naturalists.
Other
16 stars 3 forks source link

obs: Apply rank filters to observation searches #138

Closed synrg closed 3 years ago

synrg commented 4 years ago

The ,obs, ,search obs, and ,tab commands should apply rank filters to observations matching the taxon, and not to the taxon search itself. See also #137 wherein I reference this in a comment.

That is, if someone performs a ,search obs hybrid anatidae by me, they very likely want all of their own observations of rank hybrid that are ducks, geese or swans (Anatidae), and not their observations that are in a taxon that is a hybrid that matches "Anatidae" (there is no such taxon!)

synrg commented 4 years ago

On iNat Discord, mws asked:

I think a command that would just spit out all your obs at hybrid level could be nice? (At hybrid and genushybrid simultaneously if possible?)

If this wishlist were coded, I imagine the syntax would be ,s obs hybrid genushybrid by me. Or, if you just wanted your most recent one, ,obs hybrid genushybrid by me, or if you wanted just a link to all of them on the web, ,tab obs hybrid genushybrid by me (though to improve that last one, it would be nice if it had a breakdown of counts by leaf taxon appearing as a table beneath the link).

synrg commented 4 years ago

136 would need to be done to do the "breakdown of counts by leaf taxon" tabulation mentioned in the prior comment.

synrg commented 4 years ago

Caveat: Just changing the behaviour here without preserving the ability to do the original behaviour loses something important: the ability to filter the taxon by rank is sometimes necessary to disambiguate taxa.

Current behaviour:

You can say ,s obs carex and it will browse all observations that are in Genus Carex (regardless of rank). But if you specify ,s obs subg carex, then you browse all observations that are in Carex subg. carex (regardless of rank).

proposed behaviour:

For the first case (no rank keyword) it will be the same. For the second, ,s obs subg carex would match any Genus Carex that are exactly the rank subgenus, which may not be what was intended.

The confusion is even worse with names that don't just match multiple ranks within the same subtree, but match completely unrelated taxa. Consider ,s obs kites would search for Genus Gasteracantha (Kitespiders), while ,s obs order kites would search for Order Accipitriformes (Hawks, Eagles, Kites, and Allies). Adding order to the query disambiguates between the two. But if we change ,s obs order kites to mean "find all kites that are of rank order are lower", you get zero matches, because "kites" matches a genus and genera don't contain orders!

So we need to think carefully about this ambiguity we've introduced between filter on taxon and filter on observations.

synrg commented 3 years ago

This is now possible with the addition of rank to the list of supported opt arguments. You can do ,s my anatidae opt rank=hybrid to match all your Anatidae that are of the specific rank hybrid. This option also accepts a comma-delimited list to match observations in any of the specific ranks listed, e.g. ,s my birds opt rank=hybrid,genushybrid to match your birds either at hybrid or genushybrid rank.

Please note: as per other opt options, Dronefly does no processing of the argument. That means you must use the exact name of the rank here and cannot use the convenient abbreviations that Dronefly supports for the taxon rank filter, like ssp for subspecies. Until there is demand for it beyond a handful of advanced users who might want to do this kind of search, it's not something that will go higher in my list of priorities to make any easier. At least there's now a way to do this kind of search in Dronefly, even if it's a bit fiddly to use.