My toy project turned into a viral challenge
blog.jinay.dev
blog.jinay.dev
So, unless you really need to show exactly how many data points each bucket contains, it's much easier to run the analysis once offline, then serve just the histogram percentage data. From that you can make an SVG and overlay additional user-specific data on top. The point is that this histogram data is small and easy to cache.
You can then rerun the histogram analysis later if you'd like. However, for this project I never saw anything change with more data. It was overkill even to run it as a cron job.
2 hundredths of a second off from reality!
I could try it again to validate, but I can't be bothered. As far as I'm concerned, I'm super accurate judging the passage of time. No need to find out if it was a lucky random pick in the interval [58, 62] :)
But the real surprise was just how close a lot of people get. I was fully expecting a bell curve that was offset high or low due to some imagined bias people would have to count fast or slow.
I'm going to acknowledge that result as an outlier, exclude it from my analysis, and stick with my median result of 60.02.
$ np.median([59.48, 60.02])
59.75
$ stats.median_abs_deviation([59.48, 60.02])
0.27
;-)All I did was count from 20 to 80. Why from 20? Its a trick I learned from drivers license practice. In my language, the 1 to 20 are too short, so if you want to time a second they're not appropriate.
What do you mean by "freezing the data"?
Regarding the excessive download problem, my first instinct is to periodically (for example, every hour) compute summary statistics for the bar chart and store that in Firebase. This, of course, would require an additional script/service to perform these periodic jobs.
I'm not sure if that's what you ended up doing and I'm curious what your solution is.
Also worth noting that Firebase has built-in “cloud functions” which have access to the database API. It would be pretty easy to run one on a schedule.
https://github.com/JinayJain/just-a-minute/blob/master/app.j...
Obviously not a scalable solution, and I think I would have done something very similar to the periodic updates like you mentioned (if I had more experience with cloud functions etc.)
Ideally, people would do the challenge first and then see where they lie on the graph before seeing the data itself.