๐Ÿ” Code Extractor

function test_attendee_extraction

Maturity: 46

A test function that validates the attendee extraction logic of the EnhancedMeetingMinutesGenerator by parsing a meeting transcript and displaying extracted metadata including speakers, date, and duration.

File:
/tf/active/vicechatdev/leexi/test_attendee_extraction.py
Lines:
11 - 48
Complexity:
moderate

Purpose

This function serves as a unit test to verify that the EnhancedMeetingMinutesGenerator correctly extracts attendee information and other metadata from meeting transcripts. It loads a specific transcript file, parses it, and outputs the extracted information including meeting date, duration, speaker list, and a preview of the transcript content. This is useful for debugging and validating the metadata extraction functionality during development.

Source Code

def test_attendee_extraction():
    """Test the improved attendee extraction logic"""
    
    # Initialize generator
    generator = EnhancedMeetingMinutesGenerator(model='gpt-4o')
    
    # Test with actual transcript
    transcript_path = '/tf/active/leexi/leexi-20250618-transcript-development_team_meeting.md'
    
    print("๐Ÿงช Testing improved attendee extraction...")
    print(f"๐Ÿ“„ Using transcript: {transcript_path}")
    
    try:
        # Load transcript
        with open(transcript_path, 'r', encoding='utf-8') as f:
            transcript = f.read()
        
        # Extract metadata
        metadata = generator.parse_transcript_metadata(transcript)
        
        print(f"๐Ÿ“… Meeting Date: {metadata['date']}")
        print(f"โฑ๏ธ Duration: {metadata['duration']}")
        print(f"๐Ÿ‘ฅ Actual Speakers Found: {len(metadata['speakers'])}")
        print("๐ŸŽค Speaker List:")
        for speaker in metadata['speakers']:
            print(f"  - {speaker}")
        
        # Show first few lines of transcript for context
        print("\n๐Ÿ“ First 10 lines of transcript for reference:")
        lines = transcript.split('\n')[:10]
        for i, line in enumerate(lines):
            if line.strip():
                print(f"  {i+1}: {line[:80]}...")
        
    except Exception as e:
        print(f"โŒ Error: {e}")
        import traceback
        traceback.print_exc()

Return Value

This function does not return any value (implicitly returns None). It prints test results and metadata to stdout, including meeting date, duration, speaker count, speaker names, and the first 10 lines of the transcript. If an error occurs, it prints the error message and full traceback.

Dependencies

  • enhanced_meeting_minutes_generator
  • traceback

Required Imports

from enhanced_meeting_minutes_generator import EnhancedMeetingMinutesGenerator
import traceback

Conditional/Optional Imports

These imports are only needed under specific conditions:

import traceback

Condition: only used when an exception occurs during test execution

Required (conditional)

Usage Example

# Direct execution of the test function
from enhanced_meeting_minutes_generator import EnhancedMeetingMinutesGenerator
import traceback

def test_attendee_extraction():
    generator = EnhancedMeetingMinutesGenerator(model='gpt-4o')
    transcript_path = '/tf/active/leexi/leexi-20250618-transcript-development_team_meeting.md'
    
    try:
        with open(transcript_path, 'r', encoding='utf-8') as f:
            transcript = f.read()
        metadata = generator.parse_transcript_metadata(transcript)
        print(f"Meeting Date: {metadata['date']}")
        print(f"Duration: {metadata['duration']}")
        print(f"Speakers: {metadata['speakers']}")
    except Exception as e:
        print(f"Error: {e}")
        traceback.print_exc()

# Run the test
test_attendee_extraction()

Best Practices

  • Ensure the transcript file path exists and is accessible before running the test
  • The hardcoded file path should be parameterized for better reusability across different environments
  • Consider using pytest or unittest framework instead of standalone test functions for better test management
  • Add assertions to validate expected outcomes rather than just printing results
  • Handle file encoding issues gracefully, especially for transcripts with special characters
  • The function assumes the EnhancedMeetingMinutesGenerator has a 'parse_transcript_metadata' method that returns a dictionary with 'date', 'duration', and 'speakers' keys
  • Consider adding cleanup code in a finally block if the generator needs resource cleanup
  • For production use, replace print statements with proper logging

Similar Components

AI-powered semantic similarity - components with related functionality:

  • function test_attendee_extraction_comprehensive 87.3% similar

    A comprehensive test function that validates the attendee extraction logic from meeting transcripts, comparing actual speakers versus mentioned names, and demonstrating integration with meeting minutes generation.

    From: /tf/active/vicechatdev/leexi/test_attendee_comprehensive.py
  • function main_v27 65.4% similar

    Entry point function that orchestrates the process of loading a meeting transcript, generating structured meeting minutes using OpenAI's GPT-4o API, and saving the output to a file.

    From: /tf/active/vicechatdev/meeting_minutes_generator.py
  • function test_mixed_previous_reports 63.5% similar

    A test function that validates the DocumentExtractor's ability to extract text content from multiple file formats (TXT and Markdown) and combine them into a unified previous reports summary.

    From: /tf/active/vicechatdev/leexi/test_enhanced_reports.py
  • class MeetingMinutesGenerator 62.6% similar

    A class that generates professional meeting minutes from meeting transcripts using OpenAI's GPT-4o model, with capabilities to parse metadata, extract action items, and format output.

    From: /tf/active/vicechatdev/meeting_minutes_generator.py
  • function main_v14 59.8% similar

    Command-line interface function that orchestrates the generation of meeting minutes from a transcript file using either GPT-4o or Gemini LLM models.

    From: /tf/active/vicechatdev/advanced_meeting_minutes_generator.py
โ† Back to Browse