Skill-Details
gantt-chart
Explicitly generates construction project schedules and timelines.
Vor Nutzung prüfen
Die automatische Prüfung bewertet Relevanz, nicht Sicherheit oder Empfehlung. Lies vor der Nutzung die Quellanweisungen.
SKILL.md
Dieser Auszug wurde bei der Prüfung gespeichert. Die externe Quelle enthält die vollständige und aktuelle Version.
---
name: "gantt-chart"
description: "Generate Gantt charts for construction scheduling. Create visual project timelines with dependencies and progress tracking."
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw": {"emoji": "🎬", "os": ["darwin", "linux", "win32"], "homepage": "https://datadrivenconstruction.io", "requires": {"bins": ["python3"]}}}
---
# Gantt Chart Generator
## Business Case
### Problem Statement
Schedule visualization challenges:
- Complex task dependencies
- Progress tracking
- Critical path visibility
- Multi-level WBS display
### Solution
Generate interactive Gantt charts from schedule data with dependency visualization, progress tracking, and export capabilities.
## Technical Implementation
```python
import pandas as pd
from typing import Dict, Any, List, Optional
from dataclasses import dataclass, field
from datetime import date, timedelta
from enum import Enum
class TaskStatus(Enum):
NOT_STARTED = "not_started"
IN_PROGRESS = "in_progress"
COMPLETED = "completed"
DELAYED = "delayed"
ON_HOLD = "on_hold"
class DependencyType(Enum):
FS = "finish_to_start"
SS = "start_to_start"
FF = "finish_to_finish"
SF = "start_to_finish"
@dataclass
class Task:
task_id: str
name: str
start_date: date
end_date: date
wbs_code: str = ""
progress: float = 0 # 0-100
status: TaskStatus = TaskStatus.NOT_STARTED
assignee: str = ""
level: int = 0
is_milestone: bool = False
is_summary: bool = False
parent_id: str = ""
@dataclass
class Dependency:
predecessor_id: str
successor_id: str
dep_type: DependencyType = DependencyType.FS
lag: int = 0
class GanttChartGenerator:
"""Generate Gantt charts for construction scheduling."""
def __init__(self, project_name: str):
self.project_name = project_name
self.tasks: Dict[str, Task] = {}
self.dependencies: List[Dependency] = []
def add_task(self, task: Task):
"""Add task to chart."""
self.tasks[task.task_id] = task
def add_dependency(self, predecessor_id: str, successor_id: str,
dep_type: DependencyType = DependencyType.FS,
lag: int = 0):
"""Add dependency between tasks."""
self.dependencies.append(Dependency(
predecessor_id=predecessor_id,
successor_id=successor_id,
dep_type=dep_type,
lag=lag
))
def import_from_df(self, df: pd.DataFrame):
"""Import tasks from DataFrame."""
for _, row in df.iterrows():
task = Task(
task_id=str(row['task_id']),
name=row['name'],
start_date=pd.to_datetime(row['start_date']).date(),
end_date=pd.to_datetime(row['end_date']).date(),
wbs_code=str(row.get('wbs_code', '')),
progress=float(row.get('progress', 0)),
level=int(row.get('level', 0)),
is_milestone=bool(row.get('is_milestone', False)),
is_summary=bool(row.get('is_summary', False)),
parent_id=str(row.get('parent_id', ''))
)
self.add_task(task)
def get_project_range(self) -> tuple:
"""Get project date range."""
if not self.tasks:
return (date.today(), date.today())
min_date = min(t.start_date for t in self.tasks.values())
max_date = max(t.end_date for t in self.tasks.values())
return (min_date, max_date)
def get_duration(self, task_id: str) -> int:
"""Get task duration in days."""
task = self.tasks.get(task_id)
if task:
return (task.end_date - task.start_date).days + 1
return 0
def generate_text_gantt(self, width: int = 60) -> str:
"""Generate text-based Gantt chart."""
if not self.tasks:
return "No tasks"
lines = []
start, end = self.Vollständige Quelle auf GitHub lesen (öffnet externe Seite)