File size: 2,676 Bytes
d6f13c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
"""
Utility functions for the project assistant.
"""
from datetime import datetime
from pathlib import Path
from typing import List, Dict, Any


def format_date(date: datetime) -> str:
    """Format a datetime object for display."""
    if date is None:
        return "Unknown date"
    return date.strftime("%B %d, %Y")


def format_action_item(item: Dict[str, Any]) -> str:
    """Format an action item for display."""
    parts = []
    
    if item.get('assignee'):
        parts.append(f"**{item['assignee']}**:")
    
    parts.append(item['task'])
    
    if item.get('deadline'):
        parts.append(f"(by {item['deadline']})")
    
    return " ".join(parts)


def get_project_stats(meetings: List[Any]) -> Dict[str, Any]:
    """Calculate statistics across all projects."""
    stats = {
        'total_meetings': len(meetings),
        'total_action_items': 0,
        'completed_action_items': 0,
        'open_action_items': 0,
        'total_blockers': 0,
        'total_decisions': 0,
        'projects': {}
    }
    
    for meeting in meetings:
        project = meeting.project_name
        
        if project not in stats['projects']:
            stats['projects'][project] = {
                'meetings': 0,
                'action_items': 0,
                'blockers': 0,
                'decisions': 0
            }
        
        stats['projects'][project]['meetings'] += 1
        
        for item in meeting.action_items:
            stats['total_action_items'] += 1
            stats['projects'][project]['action_items'] += 1
            
            if item.completed:
                stats['completed_action_items'] += 1
            else:
                stats['open_action_items'] += 1
        
        stats['total_blockers'] += len(meeting.blockers)
        stats['projects'][project]['blockers'] += len(meeting.blockers)
        
        stats['total_decisions'] += len(meeting.decisions)
        stats['projects'][project]['decisions'] += len(meeting.decisions)
    
    return stats


def create_sample_meeting(project_name: str, output_path: Path) -> None:
    """Create a sample meeting note template."""
    template = f"""# Meeting: [Meeting Title]
Date: {datetime.now().strftime('%Y-%m-%d')}
Participants: [Name1, Name2, Name3]

## Discussion
[What was discussed in the meeting]

## Decisions
- [Decision 1]
- [Decision 2]

## Action Items
- [ ] [Person]: [Task description] by [deadline]
- [ ] [Person]: [Task description]

## Blockers
- [Blocker description]
"""
    
    output_path.parent.mkdir(parents=True, exist_ok=True)
    output_path.write_text(template)
    print(f"Created sample meeting template at {output_path}")