gbif / portal-feedback

User feedback for the GBIF API, website and published data. You can ask questions here. 🗨❓
30 stars 16 forks source link

Allow ordering of API results in oldest-first order #2385

Open MattBlissett opened 4 years ago

MattBlissett commented 4 years ago

Idea from #1814

Allow ordering as oldest-first, to give stability to "append-only" type queries.

The api returns download events sorted from last to first, so the offset value only has a meaning in a given moment. In that moment, if limit=1 then offset=count-position (position of a given record, in ascended sorting, 1-based). In that moment, if I store positions of previously recorded problematic records I could avoid them in future api requests (construct these request so that limit/offset combinations don't include these records).

But as the downloads "count" for a given dataset is always rising at any time, I can't see a way of avoiding the error because we never know the value of "count" before we launch the api request.

Possible solutions I see (my best choices first). I guess all of them imply api modifications:

1- Let us sort downloads ascending (from first to last) with a "sort" parameter, so that offset=1&limit=1 will always be the same download event (the oldest one).

abubelinha commented 3 years ago

@MattBlissett I guess this reference is wrong:

Idea from #1814

The idea comes from #2376 , right?

Anyway, one year later ... is it possible to reverse-sort api results or still not? Doesn't look like a difficult thing to implement. I can't see any reference to this in api documentation.

BTW ... another idea. Would it be possible to update api documentation with link references to github issues like this? So that, if somebody is looking api docs for info about how to sort occurrence downloads results, a link to this issue (and other issues related to that subject) would be useful: Users get updated info and you could avoid duplicate issues.

@abubelinha

abubelinha commented 1 year ago

Three years after #2376 In order to make a yearly report for 2022 ... do we still have to parse again all activity records or are there any new hidden api parameters we can already use to reverse sorting of api results?

BTW, should we better open an issue in gbif-api/issues ? Thanks