emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: org and taskjuggler


From: Christian Egli
Subject: [Orgmode] Re: org and taskjuggler
Date: Mon, 15 Dec 2008 11:37:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Shelagh Manton <address@hidden> writes:

> One of the set tasks for the project scenario is to produce a Gantt
> chart.
>
> Or perhaps someone knows another way to get a Gantt chart out of
> org-mode data.

I'm using a very hackish "works-for-me" python script that converts a
tsv export from an org-mode file to a taskjuggler file. Probably has
lots of implizit assumptions which not even I remember.

The basic work-flow is to create your hierarchy of tasks, add some effort
estimates and some other properties, export this to a csv and run the
attached python script on it. This will generate a taskjuggler include
file (tji) which can be used in a main taskjuggler file (tjp).

You could use the following Makefile snippet to automate the process:

projectPlan.csv: projectPlan.org
        $(EMACS) -batch \
                 -eval "(progn (find-file \"$<\") (re-search-forward \"^| 
Task\") (org-table-export \"address@hidden"))" -kill

projectPlan.tji: projectPlan.csv
        $(CSV2TASKJUGGLER) < $< > $@

projectPlan.taskreport.html: projectPlan.tjp projectPlan.tji
        $(TASKJUGGLER) $<

Attached is the python script, an example org file and an example for a
tjp file. Let me know if this works for you. 

I meant to write a tutorial about this but you know how it is. Maybe you
could write one as you get this to work :-)

Hope this helps
Christian

# -*- mode: org; coding: utf-8 -*-
#+TITLE:     XMLP Project Plan
#+LANGUAGE:  en
#+OPTIONS:   H:2 num:nil toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t 
LaTeX:nil skip:t d:nil tags:not-in-toc
#+PROPERTY: Effort_ALL 0.5 1.0 2.0 3.0 5.0 8.0 10.0 15.0 20.0 25.0 40.0 50.0 
150.0 200.0
#+PROPERTY: Complete_ALL 0 50 100
#+PROPERTY: NoDepends_ALL True False
#+COLUMNS: %40ITEM(Task) %Effort(Estimated Effort) %Allocate %Account %Start 
%NoDepends %3Complete(Percent Complete) %Note %Priority

* XML-Project
  :PROPERTIES:
  :ID: XML-Project
  :Account: project_costs
  :Start: 2008-09-01
  :END:

** Fasttrack
  :PROPERTIES:
  :Allocate: team
  :END:
*** Iteration (Basics)
**** Specification
     :PROPERTIES:
     :Effort:   1.0
     :Complete: 100
     :END:
**** Plan 
     :PROPERTIES:
     :Effort:   0.5
     :Complete: 100
     :END:
**** Admin
***** Setup svn
      :PROPERTIES:
      :Effort:   1.0
      :Complete: 0
      :END:
**** Generate large print
***** Install Daisy pipeline
      :PROPERTIES:
      :Effort:   1.0
      :Complete: 100
      :END:
***** Enhance DTBook2Latex with variable font size
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** Enhance DTBook2Latex with language handling
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** Customize layout
      If the layout created by the Daisy pipeline converter is not
      what people want then this needs to be adjusted
       :PROPERTIES:
       :Effort:   2.0
      :Complete: 100
      :Note:     Canceled, To be done at a later stage
       :END:

***** Test
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** Documentation
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** Contribute improvements back to Daisy
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
**** Generate XHTML
***** Install Daisy pipeline
      :PROPERTIES:
      :Effort:   1.0
      :Complete: 100
      :END:
***** Run the DTBook to XHTML converter
      :PROPERTIES:
      :Effort:   0.5
      :Complete: 100
      :END:
***** Test the result
      :PROPERTIES:
      :Effort:   1.0
      :Complete: 100
      :END:
***** Customize layout
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :Note:     Canceled, To be done at a later stage
      :END:
**** Generate DTBs
***** Install narrator from Daisy pipeline
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** Install TTS
      :PROPERTIES:
      :Complete: 100
      :END:
***** Test
      :PROPERTIES:
      :Effort:   1.0
      :Complete: 100
      :END:
***** Documentation
      :PROPERTIES:
      :Effort:   1.0
      :Complete: 100
      :END:

**** Generate Braille (hard copy, grade 0 only)
***** Install liblouis + liblouisxml
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** adapt grade 0 table for swiss german
      :PROPERTIES:
      :Effort:   3.0
      :Complete: 100
      :END:
***** adapt the semantic action file for DTBook
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** Test
      :PROPERTIES:
      :Effort:   3.0
      :Complete: 100
      :END:
***** Documentation
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
***** Contribute improvements back to liblouis
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :END:
**** Primitive Web GUI
***** Implement
      :PROPERTIES:
      :Effort:   2.0
      :Complete: 100
      :Note:     Canceled. Was for demo and test purposes only. Replaced by 
Daisy Pipeline
      :END:
***** Test
      :PROPERTIES:
      :Effort:   1.0
      :Complete: 100
      :Note:     Canceled. Was for demo and test purposes only. Replaced by 
Daisy Pipeline
      :END:
**** Review/Presentation/Demo
     :PROPERTIES:
     :Effort:   2.0
     :Complete: 100
     :END:
**** Reporting
     :PROPERTIES:
     :Effort:   0.5
     :Complete: 100
     :END:

* Export
  :PROPERTIES:
  :TABLE_EXPORT_FORMAT: orgtbl-to-tsv
  :END:
#+BEGIN: columnview :hlines 1 :id "XML-Project"
| Task                                               | Estimated Effort | 
Allocate | Account       |      Start | NoDepends | Percent Complete | Note     
                                                                 | Priority |
