#asknostr How would I go about analyzing a set of hashtags on Nostr against prevalence... for instance, for hashtags X, Y, and Z, what percentage of them are being discussed in whatever the past ~1000 notes that are available to me on my relays?
Login to reply
Replies (4)
I have no idea, but that's cool.
if the relay supports COUNT you can do it without downloading them, just find out how many there is.
problem is you need to also find that last 1000 events. an empty filter will give them to you, but if you are just wanting to count that's a lot of bandwidth. my relay can do counts without decoding events, because i designed the index that way.
what you can do is make a series of COUNT requests for "since" a time period, and use a bisection search to locate the 1000th event with about maybe 5-10 requests, and then use that since with the tags in a COUNT, and voila.
on my relay, there is also another shortcut. there is an endpoint with two API methods, one tells you the monotonic counter of events (literally also tells you how many events are stored on the relay), and then you can request a range of them with these numbers. so this would give you a shortcut for that bisection scan for the 1000th timestamped event, and then you can use that with since of the 1000th event's created_at timestamp, and until of the second you received that number from the endpoint, plus the filters, with a COUNT.
Thanks! I'd be happy with just listing bounded by dates as well, 1000 number isn't particularly important. Say, last 3 months or something... In fact, I'm looking to see how much more of some Tags get posted than others within a certain timeframe
well, it would just be like this:
```{
"since":<start timestamp>,
"until":<end timestamp>,
"tags":[
["#a":"<a value>"],
["#b":"<b value>"],
["#c":"<c value>"]
]
}```