slice icon Context Slice

Extracting Flights from Calendar

Guide for identifying actual flight events in Google Calendar and extracting structured data.

Event Patterns

Flight events in Google Calendar typically appear in these formats:

Title patterns:

  • "Flight to Paris" or "Flight: SFO to CDG"
  • "SFO → CDG" or "SFO -> CDG" or "SFO - CDG"
  • "UA 837 to Paris" (airline + flight number)
  • "London trip - outbound" (trip-based naming)

All-day vs timed:

  • All-day events typically mark the travel day
  • Timed events may have actual departure time
  • Check description for specific times if event is all-day

Location field:

  • May contain airport name: "San Francisco International Airport"
  • May contain airport code: "SFO"
  • May contain city: "San Francisco"

Description field:

  • Often contains confirmation number
  • May have full itinerary pasted from booking email
  • Check for flight numbers, times, gates

Identifying Actual Flights

Use inference judgment to distinguish flights from other events:

Is a flight:

  • Contains airport codes (3 uppercase letters)
  • Has arrow pattern suggesting route (→, ->, -)
  • Mentions specific airlines or flight numbers
  • Location is an airport
  • Description mentions boarding, gate, terminal

Is NOT a flight:

  • Meeting at an airport (work meeting)
  • "Pick up from airport" (ground transport)
  • "Flight delayed" reminder (meta-event)
  • Train or bus travel (even if has route pattern)
  • Video call about travel plans

Extracting Details

For each confirmed flight event, extract:

Field Source Example
Departure City Title, location, or description "SFO", "San Francisco"
Arrival City Title (after arrow) or description "CDG", "Paris"
Departure Date Event start date 2024-01-15
Departure Time Event start time (if timed) 10:30
Arrival Date Event end date or same as departure 2024-01-16
Arrival Time Event end time or from description 07:00
Airline Title or description "United", "UA"
Flight Number Title or description "UA 837"

Output Format

Use the same JSON format as email extraction for easy merging:

{
  "source": "calendar",
  "confirmationCode": null,
  "airline": "United",
  "flightNumber": "UA 837",
  "departureCity": "San Francisco",
  "departureAirport": "SFO",
  "departureCountry": "USA",
  "departureDate": "2024-01-15",
  "departureTime": "10:30",
  "arrivalCity": "Paris",
  "arrivalAirport": "CDG",
  "arrivalCountry": "France",
  "arrivalDate": "2024-01-16",
  "arrivalTime": "07:00"
}

Merging with Email Data

When combining calendar flights with email flights:

  1. Match on: same date + same route + same flight number (if available)
  2. Prefer email data for confirmation codes (calendars rarely have them)
  3. Prefer calendar data for times if email only has dates
  4. Keep both sources noted for provenance