dronefly-garden/dronefly

obs: provide URL shortcut to edit observation(s)

synrg opened this issue · 2 comments

synrg commented

The basic idea is:

  • in DM to the bot, initiate editing mode with ,edit (or ,edit on)
  • thereafter, every ,obs or ,s obs display is automatically filtered to only your own personal observations (i.e. implicit by me in the query)
  • and each display contains a link to edit, e.g.
    • if a single observation, https://www.inaturalist.org/observations/#/edit
    • if multiple observations, https://www.inaturalist.org/edit/batch?o=#,#,#,... for as many observations as are in the current "page" (up to 200 - this URL can be huge, so we might need to use a URL shortener!)
  • multiple pages for > 200 observations can be edited by appending opt page=2, etc.
synrg commented

A way to avoid having to shorten the URL is to batch edit in smaller batches so we don't exceed Discord's embed size limits.

synrg commented

A mockup using EmbedUtils with a very long URL succeeds:

-embed fromdata {
  "title": "test",
  "url": "https://www.inaturalist.org/observations/edit/batch?o=100776209,99797090,99648648,97565024,96872374,96114915,96114910,96114904,96108602,96108601,96108592,95891997,95888512,95379926,95379923,95379917,95379909,95379900,95379895,95377003,95375778,95375777,95298591,95276467,93619848,93603876,93187032,92890194,92890180,92890163,92890160,92409864,90926674,90807269,90381333,90277837,89666566,89615459,89456333,89447510,89405431,89405426,88418423,87458484,87458481,86588628,86588622,86588614,86588607,86588597,86588589,85949794,85949791,85949790,85949789,85949768,85949749,85949738,85949729,85936381,85936373,85936365,85936337,85531755,84870601,84459915,84459172,84453563,81731587,77505646,77505221,77505119,77104336,73978821,62999261,58089423,57026653,55443114,55443108,55441563,53540824,53540032,53539628,52397692,52255796,51953541,51953540,51027411,50724069,50606165,49630524,49630523,47652950,47648907,47087584,46907699,46410618,46406175,45317143,45317141,44810294,44801528,44146709,44007292,44007279,44007278,44007249,44007247,43853876,43575745,43569256,35282003,34477195,34357909,34354370,32617324,32126155,32078894,31500651,31461057,31460970,31460967,31053342,31022282,30653839,30650367,30650364,30600686,30600685,30599936,30599129,30597789,30453834,30269008,30199589,30164590,30164589,30162809,30161555,30057571,30013456,30013380,30013012,30000475,29808214,29807901,29807455,29740728,29606872,29333420,29231557,29230753,29230751,29230748,29211112,29077124,29016266,28969306,28969154,28968773,28967964,28967571,28763468,28634447,28582548,28581999,28581857,28453738,28452488,28402792,28399236,28399233,28392730,28384065,28381285,28327511,28327510,28202236,28201991,28201777,28201290,27709392,27665787,27654572,27294375,27239949,27239110,27179456,27179448,27174011,27172948,27172259,27166270,26996258,26995747,26995073,26994437,26994346,26988750,26981700"
}

image

The result is a very long /edit/batch URL that loads all those observation IDs.

It appears that the only limit to length that might apply here to the URL is the whole Embed can't exceed 6000 characters total. So long as we stick to pages of 200 IDs of up to 10 digits (and sometime in the not too distant future, 11 digits), then the URL will still be well within the limit.

The original use case that led to us recording this idea has seemingly hit a dead end, though: https://forum.inaturalist.org/t/add-missing-api-filters-to-batch-editing/3806/6

While the idea recorded in this issue is still a good one, it doesn't address the problem of batch editing all your "Galls of North America" observations (or some other project) to add an Annotation for Evidence of Presence: Gall, since the batch edit form doesn't support it. So right now, this is a solution waiting for a real-world problem before we consider moving forward with it.