dandi / dandi/dandi-archive

/dandisets/ sorting by `modified` should probably sort by "overall modified" not by most recent sorted

Open
#1,864 2 comments 0 reactions 1 assignee Claimed by @waxlamp View on GitHub
bug metadata
Dominant language
Python
Stars
26
Forks
21
Avg merge
4d 23h
Merged PRs (30d)
15

Description

I wanted to get dandisets sorted by modified so I could update some oldest ones... but looking at the `modified` -- it is not sorted by "overall modified":

```shell
❯ ( curl -J -L -X 'GET' -H "Authorization: token $DANDI_API_KEY" 'https://api.dandiarchive.org/api/dandisets/?ordering=modified&draft=true&empty=true&embargoed=true' -H 'accept: application/json'; ) >| /tmp/1.json
❯ jq '.results[].modified' /tmp/1.json | head
"2021-04-19T17:30:57.431000Z"
"2021-02-04T21:30:12.812000Z"
"2020-12-05T18:34:22.305000Z"
"2021-03-17T17:57:31.239000Z"
"2021-01-25T20:24:17.701000Z"
"2021-08-12T18:14:16.760028Z"
"2021-04-27T14:33:20.572614Z"
"2021-01-15T18:35:01.693000Z"
"2022-01-17T16:22:43.888215Z"
"2023-03-10T20:03:31.536451Z"
```

or of the `draft` version subrecord:

```shell
❯ jq '.results[].draft_version.modified' /tmp/1.json | tail -n 20 | head
"2023-06-20T00:56:27.985543Z"
"2023-06-20T00:56:27.950903Z"
"2023-06-20T00:56:28.082652Z"
"2023-06-20T00:56:24.651140Z"
"2023-11-23T04:30:50.711283Z"
"2023-06-20T00:56:25.409545Z"
"2023-06-20T00:56:24.209856Z"
"2023-06-20T00:56:23.229732Z"
"2023-06-20T00:56:16.436802Z"
"2023-06-20T00:56:24.150509Z"
```

but by the `most_recent_published_version`

```shell
❯ jq '.results[].most_recent_published_version.modified' /tmp/1.json | head
"2021-08-12T14:57:32.680033Z"
"2021-08-12T15:15:40.225830Z"
"2021-08-12T15:16:07.029186Z"
"2021-08-12T15:16:41.081708Z"
"2021-08-12T15:17:05.738235Z"
"2021-08-13T03:27:03.101703Z"
"2021-08-19T03:45:24.378937Z"
"2021-08-19T15:47:29.060075Z"
"2021-08-31T20:34:01.283878Z"
"2021-09-13T16:39:43.037478Z"
```

with tailing records having only drafts so no `most_recent_published_version` at all...

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.