Beeminding Journaling in Day One

I’ve got a way that has been helpful for beeminding my journaling and I’d like to share it with you. This requires a Day One client on a machine and running a chron job to update a txt file.

The flow is like this:

  1. Day One writes to a it’s SQL database after a journal entry is saved.
  2. A script is kicked off by chron that reads records from the database and pipes the “ZCREATIONOSNAME” values from each journal entry into a txt file. (ZCREATIONOSNAME is just what OS was used to write the journal entry to the database - so it usually just says MacOS - unless I journal on my phone). So after this, what is essentially happens if you have a text file that is a list that looks like this:

MacOS
MacOS
MacOS
iOS

And the number of times a OS entry occurs = the number of journal entries that you have.
3. This file is saved on Dropbox.
4. URL enters the words into beeminder - which happens to be the same number as your journal entries.

Here is the script that is used:
#!/bin/sh

/usr/bin/sqlite3 /Users/USERNAME/Library/Group\ Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite -cmd “SELECT ZCREATIONOSNAME FROM ZENTRY;” > dayoneentrycount.txt

I used Lingon X to set up the script to point at a dropbox directory.

Hope this helps someone!

2 Likes

Clever! I also Beemind “journaling” more broadly, although practically it’s almost always in Day One. This might be handy.

I decided to play around with it a bit; here’s a query that outputs the actual text content of my journal IDs 3, 6, and 9, replaces all the characters with x before being saved:

sqlite3 ~/Library/Group\ Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite "SELECT ZMARKDOWNTEXT FROM ZENTRY WHERE ZJOURNAL IN (3, 6, 9);" | perl -0777 -i -pe 's/\w/x/g' > dayoneentries.txt

That gets me something like this, which might be anonymized enough to use for a word count goal:

# xxx <> xxxx xxxxx\-xx

xxx xxxxx xxxxxxxx
xxxx xxxxxxxx xx xx xxxx xx xxxxxxxx
xxxxxx xxxx xxxxx xxxx xxxx
\- xxx, xxxx xxxxxx x xxxxxx xxxxxxxxx xxx xxx xxx xxx xxx xxxxx xxxxx
\- xxxx xxxx xxxxxxxxx xx xxxxxxx xx xxxx
xxxxx xxxx xxxxxx xxxxxxx

xxxx xxxxx xxxxxxxx
xxxx xxxxx xx xx%, xxx xx%, xxxx xxxxxxx xxxx x xxx
xxxx xxx \-
...
1 Like

…on second thought, I’m not sure I’d want even the above in the wild – I’d bet a machine learning algo could slurp up all the text content you’ve ever written, then make a pretty good recreation of your journal based on the word length combinations here.

Adding a second replacement turns this into something I’m a bit more comfortable sharing with the world:

sqlite3 ~/Library/Group\ Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite "SELECT ZMARKDOWNTEXT FROM ZENTRY WHERE ZJOURNAL IN (3, 6, 9);" | perl -0777 -i -pe 's/\w/x/g' | perl -0777 -i -pe 's/(x+)/buffalo/g' > dayoneentries.txt

Here’s an entry, properly anonymized:

buffalo buffalo buffalo?

- buffalo buffalo buffalo
- buffalo buffalo buffalo
- buffalo buffalo buffalo buffalo buffalo 

![](buffalo-buffalo://buffalo)

buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo 
![](buffalo-buffalo://buffalo)

buffalo buffalo. 

buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo'buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo, buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo. 

1 Like

Awesome! I thought about doing word counts, but I didn’t want to burden Beeminder’s server with counting words on huge files. Also I don’t know perl very well at all.
How big does that file turn out to be? I imagine Beeminder’s URL minder would take a bit to count words from all of my journal entries. so I try to hit around around 1k words per day - so that would turn out to be around 365k words by the end of the year.

BTW, do you know of any way to get a time length value from a directory of mp3s? I would like to beemind the # of seconds of songs I make, but I can’t figure out how to make it work.

1 Like

I was being cheeky with buffalo replacement but you could make the file smaller with

sqlite3 ~/Library/Group\ Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite "SELECT ZMARKDOWNTEXT FROM ZENTRY WHERE ZJOURNAL IN (3, 6, 9);" | perl -0777 -i -pe 's/\w/x/g' | perl -0777 -i -pe 's/(x+)/hi/g' > dayoneentries.txt

With that, my file is 852 KB for ~250k words.

1 Like

Somewhat aside: @dreev et al, is there a better way “url-mind” a single data point? This example works by creating a text document with the appropriate number of words, and uploading that to Dropbox.

But it seems like it would be more elegant to simply output a file with a single integer. Is there a simple way to do that?

1 Like

I don’t think so, and there sure should be! :thinking: