Gantt pluggin (task/topic displayed against time)

Hi everyone !

First of all, I have no coding skills so forgive me if it seems unrealistic or whatever (I am just starting to learn JavaScript to use more extensively Dataview…)

Obsidian is a wonderful tool for a ton of purposes, and I think a pluggin might be useful for a particular use, let me go into details.

Context

I haven’t found a lot of other Obsidian users in the same field/having the same needs than me, so let me explain a bit

I use obsidian for professional purposes. I am working in a small R&D lab in chemistry industry (scientific field). I use Obsidian with a few pluggins, the main one being Dataview and Metadata Menu (and Canvas core pluggin).

With those pluggin, I extensively use metadatas in Obsidian to keep track of projects, task and topic management for the entire team and finally knowledge-wiki (to keep track of acquired knowledge and experience).

Pluggin feature idea

Global idea

To be fully functional for long term project, Obsidian could you a Gantt-type pluggin to complete Canvas and Dataview global task-related views.

Gantt chart are used to display tasks in time and relation between task in time.

Here is a few examples :

  • Task B can only be started when task A is completed
    Gantt_1

  • Task D can be started when task C is completed, which can be started when task B is completed, which can start when task A is completed (each task has it unique time duration).
    All of those are parts of red global task
    image

All those task on a specific project are usually displayed in a global view like the following one, to detail task time timeline. It could work the same way in Obsidian or maybe change the global view based on Obsidian specificity.

How it would work

I use the word “Task” to talk about an Obsidian note because I personally use note as topic or experiment notes, as “tasks” on a bigger project.

I imagine it would be based on Dataview (probably Dataviewjs ?) and Metadata menu.

Start by introducing the metadatas on existing notes (maybe with command palet) :

  • previousTask : link to the previous necessary completed task
  • nextTask : link to the time-daughter task (maybe not necessary if it is possible to follow the entire link of time-task only one previousTask)
  • duration : duration expected for the task to be completed. Manually entered or calculated based on the next metadata,
  • dueDate : date when the task if expected to be completed. Manually entered or calculated based on the the metadata duration.

Those 4 metadata needs to be easily updated, that’s why I think Metadata menu is needed.
It may be possible to add those specific metadata on template to avoid adding it manually to each new note → more specific names such as previousGanttTask, nextGanttTask, dueDateGantt…

Then, with the command palet, create a new Gantt project based on a specific note (start of the Gantt project). Two possiblity :

  • Automatic creation of timeline based on in and outlinks
  • Manual adding of notes

Possibility to horizontally adjust size of the task to change it’s duration (automatic metadata adjustment)

Possibility to change time-link between notes

Possibility ro right click the task to access it in the Canvas view (if it exists) or local/general graphic view

On the left panel, possibility to create goups/phase of tasks : scientific watch, commercial and market study, R&D development, industrialization processing, project starting, project finalization and feedback (and so on)

Possibility to visualize tasks in the note on the timeline (I mean real task, with checkboxes) under the task to see what is needed before completing the task and free the next task


It is a long shot, I have no idea if it can be made, but even if it is not the case it is a nice thinking exercise and I hope it might be useful for something else.

I’d love to discuss the idea and have your feedback regarding the idea !

7 Likes

I have a similar use case (tracking and documenting industrial R&D workflows) and I think it is possible to get close to what you are looking for using the Templater and Tasks plugins to make each note/task have some metadata on status and expected duration, due date, etc. Maybe you could make a canvas auto-generate based on your previousTask and nextTask links, and maybe to start you could just link them manually in the canvas. The note formatting could be changed based on task status, and that different formatting would show up in the canvas as well to help visually see where you are and what the next step is. I plan to look into this as I have time over the next few weeks, and will post if I come up with something useful.

1 Like

So, this doesn’t automatically integrate with other tools, but Obsidian can render diagrams with mermaid.js, and that supports Gantt-Charts. I seem to recall that there’s a plugin similar to Dataview, that actually inserts the text into the note, or probably you could set something up with Templater like @jeffschoonover suggested, but in any case, this might be a good starting point for you to keep digging!

