๐Ÿ” Code Extractor

function test_attendee_extraction

Maturity: 44

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 prints detailed information about the extracted speakers, meeting date, duration, 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 performs its testing by printing results to stdout, including extracted metadata, speaker lists, and error messages if any exceptions occur.

Dependencies

  • enhanced_meeting_minutes_generator
  • traceback

Required Imports

import sys
from enhanced_meeting_minutes_generator import EnhancedMeetingMinutesGenerator
import traceback

Usage Example

# Ensure the transcript file exists at the expected path
# Set up OpenAI API key
import os
os.environ['OPENAI_API_KEY'] = 'your-api-key-here'

# Import and run the test
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'
    
    print("๐Ÿงช Testing improved attendee extraction...")
    print(f"๐Ÿ“„ Using transcript: {transcript_path}")
    
    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"๐Ÿ‘ฅ Actual Speakers Found: {len(metadata['speakers'])}")
        print("๐ŸŽค Speaker List:")
        for speaker in metadata['speakers']:
            print(f"  - {speaker}")
        
        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}")
        traceback.print_exc()

# Run the test
test_attendee_extraction()

Best Practices

  • Ensure the transcript file exists at the hardcoded path before running this test
  • Configure OpenAI API credentials before executing the test
  • This function uses a hardcoded file path which should be parameterized for better reusability
  • The function prints to stdout rather than using a proper testing framework like pytest or unittest
  • Consider wrapping this in a proper test class with setup/teardown methods
  • Error handling is present but could be enhanced with more specific exception types
  • The function assumes the EnhancedMeetingMinutesGenerator has a parse_transcript_metadata method that returns a dictionary with 'date', 'duration', and 'speakers' keys

Similar Components

AI-powered semantic similarity - components with related functionality:

  • function test_attendee_extraction_comprehensive 89.0% 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_v15 65.0% 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
  • class MeetingMinutesGenerator 62.4% 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 test_mixed_previous_reports 60.1% similar

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

    From: /tf/active/vicechatdev/leexi/test_enhanced_reports.py
  • class MeetingMinutesGenerator_v1 59.5% similar

    A class that generates professional meeting minutes from meeting transcripts using either OpenAI's GPT-4o or Google's Gemini AI models.

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