[Plugin] ZK Stats in a table by month
Yet another sample plugin. This one produces a note with a table much like the one below. It also puts the note in the system clipboard so it can be placed elsewhere.
Here it the GitHub link to the source woodenzen/zk-stats and here's a link to the release install zip Release v1.0 · woodenzen/zk-stats.
Post edited by ctietze on
Will Simpson
My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
kestrelcreek.com
Howdy, Stranger!
Comments
Thanks. It worked fine, but some figures are strange, so I have a few questions:
What is counted in the monthly breakdown?
The Total Number of Notes in Zettelkasten corresponds to the number of markdown files (I find 5163 in Finder and the plugin indicates 5165, so the difference is only 2) but the total of the figures in the monthly breakdown table is just 771 (15% of the Total).
Still in the monthly breakdown, do you count on the creation date or the modification date?
"Proofing Oven" counts notes tagged "#proofing"?
What does "Total Link Count" count? I believed it was the internal links (
[[ ]]
) but my test of confirmation did not work.And a suggestion: to add a line between "Monthly Breakdown:" and the table to allow it to be displayed as a table in Marked 2.
The plugin examines the files in the directory and examines the string of 12 digits. It then breaks down the string into year, month, and day, grouping on the months. Here is the code that breaks down the string. It sounds like the script is running into file names with unusual UUIDs.
Yes, there is something fishy about these different counts.
In my case, 4123 was reported in the plugin, and 4132 by Finder. The reason is that I have 9 notes with no UUID in the file names.
Neither. The date is formed from the UUID.
This is my personal inbox workflow and should be removed from the plugin. It is currently hardcoded. I've not seen a way to prompt for two variables. I could ask the user if they use an #inbox.
This is the regex that is used to count the links.
/[ ,§]\[\[/g
Any pair of '[' preceded by a space or a '§'. Thinking about this I need to change this so it captures links at the begging of a line also.
This is a better regex. FIXED
/(^|\s|§)\[\[/g
Thanks for the tip about Marked 2. FIXED
GitHub New Release v1.1 · woodenzen/zk-stats
Will Simpson
My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
kestrelcreek.com
Thanks for your answer, I believe I've understood the difference between the monthly table and the total: the table only counts file with an UUID, which in my case are a small minority as I rename all notes (those with an UUID should have been renamed or deleted).
I've tested the new version and it worked fine, except a difficulty at install: I had to rename the file from
com.will.stats-2.thearchiveplugin
tocom.will.stats.thearchiveplugin
as the former was rejected by The Archive:This has been a great interchange! It is the kind of feedback that I love and crave. Thank you for taking the time to install and try it out. I learn a few things.
You are not using UUIDs in the filenames makes a good use case for using the created date to count and sort the files in The Archive. Not in my case because DropBox reset the created date on ½ of my files when I rebased my Mac at one point. Fortunately, I religiously use a UUID in the file name.
I've run into this when upgrading an already installed bundle via the distribution method. This is a system thing. If the zip unbundles in the same directory as it was previously used, the file will be renamed
com.will.stats-2.thearchiveplugin
and be rejected. Maybe there is something the @ctietze could do programmatically or something someone can suggest to overcome this.Will Simpson
My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
kestrelcreek.com
I ran the ZK stats plug-in with success!
My table is too wide to fit the narrow editor, though! 😅 Maybe you could produce multiple tables with ~8--10 years worth of columns per table?
But the output looks good. It's almost a heat map:
Zettelkasten Stats
★★★★★★★★★★★★★★★★★★
Total Number of Notes in Zettelkasten: 9687
Total Word Count: 1269821
Average Word Count: 131.09
Total Link Count: 4041
Average Link Count: 0.42
Total Notes in Proofing Oven: 0
Monthly Breakdown:
Author at Zettelkasten.de • https://christiantietze.de/
Thanks for suggesting producing tables 10 years at a time. They would fit better in an 80-column editor. Your output appears to be in a proportional font. Is that true?
This may have been mentioned elsewhere, but I want to customize my theme so that tables use a fixed format and the body of the note can use a proportional font. I hate having to switch my fonts back and forth.
Will Simpson
My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
kestrelcreek.com
Ok, I just couldn't leave well enough alone. A moment's worth of coding, and I have a solution. More time was spent creating a test branch in Git, then merging it and producing a new release than doing the actual change.
Release Version 1.2 changed the table format, and it is now exactly 80 characters wide, fitting in The Archive's default editor window.
Production Release v1.2 of ZK Stats
Will Simpson
My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
kestrelcreek.com
Good idea to rotate the table! Then the size is capped!
Yes I want this, too, but I didn't want to mess with the current themes and plug-ins. Will tackle this soon, finally!
Author at Zettelkasten.de • https://christiantietze.de/