Here is how I solved my problem. I have two vaults in different locations (one for each research project, I can’t have in the same vault because the project data are stored on different network drives) and I keep track of which process step my samples are on with canvases where each card is a step. (I also have corresponding markdown files for more detailed notes.) The in-progress steps I color yellow, and the completed steps green. I’m doing the coloring manually, but it is very fast.

My goal was a daily email sent to me (and anyone else on the team) listing all of the in-progress steps. This serves as a daily reminder to a)follow up with anything that is delayed and b) go in and update Obsidian. Note that I’m not trying to replace powerpoint, excel, emails, and other files that corporate America uses to document. Rather, I’m using Obsidian as a place to keep track of things and record information that is cumbersome in those other programs.

It wasn’t clear to me how to write a plugin that would query two different vaults and send an email, so I wrote a python script instead. The script finds and searches through all the canvas files in each vault, makes a list of all the yellow nodes, and sends an email through Outlook (which is always open on my computer). The python script is only 80 lines of code and if you want to use it I’m happy to share it. I have the built in Windows Task Scheduler run it every weekday at 8am to send that email.

I have no need of a gantt chart, so I know that this does not solve your original question. But for tracking the progress of multiple projects, staying on top of things and keeping everything moving forward, I find it quite useful.

1 Like

Hi Jeff,

This script you’re describing seems like it’d be very useful for my use case. Would you mind sharing the code?

Hi Quinn,

Here is a copy/paste of the python script. I have not made it an executable so you will need to install python on your computer in order to run it, which is free and pretty straightforward. Note that I’m on Windows 10.

I followed these instructions to have the script run every weekday at 8am with Windows task scheduler:
https://www.askpython.com/python/examples/execute-python-windows-task-scheduler

If you have any questions about it feel free to ask.

import win32com.client as win32
from pathlib import Path
import json



# List of Obsidian Vault directorys to query
# the r makes it a raw text file, need to include to properly handle the slashes

vault_1 = Path(r'\\your\network\path\here')
assert vault_1.is_dir(), f"Not a valid directory, or you don't have access to it: {vault_1}"

vault_2 = Path(r'C:\Users\your\local\path\here')  
assert vault_2.is_dir(), f"Not a valid directory, or you don't have access to it: {vault_2}"

vault_directories = [vault_1, vault_2]

email = [""]

for v in vault_directories:
    canvases = sorted(v.glob('**/*.canvas'))  #these are all the canvas files in this vault
    
    if canvases:
        email.append(f'{v.parts[-1]}:')
    else:
        email.append(f'No canvas files found in {v.parts[-1]}')
        continue
        
    for canvas in canvases:
        #open the canvas as a json object
        if ".trash" in canvas.parts: continue #skips all the files in the trash folder
        
        with open(canvas, 'r') as c:
            try:
                c_json = json.load(c)
            except:
                print(f'The file {canvas} is not a valid canvas file, skipping') 
                continue
        
        assert type(c_json) == dict, f"not a valid canvas file {c_json}, should return a Python Dictionary"
        assert type(c_json['nodes'] == list), f"not a valid canvas file {c_json}, does not have a nodes list"
        
        
        #Add the node info to the email
        for node in c_json['nodes']:
            if node.get('color') == "3":   # If the node has the color yellow (coded 3 in Obsidian)
                if node.get('type') == "text":
                    email.append("-" + canvas.parts[-1] + "-->" + node.get("text"))
                elif node.get('type') == "file":
                    email.append("-" + node.get("file"))
                elif node.get('type') == "link":
                    email.append("-" + node.get("url"))
                else:
                    email.append("-Unknown step type in canvas {canvas}, in vault {v}")
                    
    email.append("")


# Compose the email
email_str = ""
for line in email:
    email_str = email_str + str(line) + "\n"

print(email_str)    

# Send the email using Outlook.  This will be sent as a regular email from the account that is signed into Outlook
# Outlook must be open and connected in order for the email to send
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.Subject = 'In Progress (yellow) Obsidian canvas items'
mail.To = "[email protected]"  # I just have it sent to myself
mail.Body = f"""
    {email_str}
"""
mail.Send()
1 Like