This trending hashtag algorithm in #Ditto works by querying the database every hour and publishing a Label event with the top hashtags.
Then to display it, we get the most recent Label, then get a 7-day history for each of those tags.
Check trends with:
nak req -k 1985 -t L=pub.ditto.trends -t l="#t" -a db0e60d10b9555a39050c258d460c5c461f6d18f467aa9f62de1a728b8a891a4 wss://gleasonator.dev/relay
Change #t to #p for trending users, or #r for trending links.
https://image.nostr.build/4145661101e8f200b35a249ba9a3acb175d71fe424fd2808649ac0636a4d0a25.png
https://image.nostr.build/3b65fdd0e09f32f04b9338daee1c4a003e80086c311ac8e636b8de3485de163b.png