3 ms·
A while back (couple years) I started tracking how much coffee I drank, and (roughly) when. I created a simple Mojolicious webapp, putting data on a SQLite dat
by mfontani 6y ago
A while back (couple years) I started tracking how much coffee I drank, and (roughly) when.
I created a simple Mojolicious webapp, putting data on a SQLite database. I later expanded it to accept/use an "API key" with which I could track my coffee intake, or get how much I drank already and when was my last cup, "simply" by running a simple bash+curl script. The site, instead, displays a neat github-commits-like chart[1] and some recent stats. I have a branch which changes the code to work on Postgres and is deployable on dokku, but I've not yet made the switch to that. I'm still using a mojolicious+sqlite+hypnotoad process running on a cheap VPS.
Since I started tracking my intake, it looks like I drank, on average, 3-4 coffees per day:
sqlite> select (select count(*) from intake)/(select julianday(max(time_t)) - julianday(min(time_t)) from intake);
3.7864677548175
Here in Italy's northern region, the quarantine started region-wide on the 8th of March.
sqlite> select (select count(*) from intake where time_t > "2020-03-08")/(select julianday(max(time_t)) - julianday("2020-03-08") from intake);
4.20309898028925
It looks like I'm drinking a bit more coffee than the usual, but surely nowhere as near as my most intake:
sqlite> select date(time_t) as ymd, count(*) as cnt from intake group by ymd order by cnt desc limit 5;
2018-05-16|11
2018-03-12|10
2018-05-15|10
2018-02-07|9
2019-06-04|9
Hope it helps! :)
[1]: https://i.imgur.com/c0DqAGO.png https://i.imgur.com/c0DqAGO.png
- galesky 6y agoThat's so overkill and so cool at the same time, a super engineer behavior lol. Nice job!
- geoah 6y agoThat is amazing. Do you happen to have published the source for this somewhere?
- temikus 6y agoNot the OP but if you like recording personal statistics, you might like http://reporter-app.com/ http://reporter-app.com/. I've been using it for personal experiments a bunch of times (like measuring stress levels).
- mfontani 6y agoI need to clean a few things up before being able to do so, chief among them my initial rookie mistake to name the users table "user", which in retrospect wasn't a good idea when moving the thing to Postgres - so while I've got a neat little "migrations.sql" that has served me fine over the various versions, it just can't work when ran against Postgres. I'll fix it up in the next few days and will reply in a comment once it's available.