|----------------------------------------------------+------------------+----------+---------------+------------+-----------+------------------+---------------------------------------------------------------------------+----------|
| * XML-Project                                      |                  |       
   | project_costs | 2008-09-01 |           |                  |                
                                                           |          |
| ** Fasttrack                                       |                  | team  
   |               |            |           |                  |                
                                                           |          |
| *** Iteration (Basics)                             |                  |       
   |               |            |           |                  |                
                                                           |          |
| **** Specification                                 |              1.0 |       
   |               |            |           |              100 |                
                                                           |          |
| **** Plan                                          |              0.5 |       
   |               |            |           |              100 |                
                                                           |          |
| **** Admin                                         |                  |       
   |               |            |           |                  |                
                                                           |          |
| ***** Setup svn                                    |              1.0 |       
   |               |            |           |                0 |                
                                                           |          |
| **** Generate large print                          |                  |       
   |               |            |           |                  |                
                                                           |          |
| ***** Install Daisy pipeline                       |              1.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Enhance DTBook2Latex with variable font size |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Enhance DTBook2Latex with language handling  |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Customize layout                             |              2.0 |       
   |               |            |           |              100 | Canceled, To 
be done at a later stage                                     |          |
| ***** Test                                         |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Documentation                                |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Contribute improvements back to Daisy        |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| **** Generate XHTML                                |                  |       
   |               |            |           |                  |                
                                                           |          |
| ***** Install Daisy pipeline                       |              1.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Run the DTBook to XHTML converter            |              0.5 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Test the result                              |              1.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Customize layout                             |              2.0 |       
   |               |            |           |              100 | Canceled, To 
be done at a later stage                                     |          |
| **** Generate DTBs                                 |                  |       
   |               |            |           |                  |                
                                                           |          |
| ***** Install narrator from Daisy pipeline         |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Install TTS                                  |                  |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Test                                         |              1.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Documentation                                |              1.0 |       
   |               |            |           |              100 |                
                                                           |          |
| **** Generate Braille (hard copy, grade 0 only)    |                  |       
   |               |            |           |                  |                
                                                           |          |
| ***** Install liblouis + liblouisxml               |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** adapt grade 0 table for swiss german         |              3.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** adapt the semantic action file for DTBook    |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Test                                         |              3.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Documentation                                |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| ***** Contribute improvements back to liblouis     |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| **** Primitive Web GUI                             |                  |       
   |               |            |           |                  |                
                                                           |          |
| ***** Implement                                    |              2.0 |       
   |               |            |           |              100 | Canceled. Was 
for demo and test purposes only. Replaced by Daisy Pipeline |          |
| ***** Test                                         |              1.0 |       
   |               |            |           |              100 | Canceled. Was 
for demo and test purposes only. Replaced by Daisy Pipeline |          |
| **** Review/Presentation/Demo                      |              2.0 |       
   |               |            |           |              100 |                
                                                           |          |
| **** Reporting                                     |              0.5 |       
   |               |            |           |              100 |                
                                                           |          |
#+END:
project foo "FOO" "1.0" 2008-09-01 - 2010-12-31

account project_costs "Project Costs" cost {
}

resource team "The team" {

        resource jane "Jane" {}
        
        resource joe "Joe" {}
}

include "projectPlan.tji"

taskreport "Gantt Chart" {
        headline "Project Gantt Chart"
        columns hierarchindex, name, note, start, end, effort, duration, cost, 
chart
        timeformat "%Y-%m-%d"
        loadunit days
        hideresource 1
}

resourcereport "Resource Graph" {
  headline "Resource Allocation Graph"
  columns no, name, chart
}

htmltaskreport "projectPlan.taskreport.html"{
        timeformat "%Y-%m-%d"
        columns hierarchindex, name, note, effort, completed, duration, start, 
end
}

htmlstatusreport "projectPlan.statusreport.html"{
}



#! /usr/bin/env python

import csv
import re
import sys

def openTask(id, name, effort, depends, allocate, account, start, complete, 
note, priority):
    print """task id%s "%s" {""" % ( id, name)
    if effort:
        print " effort %sd" % (effort)
    if depends:
        print " depends !id%s" % (depends)
    if allocate:
        print " allocate %s" % (allocate)
    if account:
        print " account %s" % (account)
    if start:
        print " start %s" % (start)
    if complete:
        print " complete %s" % (complete)
    if note:
        print " note \"%s\"" % (note)
    if priority:
        print " priority %s" % (priority)
 

def closeTask():
    print "}"
    

reader = csv.reader(sys.stdin, delimiter='\t', quoting=csv.QUOTE_NONE)
id = 1
oldLevel = 0
predecessors = range(10)

p = re.compile("(\*+) (.*)\Z")

for row in reader:
    task, effort, allocate, account, start, doDepends, complete, note, priority 
= row

    m = p.match(task)
    if m == None:
        continue
    level, taskName = m.groups()

    level = len(level)

    if level > oldLevel:
        openTask(id, taskName, effort, None, allocate, account, start, 
complete, note, priority)
        if not doDepends:
            predecessors[level] = id

    elif level == oldLevel:
        closeTask()
        openTask(id, taskName, effort, 
                 (None if doDepends else predecessors[level]), 
                 allocate, account, start, complete, note, priority)
        if not doDepends:
            predecessors[level] = id

    else:
        while oldLevel >= level:
            closeTask()
            oldLevel -= 1
        openTask(id, taskName, effort, 
                 (None if doDepends else predecessors[level]), 
                 allocate, account, start, complete, note, priority)
        if not doDepends:
            predecessors[level] = id

    oldLevel = level
    id += 1

while level > 0:
    closeTask()
    level -= 1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]