Skip to content

Instantly share code, notes, and snippets.

@neubig
Last active April 16, 2025 12:33
Show Gist options
  • Save neubig/b16376d9c5f8eea38986478384faa267 to your computer and use it in GitHub Desktop.
Save neubig/b16376d9c5f8eea38986478384faa267 to your computer and use it in GitHub Desktop.
Create ics format calendar files for NAACL 2025
# Export your NAACL 2025 events into ics format
# 1. Go to the NAACL schedule and download it as a csv: https://docs.google.com/spreadsheets/d/1SXIF0ovLudQ4UvR0nTyagDcgnn9zdulhUY578mvQpRk/edit?gid=1679189789#gid=1679189789
# 2. Change MY_NAME below and run the program
# 3. Go to "Settings" in Google Calendar, click Import/Export, and import the file to your calendar
MY_NAME = "Neubig"
import csv
import os
from datetime import datetime
from icalendar import Calendar, Event
import pytz
# Define the path to the CSV file
csv_file_path = "NAACL 25 Paper Assignments for Program - All Papers.csv"
# Function to create an iCalendar event
def create_ical_event(row, cal):
# Extract relevant information
paper_id = row.get('Paper ID', '')
title = row.get('Title', '')
authors = row.get('Authors Names', '')
presentation_type = row.get('How Paper is being presented', '')
location = row.get('Room Location', '')
session_date_str = row.get('Session Date', '')
session_time_str = row.get('Session time', '')
start_time_str = row.get('Start Time', '')
end_time_str = row.get('End Time', '')
# Skip if essential data is missing
if not all([title, session_date_str, start_time_str, end_time_str]):
print(f"Skipping paper {paper_id} due to missing essential data")
return None
# Create event title
event_title = f"{presentation_type}: {title}"
# Parse date and time
try:
# Format: "Friday May 2" for date, "09:00-10:30" for session_time, "9:00" for start_time
# Extract year from the current date (assuming 2025 based on the task)
year = 2025
# Parse the date string
date_obj = datetime.strptime(f"{session_date_str} {year}", "%A %B %d %Y")
# Parse the start and end times
start_time_obj = datetime.strptime(start_time_str, "%H:%M").time()
end_time_obj = datetime.strptime(end_time_str, "%H:%M").time()
# Combine date and time
start_datetime = datetime.combine(date_obj.date(), start_time_obj)
end_datetime = datetime.combine(date_obj.date(), end_time_obj)
# Set timezone to Albuquerque time (Mountain Time)
mountain = pytz.timezone('America/Denver')
start_datetime = mountain.localize(start_datetime)
end_datetime = mountain.localize(end_datetime)
except Exception as e:
print(f"Error parsing date/time for paper {paper_id}: {e}")
return None
# Create calendar event
event = Event()
event.add('summary', event_title)
event.add('dtstart', start_datetime)
event.add('dtend', end_datetime)
event.add('location', location)
event.add('description', f"Authors: {authors}\nPaper ID: {paper_id}\nNote: Times are in Albuquerque (Mountain) time.")
# Add the event to the calendar
cal.add_component(event)
return True
# Process the CSV file
neubig_papers = []
with open(csv_file_path, 'r', encoding='utf-8') as file:
# Skip the first line (support email)
next(file)
# Read the CSV file
reader = csv.DictReader(file)
# Filter for rows with MY_NAME as an author
for row in reader:
authors = row.get('Authors Names', '')
if MY_NAME in authors:
neubig_papers.append(row)
print(f"Found {len(neubig_papers)} papers with Neubig as an author")
# Create a single calendar for all events
cal = Calendar()
cal.add('prodid', '-//NAACL 2025 Calendar - Papers//openhands.ai//')
cal.add('version', '2.0')
cal.add('x-wr-calname', 'NAACL 2025 - Papers')
cal.add('x-wr-timezone', 'America/Denver')
cal.add('description', 'Calendar of NAACL 2025 presentations. All times are in Albuquerque (Mountain) time.')
# Add events to the calendar
events_added = 0
for paper in neubig_papers:
result = create_ical_event(paper, cal)
if result:
events_added += 1
print(f"Added {events_added} events to the calendar")
# Save the calendar to a file
output_file = "naacl_all_events.ics"
with open(output_file, 'wb') as f:
f.write(cal.to_ical())
print(f"Calendar file has been saved to {output_file}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment