Overview
The Validator module provides comprehensive validation of individual events across four key criteria:- Date/Time - Is it a valid date? Is it in the future?
- Location - Is it in San Francisco / Bay Area?
- AI Related - Does the title/description indicate AI/ML content?
- Real Link - Is the URL valid and accessible?
Core Function
validate_event()
Performs comprehensive validation of a single event.Event title
Event date in various formats (e.g., “January 28, 2025”, “2025-01-28”)
Event location (city or venue name)
Event registration/info URL
Optional event description for additional AI keyword matching
If
True, performs HTTP request to verify URL is accessible. This adds latency but ensures URLs are live.ValidationResult with scores for each check and overall validity
Data Classes
ValidationResult
Result of validating a single event.Title of the validated event
Overall validity (True only if ALL checks pass)
Weighted total score (0-100) across all criteria
Whether date validation passed
Date validation score (0-100)
Human-readable date validation details
Whether location validation passed
Location validation score (0-100)
Human-readable location validation details
Whether AI keyword validation passed
AI relevance score (0-100)
Human-readable AI validation details
Whether URL validation passed
Link validation score (0-100)
Human-readable link validation details
Validation Functions
validate_date()
Validates event date and checks if it’s reasonable.Date string in various formats
(is_valid: bool, score: float, details: str)
Checks:
- Is it a parseable date?
- Is it in the future (or today)?
- Is it within reasonable range (next 6 months)?
"January 28, 2025""Jan 28, 2025""2025-01-28""01/28/2025""28 January 2025""Every Tuesday"(recurring events)
- Valid future date within 6 months: 100.0
- Valid but far future (>180 days): 75.0
- Recent past (within 7 days): 75.0
- Old past (>7 days ago): 25.0
- Recurring events: 100.0
- Unparseable: 0.0
validate_location()
Validates event location is in SF/Bay Area.Location string (city or venue name)
(is_valid: bool, score: float, details: str)
Location Tiers:
- San Francisco (100.0): san francisco, sf, soma, fidi, mission, castro, shack15, notion hq, anthropic, openai, agi house, south park commons, moscone
- Bay Area (80.0): menlo park, palo alto, mountain view, sunnyvale, cupertino, san jose, oakland, berkeley, fremont, redwood city, santa clara, stanford
- California (60.0): Any location with “ca” or “california”
- Online (70.0): online, virtual, zoom, youtube
- Other (0.0): Locations outside these areas
validate_ai_related()
Validates event is AI/ML related based on keywords.Event title
Optional event description
(is_valid: bool, score: float, details: str)
AI Keywords (case-insensitive):
Core AI/ML:
- ai, artificial intelligence, machine learning, ml, deep learning, neural network, llm, large language model
- gpt, claude, anthropic, openai, langchain, rag, transformer, diffusion, stable diffusion, midjourney, pytorch, tensorflow, hugging face, ollama
- nlp, natural language, computer vision, cv, reinforcement learning, generative ai, genai, agent, agents, autonomous, embedding, vector
- chatbot, copilot, automation, mlops, data science
- google ai, meta ai, microsoft ai, nvidia, ai makerspace, ai tinkerers, ai engineers
- 3+ keywords found: 100.0
- 1-2 keywords found: 80.0
- No keywords: 0.0
validate_link()
Validates event URL format and optionally checks accessibility.Event URL
If True, performs HTTP request to verify accessibility
(is_valid: bool, score: float, details: str)
Valid Event Domains:
- lu.ma, luma.com
- meetup.com
- eventbrite.com, eventbrite.co.uk
- partiful.com
- supermomos.com
- humanx.co
- nearcon.org
- daytona.io, compute.daytona.io
- Known platform: 100.0
- Unknown platform (but valid URL): 60.0
- HTTP 200 (if check_http=True): no change
- HTTP redirect (if check_http=True): no change
- HTTP error (if check_http=True): -20 points
- Cannot verify (if check_http=True): -10 points
- Invalid URL format: 0.0
Batch Validation
validate_events_list()
Validates a list of events.List of event dictionaries. Each event should have:
title: Event titledate: Event datelocation: Event locationurl: Event URLdescription: (optional) Event description
Whether to verify URLs via HTTP
list[ValidationResult] - Validation results for each event
Reporting
print_validation_report()
Prints a formatted validation report to console.List of validation results to report
Total Score Calculation
The total score is a weighted average of all four criteria:- Date: 25%
- Location: 25%
- AI Related: 25%
- Link: 25%
is_valid = True) ONLY if all four checks pass.
Constants Reference
SF_LOCATIONS
Locations within San Francisco (score 100.0):BAY_AREA_LOCATIONS
Bay Area locations (score 80.0):VALID_EVENT_DOMAINS
Known event platforms (score 100.0):Complete Example
Performance Considerations
HTTP Verification: Setting
check_http=True adds latency (typically 100-500ms per URL) but ensures URLs are live. Use sparingly or only in production validation.Batch Processing: Use validate_events_list() for multiple events to process them efficiently.Keyword Matching: AI keyword matching is case-insensitive and checks both title and description.