OPENDAP / Website

template repo for website project management
0 stars 0 forks source link

Presentations should be chronologically ordered #3

Closed Mikejmnez closed 2 weeks ago

Mikejmnez commented 1 month ago

Brief description

Presentations from Zenodo look great! However, these are not arranged chronologically and that can cause some confusion.

Visual Aid

Screenshot 2024-05-22 at 11 10 24 AM

Page URL

Mikejmnez commented 1 month ago

The same issue shows up in the community page:

Screenshot 2024-05-23 at 8 36 18 AM
Mikejmnez commented 1 month ago

@jahattox I couldn't figure out how to do this on the site builder. Do you think this is possible to set up?

jahattox commented 1 month ago

@Mikejmnez I'm wondering if this is a limitation of the Zenodo API. Here's the docs: https://developers.zenodo.org/#list

And here's the API call the plugin uses: https://zenodo.org/api/records/?sort=mostrecent

Could it be that "mostrecent" means the most recently uploaded, rather than ordering by publication date? I tried reversing the sort as well, and it updates, but it still isn't ordered by the year.

ndp-opendap commented 1 month ago

Could it be that "mostrecent" means the most recently uploaded, rather than ordering by publication date? I tried reversing the sort as well, and it updates, but it still isn't ordered by the year.

That's what it means I think.

Mikejmnez commented 1 month ago

@Mikejmnez I'm wondering if this is a limitation of the Zenodo API. Here's the docs: https://developers.zenodo.org/#list

And here's the API call the plugin uses: https://zenodo.org/api/records/?sort=mostrecent

Could it be that "mostrecent" means the most recently uploaded, rather than ordering by publication date? I tried reversing the sort as well, and it updates, but it still isn't ordered by the year.

I see. Then perhaps the solution would be to (manually) modify these presentations (get a new version of the presentation that is) so that sorting these result in a chronological order arrangement...

Mikejmnez commented 3 weeks ago

@jahattox I finally had some time to look into this. Zenodo has several ways of sorting the records, and one of them is Published[newest]. That is what we want (see here). By looking at the sorting key what we want is:

{'sort':'publication-desc'}

I quickly ran in a ipython shell and

community_id = 'opendap'
url = f'https://zenodo.org/api/records'
params = {
    'communities': community_id,
    'page': 1,
    'sort': 'publication-desc',
    'size': 10  # Number of records per page (maximum is 100)
}
response = requests.get(url, params=params)
data = response.json()

and looking at the data, something like this should work...

jahattox commented 2 weeks ago

@Mikejmnez Nice! That seems to have done the trick. I just pushed up the change. How do things look on your end?

Mikejmnez commented 2 weeks ago

@jahattox they look great! marking this as completed :)