Help with time tracking management and reports

I just found out about logseq a few days ago and gave it a try. I would like to add tasks and track my time with it for work so I can tally up per moth basis. I do freelance work. I either misunderstand something or there’s no function like this that I can see?

What I did is make some tasks in a dedicated namespace like [[freelance/project1]] and added tasks there. Now in the journal page I reference the block so I have quick access to specific tasks that I work on and I just go from TODO to DOING . What I want now is to query [[frelance/project1]] so I can get the report of work hours from the logbook for say month of February. Further detailed reports would be nice, but I’d like to just start with just being able to tally up the work time per a specific month as a starter. Is this possible?

I’d like to integrate logseq into my daily routine, I’m using GitHub - soywod/unfog: ⏱ Minimalist CLI task & time manager, written in Haskell. to keep track of times and get back reports on them per month or day etc. Is there a way to replace this functionality with logseq? Thanks!

So first off, Logseq is not really the tool you want to use for time tracking / time management.
It’s probably better to use a tool made for that job.

Second off, to understand what is happening, Logseq when time tracking will simply have plain text information for you.
This makes queries rather difficult.

Here’s an example of what I mean:
This is the logbook data for one of my repeating tasks. What Logseq writes to the .md file that is.

:LOGBOOK:
CLOCK: [2023-02-28 Tue 14:01:51]--[2023-02-28 Tue 14:05:57] =>  00:04:06
* State "DONE" from "DOING" [2023-02-28 Tue 14:05]
CLOCK: [2023-03-07 Tue 09:19:35]--[2023-03-07 Tue 09:22:54] =>  00:03:19
* State "DONE" from "DOING" [2023-03-07 Tue 09:22]
CLOCK: [2023-03-14 Tue 08:51:29]--[2023-03-14 Tue 08:56:44] =>  00:05:15
* State "DONE" from "DOING" [2023-03-14 Tue 08:56]
:END:

And here’s what that looks like on the Logseq internal database:

{:block/uuid #uuid "6416e940-e12e-4bd7-a805-3197fb89ee46",
 :block/priority "Z",
 :block/repeated? true,
 :block/left {:db/id 22732},
 :block/refs [{:db/id 4} {:db/id 19}],
 :block/scheduled 20230321,
 :block/collapsed? false,
 :block/format :markdown,
 :block/content
 "TODO [#Z] 🧺👕 Was 30 verzamelen & in de wasmachine doen\nSCHEDULED: <2023-03-21 Tue ++1w>\n:LOGBOOK:\nCLOCK: [2023-02-28 Tue 14:01:51]--[2023-02-28 Tue 14:05:57] =>  00:04:06\n* State \"DONE\" from \"DOING\" [2023-02-28 Tue 14:05]\nCLOCK: [2023-03-07 Tue 09:19:35]--[2023-03-07 Tue 09:22:54] =>  00:03:19\n* State \"DONE\" from \"DOING\" [2023-03-07 Tue 09:22]\nCLOCK: [2023-03-14 Tue 08:51:29]--[2023-03-14 Tue 08:56:44] =>  00:05:15\n* State \"DONE\" from \"DOING\" [2023-03-14 Tue 08:56]\n:END:",
 :db/id 22728,
 :block/path-refs [{:db/id 4} {:db/id 19} {:db/id 30}],
 :block/parent {:db/id 22732},
 :block/unordered true, 
 :block/page {:db/id 30}, 
 :block/marker "TODO"}

As you can see there is no database fields for the logbook, it is just plain text.
So with queries you are not able to do anything advanced.

The one thing you can do is something like this:

I have created two tasks and tracked some time for them. These tasks live in the journal pages so we can use between in the query.
In table view there is a clock-time attribute displayed. This is as advanced as it’ll probably get given the constrains I mentioned.

I never used closure before, but my understanding from the docs is that the advanced datalog query things can use user-defined functions to transform the result of the query, no?

Can we not write a parser for the logbook entries and do fancy stuff with it?

I have no idea of the scope datalog and what we can do with it, but if there’s any advanced programmers/users there that know what they’re doing maybe we can come up with some fancy query to make a report type thing?

I could write a parser in Python as a starting point for someone to translate into datalog if possible. If not maybe we can start a report-type plugin if there’s anyone willing to help out, that’d be awesome.

By the way, unfog uses text as well, it’s just well formatted text just like the logbook thing, e.g.:

TaskStopped 2023-03-16 10:01:42.887489854 UTC "3a64f9bd-03d7-4f74-98b6-446b219249e0"
TaskStarted 2023-03-16 11:07:11.938244499 UTC "4e03db64-ac73-4f8c-9d32-61ce735a8881"
TaskStopped 2023-03-16 13:53:40.34495113 UTC "4e03db64-ac73-4f8c-9d32-61ce735a8881"

Yes you can do more advanced stuff, but it’s not really what you want to use queries for imo.
I would indeed turn to plugins.
I’m not too familiar with them, but I wouldn’t be surprised if they exist already.