function test_attendee_extraction
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.
/tf/active/vicechatdev/leexi/test_attendee_extraction.py
11 - 48
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_generatortraceback
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
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
function test_attendee_extraction_comprehensive 89.0% similar
-
function main_v15 65.0% similar
-
class MeetingMinutesGenerator 62.4% similar
-
function test_mixed_previous_reports 60.1% similar
-
class MeetingMinutesGenerator_v1 59.5% similar