Skip to content

Adding Schedules #1457

Closed
Closed

Description

@ldodds

A quick proposal based on discussion in #240.

Schema.org doesn't currently have a way to express recurring events.

While it will always be useful to share data on individual instances, e.g. the event happening this Tuesday at 6pm. There are also scenarios where it is useful to be able to share a general rule, e.g. this event happens at 6pm every Tuesday.

Use cases include sharing data about physical activities, e.g. regular gym classes or similar events.

iCalendar already refines a model and terms for expressing recurring events. And this
is independently supported in libraries like rrecurjs. We could draw on this to define a similar model for schema.org

The proposal is to define a new schedule property, a EventSchedule type and some additional properties for describing the schedule.

The schedule property will be associated with Events. It will allow the description of a schedule, expressed as a recurrence rule for describing the frequency of upcoming events.

The EventSchedule type will have properties based on those in iCalendar. But in the below, the naming has been aligned with existing schema.org properties.

  • startTime - the existing property, date/time at which the schedule starts
  • endTime - existing property, date/time at which the schedule ends
  • frequency - "daily", "monthly", "yearly"
  • day - DayOfWeek
  • month - month of the year
  • hour - hour
  • minute - minute
  • count - optionally specfiy the number of recurring events
  • exceptionRule - repeating property, specifies date-times when the schedule doesn't apply, equivalent to exrule in ical

I think this covers the core aspects of a schedule. I may have missed something essential (am not an iCal expert) but I think this type of rule will cover many use cases so worth considering.

This structure can be easily expressed in, e.g. JSON-LD, but may be trickier in RDFa. I've not tried that yet, but wanted to float this for discussion.

