Skip to content

Support Rich Event Properties in Ontology.Event #16

Description

@Inventrohyder

Issue: Support Rich Event Properties in Ontology.Event

Problem

I would like to propose enhancing the Event struct to support richer calendar properties. I am willing to implement these changes and submit a PR.

The current Ontology.Event struct currently supports a minimal set of properties (name, dates, location). When mapping from EKEvent, valuable information is lost, specifically:

  • Notes/Description
  • All-day status
  • Event status (confirmed, tentative, canceled)
  • Attendees and Organizer
  • Recurrence rules

This limits the ability for consumers (like iMCP) to provide a high-fidelity interface to calendar services, as they cannot read or write these common properties.

Proposed Solution

Update Ontology.Event to support these properties, aligning with Schema.org where possible and extending where necessary for pragmatic usage (e.g. isAllDay).

1. Update Event Struct

Add the following properties to Event.swift:

public struct Event: Hashable, Sendable {
    // ... existing properties ...

    /// A detailed description of the event (maps to EKEvent.notes)
    /// Schema.org: description
    public var description: String?

    /// True if the event is an all-day event
    /// Note: This is a custom extension as Schema.org doesn't have a direct boolean,
    /// but it is critical for correct calendar visualization and interaction.
    public var isAllDay: Bool?

    /// The status of the event
    /// Schema.org: eventStatus
    public var eventStatus: EventStatusType?

    /// The organizer of the event
    /// Schema.org: organizer
    public var organizer: Person?

    /// The attendees of the event
    /// Schema.org: attendee
    public var attendee: [Person]?

    /// The recurrence schedule
    /// Schema.org: eventSchedule
    public var eventSchedule: Schedule?
}

2. Add Support Types

EventStatusType (Enum)

public enum EventStatusType: String, Codable, Sendable {
    case eventScheduled = "https://schema.org/EventScheduled"
    case eventCancelled = "https://schema.org/EventCancelled"
    case eventPostponed = "https://schema.org/EventPostponed"
    case eventRescheduled = "https://schema.org/EventRescheduled"
}

Schedule (Struct for recurrence)
A simplified Schedule struct to capture basic recurrence rules.

public struct Schedule: Hashable, Codable, Sendable {
    public var repeatFrequency: String? // e.g. "P1D", "Daily" or ISO duration
    public var repeatCount: Int?
    public var byDay: [String]? // "MO", "TU"
    // Additional fields as needed for complex rules
}

3. Update EventKit Integration

Update init(_ event: EKEvent) in Event+EventKit.swift (or Event.swift) to map these new properties from EKEvent.

Implementation Details

  • Ensure Codable compliance includes these new fields in the JSON-LD output.
  • isAllDay can be encoded as a custom property or omitted from JSON-LD if strict compliance is required, though adding it is clearer.
  • EventStatusType values map to Schema.org URLs.

I am happy to submit a PR with these changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions