Package: perennial
Perennial 🌱Journaling kit for long-term self-analysis.Journalingcan help identify patterns and themes in one's thoughts and behaviors. Trackingmoodcan provide valuable information about what triggers certain moods and how to manage them. And trackinggoals or taskscan help to stay focused and motivated and can provide a sense of accomplishment and progress as one works toward achieving them.By combining these, an individual can gain a more complete picture of themselves and their behavior and can more easily achieve personal growth.This journal kit was originally intended just for personal journaling, but I can also envision it being used for more specialized stories, such as documenting the course of projects, recording meeting minutes, or tracking pain across medical recovery.Getting startedInstallpipinstallperennialOr alternatively, download the source directly.gitclonehttps://almonds.dev/git/perennialcdperennial
pipinstall-e.Example usageSeethe quickstart pagefor getting started using the command line arguments.Load a journalStart a new journal in the current working directory that keeps track of a daily streak:>>>fromperennialimportJournal>>>>>>j=Journal(content="Example journal",streak_checker=StreakCheck.DAILY)>>>If the database file already exists, it is loaded:>>>j=Journal()>>>Adding entries>>>content="I had a nice day today. I visited some friends and made progress on my journal project.">>>e1=j.record(content,mood=4)>>>e1.streak# number of days logged in a row22>>>Reflect on past entries>>>search_results=j.search("dog")# retrieve entries with search terms>>>e2=search_results[0]>>>e2.content'Today I saw a cute dog. (:'>>>>>>e3=j.random()# retrieve a random entry>>>e3.datedatetime.datetime(2022,12,12,10,5,0,0)>>>Track mood>>>fromdatetimeimportdatetime,timedelta>>>one_week_ago=datetime.today()-timedelta(days=7)>>>today=datetime.today()>>>>>>entries=j.search(start_date=one_week_ago,end_date=today)>>>moods=[e.moodife.moodisnotNoneforeinentries]>>>moods[3,4,3,3,2,5,3]>>>Goal or task trackingGoals or tasks are associated with their states of completion.>>>j.time_in_state("Submit PhD apps","DOING")datetime.timedelta(days=65)>>>>>>_=j.goal("Submit PhD apps","DONE")>>>_=j.goal("Meeting with Alex, Bailey, and Casey","CANCELED")>>>_=j.goal("Fold laundry","TODO")>>>Personally, I'm fond of this tetrad of task states, as used inLogseq:TODODOINGDONECANCELEDDocumentationI'll also set this up eventually.To-doAccept Markdown files as entriesAbility to sync database streak info (important for adding latent entries)CLITweak streak-tracking functions so they can be generalizedOpen new files automatically?Superjournals and subjournals? (kind of already have that)Eventually switch to a Rust implementation with SurrealDB?ImplementationThe journal entries are saved in a SQLite table calledentries:Column nameData typeDescriptionidINTEGERPrimary keydateTEXTDate of the journal entrycontentTEXTJournal entry summarystreakINTEGERDaily streakmoodINTEGERMood level (e.g. scale 1-5) (may beNULL)fileTEXTAssociated file (may beNULL)And the goals and their states are stored in a table calledgoals:Column nameData typeDescriptionidINTEGERPrimary keydateTEXTDate of goal updatenameTEXTName of goalstateTEXTState of goal (e.g."TODO","DOING","DONE","CANCELED")Information about the journal itself is in a table calledmeta, which always has a single row:Column nameData typeDescriptionidINTEGERPrimary keydateTEXTDate of journal creationcontentTEXTJournal summarystreak_modeTEXTi.e. "daily", "weekly", "monthly", or "yearly"templateTEXTPath to the template to use when touching a file for a new entry