Activity

  1. magico commented on Jan 9, 2017

    @magico

    Hi ldodds,

    Thanks for putting this together. I had some comments on your proposal:

    • startTime: if you’re referring to the date when the schedule starts then startDate may be more appropiate
    • endTime: as above. May be worth mentioning that if no endDate is specified then it’s assumed the event has been scheduled indefinitely
    • frequency: what’s the expected type here? An easy way may be to specify a number, so it knows how many to skip
    • day: a distinction between DayOfWeek (e.g. to create a schedule on every Monday) and DayOfMonth (a new type) may be useful.
    • hour & minute: I would use startTime and endTime instead, both with Time as the expected type
    • count: because we’re already specifying startDate, endDate, and the frequency, I am not sure we need count as it can be calculated.

    As mentioned above, DayOfMonth would be a new type that would have 1 to 31 as possibilities (http://schema.org/1, http://schema.org/2, http://schema.org/3, etc)

    Also, I would change the names around so eventSchedule is the property from Event and Schedule is the new type.

    I’ve put together some examples of how it may work with different schedules:

    Every 3rd Monday from 9am to 10am

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": “3",
          "day": "http://schema.org/Monday",
          “startTime": "09:00",
          “endTime": "10:00"
        }
    }
    </script>
    

    Every 1st and 15th of every month from 9am to 10am

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": "1",
          "day": [{"http://schema.org/1"},{"http://schema.org/15"}]
          “startTime": "09:00",
          “endTime": "10:00"
        }
    }
    </script>
    

    Every working day of the week twice, from 9am to 10am and then from 2pm to 3pm

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        [
         {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": "1",
          "day": [{"http://schema.org/Monday"},{"http://schema.org/Tuesday"},{"http://schema.org/Wednesday"},{"http://schema.org/Thursday"},{"http://schema.org/Friday"}]
          “startTime": "09:00",
          “endTime": "10:00"
         },
         {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": "1",
          "day": [{"http://schema.org/Monday"},{"http://schema.org/Tuesday"},{"http://schema.org/Wednesday"},{"http://schema.org/Thursday"},{"http://schema.org/Friday"}]
          “startTime": “14:00",
          “endTime": “15:00"
         }
        ]
    }
    </script>
    

    Thoughts?

  2. ldodds commented on Jan 16, 2017

    @ldodds
    ContributorAuthor

    Hi,

    • Specifying both start/end dates and time as you suggest seems reasonable to me
    • I'm fine either way with DayOfWeek or DayOfMonth. My reason for going with DayOfWeek is simply that it exists already and I was aiming for smallest set of changes.
    • replacing hour and minute with start/endTime also seems reasonable. Follows my above rule better or trying to use fewer properties. I specified several here to match iCalendar. I think its worth considering whether alignment with iCal is a good thing to preserve.
    • Agree that count can be calculated, but I don't see any harm in specifying exactly how many events will run. E.g. starting tomorrow we'll run 10 weekly events

    I'm not convinced by changing daily/weekly/monthly frequency indicators for numbers though. Specifying the unit seems clear to me.

  3. danbri commented on Jan 17, 2017

    @danbri
    Contributor

    This all looks pretty sensible. Any thoughts on how it relates to our existing (two!) mechanisms for opening hours?

  4. magico commented on Jan 17, 2017

    @magico

    I'm not convinced by changing daily/weekly/monthly frequency indicators for numbers though. Specifying the unit seems clear to me.

    @ldodds The only reason I suggested numbers as frequency indicators is because I didn't think the daily/weekly/monthly indicators would work as well with schedules such as "every 3 mondays". Happy to be proved wrong though.

  5. ldodds commented on Jan 20, 2017

    @ldodds
    ContributorAuthor

    I'll post an updated proposal here in next few days or so incorporating comments. @danbri I'll also highlight overlaps with opening hours.

  6. rdebourbon commented on Mar 13, 2017

    @rdebourbon

    This looks pretty good. My only lingering queries would be:

    1. Should the frequency be a ISO 8601 representation rather than an integer? This allows for the frequency to specified in various units including time components as appropriate. In the first example, it would be P3W (3 weeks), in the second (P1M), and in the third (P1W).
    2. Do we need to include actual duration and have some notion of setup / tear down time. I know at the moment, we're primarily looking at this from the customer opportunity side, where the setup/tear down time is of little consequence, but when it comes to determining availability, those blocks of time become very critical and do need to be factored in.
    3. High frequency activities - eg Golf. Typically, golf as an activity has a long duration, but is defined with a high frequency, low duration because the expected time spent at each hole is relatively short. In this instance, we tend to have see recurrence rules that specifies every N minutes between XX:XX and YY:YY on A/B/C/D/E days. I realise that this can be easily handled as per the last example with multiple days and times - I just have lingering queries about "potential bloat" in the data required to represent such a "common" schedule.
  7. danbri commented on Mar 13, 2017

    @danbri
    Contributor

    ping @ldodds - any updates?

  8. magico commented on Mar 13, 2017

    @magico

    Should the frequency be a ISO 8601 representation rather than an integer? This allows for the frequency to specified in various units including time components as appropriate. In the first example, it would be P3W (3 weeks), in the second (P1M), and in the third (P1W).

    This makes sense. +1

  9. ldodds commented on Mar 14, 2017

    @ldodds
    ContributorAuthor

    Revised Proposal

    THIS IS THE LATEST VERSION OF THE PROPOSAL.

    I've left the original proposal and discussion intact above, but will revise this comment in line with ongoing discussion. Please add comments below.

    Goal

    Provide a means to define scheduled events. The primary use case is to describe schedules for things like:

    • Meetups, e.g. a monthly tech meetup or business networking event
    • Gym classes or similar opportunities to be active

    The goal isn't to offer the full flexibility of iCalendar, so the features described here are a subset of iCalendars recurrence rules. Alignment with iCalendar is preserved where possible. It's a tried and tested model.

    Summary of Proposed Changes

    • Add new Schedule type for describing schedules
    • Add new eventSchedule property to associate an Event to a Schedule. The value can be an array to allow for definition of several schedules.
    • Add several new properties (see below) to help describe a Schedule

    eventSchedule

    Generally speaking it is preferable to publish data about individual events, but this isn't always helpful. For example it may be more useful to
    publish and share a schedule rather than an endless set of web pages.

    The eventSchedule property associates a Schedule with an Event.

    The property can be specified instead of a specific start and end time to indicate that the event occurs on a regular basis. All other aspects of
    a recurring event, e.g. its description, location, etc can be captured using existing properties.

    The value of the eventSchedule property can be a single Schedule or an array of Schedule instance to allow for multiple schedules to
    be specified.

    Schedule

    Schedules draw on the trade and tested approach defined in iCalendar. So, in line with iCalendar we need to specify

    1. the period during which the schedule is active
    2. the rule to use to decide when the next event(s) will take place
    3. any exceptions to the rule that can be used to indicate that an event won't take place. Broadly equivalent to iCalendar exrule.

    We can specify the period when an Schedule is active using existing properties:

    • startDate - Date or DateTime that the schedule starts, not the event
    • endDate - Date or DateTime that the schedule starts

    Instead of specifying an endDate we might instead want to specify how many events will take place:

    • count - optionally specfiy the number of recurring events. positive integer

    We can describe the rule for generating events using some additional new properties:

    • frequency - one of a fixed set of values: "hourly", "daily", "weekly", "monthly", "yearly"

    • interval - how often the events occur. a positive integer

    • byDay - day of the week. refers to a [DayOfWeek](https://schema.org/DayOfWeek)

    • byMonthDay - day of the month. positive integer, 1-31

    • byMonth - month of the year, 1-12

    We can define exception using a new property:

    • exceptDate - value is a Date or DateTime value, or an array of such values, that specifiy when an event won't take place. Can be repeated to describe multiple exception.

    Some iCalendar features that are not supported:

    • Specifying higher frequency events, e.g. byMinute or byHour
    • No way to define events that occur on specific week numbers (e.g. 3rd week in the year) or year days (Day 100)
    • Modifiers on rule values, e.g. so can't express "Last Monday of the Month"
    • No bySetPos support
    • rdate, e.g. listing individual dates when an event will occur. In Schema.org we can handle this by specifying multiple events or repeating date/date-time properties
    • exceptRule, e.g. defining a rule to capture exceptions

    Useful icalendar references on rrule and recur.

    Worked Examples

    Using those proposed by @magicomartinez

    Every 3rd Monday from 9am to 10am

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": "weekly",
          "byDay": "http://schema.org/Monday",
          "interval": 3,
          "startTime": "09:00",
          "endTime": "10:00"
        }
    }
    </script>
    

    The 1st and 15th of every month from 9am to 10am

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": "monthly",
          "byMonthDay": [1, 15],
          “startTime": "09:00",
          “endTime": "10:00"
        }
    }
    </script>
    

    Starting daily from 24th December, between 9am-10am for 10 occurances

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "frequency": "daily",
          "count": 10,
          “startTime": "09:00",
          “endTime": "10:00"
        }
    }
    </script>
    

    Every other day, from 24th December 2016, forever

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        {
          "@type": "Schedule",
          "startDate": "2016-12-24"
          "frequency": "daily",
          "interval": 2,
          “startTime": "09:00",
          “endTime": "10:00"
        }
    }
    </script>
    

    Every working day of the week twice, from 9am to 10am and then from 2pm to 3pm

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Event",
      "name": "Example",
      "eventSchedule":
        [
         {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": "daily",
          "byDay": ["http://schema.org/Monday","http://schema.org/Tuesday","http://schema.org/Wednesday","http://schema.org/Thursday","http://schema.org/Friday"]
          “startTime": "09:00",
          “endTime": "10:00"
         },
         {
          "@type": "Schedule",
          "startDate": "2016-12-24",
          "endDate": "2017-12-25",
          "frequency": "daily",
          "byDay": ["http://schema.org/Monday","http://schema.org/Tuesday","http://schema.org/Wednesday","http://schema.org/Thursday","http://schema.org/Friday"]
          “startTime": “14:00",
          “endTime": “15:00"
         }
        ]
    }
    </script>
    
  10. ldodds commented on Mar 14, 2017

    @ldodds
    ContributorAuthor

    @rdebourbon @magicomartinez I'm not sure it makes sense to specify frequency using the duration support in ISO 8601. Is there a reason to prefer that over the (revised) specification.

    @rdebourbon also there's already the duration property of an event. That could be specified on the Event rather than the schedule as normal.

    For setup/teardown, that might be something we need to consider as part of OpenActive as it doesn't necessarily apply to Schema.org's more general Event support?

  11. rdebourbon commented on Mar 14, 2017

    @rdebourbon

    @ldodds - My rationale around specifying it in something other than an integer was to avoid any potential confusion / misinterpretation around the original frequency as an integer. An ISO 8601 duration string also effectively combines frequency and interval into a single standard well described type.

    @ldodds - The duration of an event can vary at the session level. In fact, experience has taught me that quite a few properties typically defined at the event level can vary at the session level (eg location). An example of varying duration though is often encountered when defining schedules for peak / off peak periods - which again can have different recurrence rules. Eg Peak period sessions are 30minutes long every 30minutes between XX:XX and YY:YY on days F,Sa. Off peak they are 60minutes every 120minutes between AA:AA and BB:BB on days M,W,F. Noticing that Friday occurs in both peak & off-peak so needs complimentary recurrence rules defined depending on the actual dates involved.

  12. jamiefoale commented on Mar 14, 2017

    @jamiefoale

    Hi guys,

    Is there a way we can include a provision for bank holidays? Theres a big inconsistency between venues about whether they are / aren't open and I know many recurring activities are not held on bank holidays, but some are.

    It doesnt seem like it is on Schema.org but Im thinking something along the lines of
    “bankHoliday": "yes"

    Thanks

  13. nickmhalliday commented on Mar 14, 2017

    @nickmhalliday

    From an entirely non technical perspective - how do the proposals above - or whatever we incline towards get piloted or tested with some users? There is a bit of a risk in putting lots of work into features / formats that are not used and that we miss others that will be found useful. No doubt you have an approach to this already that I am not aware of.....

  14. rdebourbon commented on Mar 14, 2017

    @rdebourbon

    @jamiefoale I would expect that Bank Holidays and other closures would be handled via an "exceptDate" array of values. This allows for greatest flexibility from an underlying data structure. If we include a "bankHoliday" attribute we then potentially need to clarify how a particular data source determines bank holidays. In this instance a more generic exception list is probably easiest for everyone involved.

    Having said that, @ldodds, would it be a good idea to allow for an optional reason text for the exception so that venues / operators can distinguish between expected closures and unexpected changes to the schedule?

  15. nickevansuk commented on Mar 28, 2017

    @nickevansuk

    Great point @rdebourbon around cancellation, I wonder if that question can be framed even more broadly:

    Assuming we have a recurrence rule in place, how do we associate additional property values to a particular occurance. Examples include:

    • One occurance has moved to a different venue (most likely exceptDate on current event + a new event with different property values?)
    • One occurance has been cancelled (could be same as previous, with a new event with property of cancelled and the reason provided)
    • We want to specify the availability of each occurance, i.e number of spaces left (would this require separate events for each occurrence, would such events require all the properties filled out?).

    What this leads me to wonder is whether there's a parent-child model where the "master" event specifies a number of properties including a recurrence rule, and "override" events are provided in an array similar to exceptDate, but with an array of type Event. Each Event would inherit the properties of the master, and only include additional properties required (such as "cancelled" and "cancellation reason", or "location", or simply an "available spaces" integer).

    This would potentially reduce the size of data payload required to cater for e.g. Recurring sessions which include availability.

  16. 32 remaining items

  17. danbri commented on Aug 16, 2017

    @danbri
    Contributor

    Ok this is published now at schema.org (as 'pending', which means we want more review, discussion, implementor feedback e.g. w.r.t. mappings to ical, how to integrate with opening hours at least cross-referencing documentation, possible applicability in iot.schema.org, etc etc.).

    https://schema.org/docs/releases.html#g1457

    Let's leave this issue open to continue the discussion! Thanks Leigh et al for getting us to this milestone :)

  18. EdB2 commented on Feb 2, 2018

    @EdB2

    Here's hoping repeatCount and exceptDate won't be required. My purpose is 12-step recovery group meetings. These are not the type of schedule that has an end date (that we know of anyway). We say "Friday at 6PM" with an understanding that it will be every Friday (no exceptDate) forever (no repeatCount). For real-world context, once when the church we were in burned down we held our meeting in the parking lot until we could find a new home. The Schedule was kept, the Location eventually changed :)

    BTW just wrapping my tired old brain around this stuff. Way cool ... but dynamically calling all the meetings for the next week as "Events" seems silly ... so thanks much for the work y'all have done towards make a Schedule a thing :)

  19. thadguidry commented on Feb 2, 2018

    @thadguidry
    Contributor

    @EdB2 Everything is optional in Schema.org technically, its consumers of the data that place restrictions where they see fit.

    Ah, interesting use case with 12-step recovery groups ! Also, I see that use case as similar to perhaps a curriculum at a college where there's a final completion event of graduation after proceeding through all the courses (step 12 - "Carrying the message of the 12 Steps to others in need" is basically, "using the knowledge", just as students typically do after graduation.

    @danbri Perhaps this also brings about the need for a narrower type "CourseSchedule" based on evidence in issues:
    #195 - Course, CourseInstance, EducationEvent [Schema.org Course Extension]
    #930 - Request for suitable classes/properties to represent "school term"
    #1497 - Course Vocab add attribute to define expected time to take course

    ? dunno, but something we should investigate more within those 3.

  20. ldodds commented on Apr 19, 2018

    @ldodds
    ContributorAuthor

    @danbri can I suggest we close this issue? The original proposal is now part of pending. Further iteration can happen in separate issues?

    Can I ask what the process is for pending to move to live?

  21. nickevansuk commented on Jun 21, 2018

    @nickevansuk

    Sorry just to pick up as I noticed this was closed, two things to raise:

    duration and byDay

    Can I pick up on the above ( #1457 (comment))

    I notice that there is broad support and agreement in this thread for:

    1. duration being part of Schedule
    2. byDay accepting iCal format, e.g. "2TH"

    But neither of these seem to have made it through to pending (and both are useful, e.g. see openactive/modelling-opportunity-data#2 (comment)).

    Timezone

    One further issue we are starting to see with implementors creating significant errors: the current Schedule proposal does not include timezone.

    1. When does this Monday night class happen? 7pm during the summer and winter? 7pm what timezone?
      "eventSchedule": {
        "type": "Schedule",
        "repeatFrequency": "P1W"
        "byDay": "http://schema.org/Monday",
        "startTime": "19:00",
        "endTime": "20:00",
      }
    
    1. When does this Monday night class happen? 7pm in the winter and 8pm in the summer during daylight savings?
      "eventSchedule": {
        "type": "Schedule",
        "repeatFrequency": "P1W"
        "byDay": "http://schema.org/Monday",
        "startTime": "19:00Z",
        "endTime": "20:00Z",
      }
    
  22. linked-k commented on Sep 1, 2018

    @linked-k

    I'm not sure if this is the correct place but I also noticed a couple of few other things.

    There are some inconsistencies in the https://pending.schema.org/Schedule specs and examples as well as with the original proposal here.

    1. We have startTime/endTime missing, which could be represented as a Duration and I assume this is the reason why "eventSchedule" property is in there.
      However, the documentation of it and the examples doesn't match.
      On the other hand we have those mentioned in the release notes https://schema.org/docs/releases.html#g1457
      What's the idea there?

    2. startDate/endDate for the validity of the Schedule (not the Event duration), are also missing. what's the idea here?

    I also have a suggestion for exceptDate to accept Duration as a value, as in my case I need to express a period of holidays there.

  23. peter-dolkens commented on Sep 1, 2018

    @peter-dolkens
  24. danbri commented on Feb 19, 2019

    @danbri
    Contributor

    @ldodds can you help us with updating the spec if needed, and any evidence of adoption - especially consuming applications that use rather than just publish this vocabulary?

  25. GeertThijs commented on Apr 3, 2019

    @GeertThijs

    I have some questions:

    • Am I correct that Schedule is only useful if the event is repeating? Meaning that for a non-repeating event you use Event.startDate to document the beginning of the Event and for a repeating Event Schedule.startDate should be used?
    • Is the documentation of eventSchedule correct? It seems now that it is an attribute of Schedule, rather than an attribute of Event. The latter is suggested in the definition and in the examples. Meaning that eventSchedule should be added to Event and its range should not be Duration but Schedule.
    • Wouldn't it be better to adapt the definition of Schedule so that it can be used also as an attribute of things that are not Event's. Eg for a service or a public transit line and such. Especially (as suggested earlier in this discussion) if you plan to make OpeninghoursSpecification a subclass of Schedule.
  26. ldodds commented on Feb 28, 2020

    @ldodds
    ContributorAuthor

    @danbri I'm going to defer to @thill-odi who is leading the specification work on OpenActive and can give you concrete examples.

    A quick look at the current docs suggest that they aren't correct. They should mention start/end Time and Date.

    Basically, I'd expect Schema.org to be reflecting most, if not all of the recommended approach that we have in the OpenActive documentation:

    https://www.openactive.io/modelling-opportunity-data/#publishing-event-schedules

    OpenActive will likely have its own conformance criteria but I was hoping that the core Schedule model could end up in Schema.org.

    I notice that the id/url template stuff is also not yet in Schema.org. I think that's useful on consumer side.

  27. DamonHD commented on Oct 10, 2021

    @DamonHD

    Did I miss something? (Likely!)

    Is there any way yet of specifying the last Tuesday of every month? (Guess who has been asked to manage such an event and would now like to put up a page for with with correct metadata?)

    Is it byDay = "-1TU" and repeatFrequency= "P1M"?

    Rgds

    Damon

  28. m4rrc0 commented on Aug 4, 2024

    @m4rrc0

    For reference for anyone landing here looking for "last day of month" syntax, as far as I understand the docs, @DamonHD is correct because the docs for byDay says:

    Defines the day(s) of the week on which a recurring Event takes place. May be specified using either DayOfWeek, or alternatively Text conforming to iCal's syntax for byDay recurrence rules.

    And the iCal's docs says:

    Each BYDAY value can also be preceded by a positive (+n) or negative (-n) integer. If present, this indicates the nth occurrence of a specific day within the MONTHLY or YEARLY "RRULE". For example, within a MONTHLY rule, +1MO (or simply 1MO) represents the first Monday within the month, whereas -1MO represents the last Monday of the month.

    Meaning this should be valid.

    {
        "@type": "Schedule",
        "startDate": "2016-12-24",
        "endDate": "2017-12-25",
        "frequency": "P1M",
        "byDay": "-1FR",
        "startTime": "14:00",
        "endTime": "15:00"
    }

    It would be really useful to add a note to the byDay docs stating that this is the way to go for this kind of data.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions