VlrDevApi

events.match_summary()

Get aggregated match statistics for an event

Signature

import vlrdevapi as vlr

result = vlr.events.match_summary(
    event_id: int,
    timeout: float = 5.0
) -> MatchSummary | None

Parameters

Prop

Type

Return Value

Type: MatchSummary | None

Returns aggregated match statistics or None if not found.

Prop

Type

StageMatches fields:

Prop

Type

Examples

Get Match Summary

Get match summary
import vlrdevapi as vlr

# Get match statistics for an event
summary = vlr.events.match_summary(event_id=1189)

if summary:
    print(f"Event ID: {summary.event_id}")
    print(f"Total Matches: {summary.total_matches}")
    print(f"  Completed: {summary.completed}")
    print(f"  Upcoming: {summary.upcoming}")
    print(f"  Ongoing: {summary.ongoing}")
    
    # Calculate completion percentage
    if summary.total_matches > 0:
        completion = (summary.completed / summary.total_matches) * 100
        print(f"\nCompletion: {completion:.1f}%")
else:
    print("Match summary not available")

Monitor Event Progress

Monitor event progress
import vlrdevapi as vlr

summary = vlr.events.match_summary(event_id=1189)

if summary:
    # Check if event is active
    if summary.ongoing > 0:
        print(f" LIVE: {summary.ongoing} match(es) in progress")
    
    # Show remaining matches
    remaining = summary.upcoming + summary.ongoing
    if remaining > 0:
        print(f" {remaining} match(es) remaining")
    
    # Event completed
    if summary.completed == summary.total_matches:
        print(" Event completed!")

Track Event Completion Over Time

Track event completion over time
import vlrdevapi as vlr
import time

def monitor_event_progress(event_id, interval_seconds=60):
    """Monitor an event's progress over time"""
    print(f"Monitoring event {event_id} every {interval_seconds} seconds...")
    
    last_completed = 0
    
    while True:
        summary = vlr.events.match_summary(event_id)
        
        if not summary:
            print("Event not found or summary unavailable")
            break
        
        if summary.completed != last_completed:
            print(f"Progress update: {summary.completed}/{summary.total_matches} matches completed")
            last_completed = summary.completed
            
            if summary.completed == summary.total_matches:
                print(" Event completed!")
                break
        
        time.sleep(interval_seconds)

# Monitor an active event (run in background)
# monitor_event_progress(1189, 300)  # Check every 5 minutes

Compare Event Sizes

Compare event sizes
import vlrdevapi as vlr

def compare_events(event_ids):
    """Compare the scale of different events"""
    comparisons = {}
    
    for event_id in event_ids:
        summary = vlr.events.match_summary(event_id)
        if summary:
            comparisons[event_id] = {
                'total_matches': summary.total_matches,
                'completed': summary.completed,
                'completion_rate': (summary.completed / summary.total_matches * 100) if summary.total_matches > 0 else 0
            }
    
    return comparisons

# Compare multiple events
event_ids = [1189, 1190, 1191]  # Replace with actual event IDs
comparison = compare_events(event_ids)

print("Event Size Comparison:")
print("Event ID | Matches | Completed | Completion Rate")
print("-" * 50)

for event_id, stats in comparison.items():
    rate = f"{stats['completion_rate']:.1f}%"
    print(f"{event_id:8} | {stats['total_matches']:7} | {stats['completed']:9} | {rate:13}")

Create Progress Bar

Create progress bar
import vlrdevapi as vlr

def create_progress_bar(event_id, width=50):
    """Create a visual progress bar for event completion"""
    summary = vlr.events.match_summary(event_id)
    
    if not summary:
        return "Event not available"
    
    if summary.total_matches == 0:
        return "No matches scheduled"
    
    # Calculate progress
    progress = summary.completed / summary.total_matches
    filled_width = int(width * progress)
    bar = "#" * filled_width + "-" * (width - filled_width)
    
    percentage = progress * 100
    
    return f"""Event Progress: {summary.completed}/{summary.total_matches} matches
[{bar}] {percentage:.1f}%
Status: {'Completed' if summary.completed == summary.total_matches else f'{summary.ongoing} live, {summary.upcoming} upcoming'}"""

print(create_progress_bar(1189))

Predict Event Duration

Predict event duration
import vlrdevapi as vlr
from datetime import datetime, timedelta

def estimate_event_duration(event_id):
    """Estimate how long an event might take based on current progress"""
    summary = vlr.events.match_summary(event_id)
    
    if not summary or summary.total_matches == 0:
        return None
    
    # Get recent matches to estimate pace
    matches = vlr.events.matches(event_id, limit=20)
    
    if not matches:
        return None
    
    # Calculate average matches per day from recent matches
    recent_matches = [m for m in matches if m.date and m.status == "completed"]
    
    if len(recent_matches) < 5:
        return "Not enough data for prediction"
    
    # Group by date
    matches_per_day = {}
    for match in recent_matches:
        date_str = match.date.isoformat()
        matches_per_day[date_str] = matches_per_day.get(date_str, 0) + 1
    
    if not matches_per_day:
        return "No date data available"
    
    avg_matches_per_day = sum(matches_per_day.values()) / len(matches_per_day)
    remaining_matches = summary.total_matches - summary.completed
    
    if avg_matches_per_day > 0:
        days_remaining = remaining_matches / avg_matches_per_day
        estimated_completion = datetime.now() + timedelta(days=days_remaining)
        
        return f"""Event Duration Estimate:
Remaining matches: {remaining_matches}
Average pace: {avg_matches_per_day:.1f} matches/day
Estimated completion: {estimated_completion.strftime('%Y-%m-%d')}
Days remaining: {days_remaining:.1f}"""
    
    return "Cannot calculate estimate"

print(estimate_event_duration(1189))

Error Handling

This function returns None instead of raising exceptions, making it safe to use without try-catch blocks.

  • Network failures: Returns None
  • Invalid event ID: Returns None
  • No matches found: Returns None

Always check if the return value is not None before accessing properties.

Tips

  • The stages field is currently always an empty list [] (reserved for future implementation)
  • Use this function for quick event progress overview without fetching all match details
  • Combine with matches() to get detailed match information after checking the summary
  • All count fields (total_matches, completed, upcoming, ongoing) are always non-negative integers
  • The sum of completed + upcoming + ongoing should equal total_matches

Source

Data scraped from: https://www.vlr.gg/event/matches/{event_id}