Spaces:
Sleeping
Sleeping
| """ | |
| 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}") | |