Skip to content

Add recurrence/schedule

Planned events may recur on a defined schedule. Example: a road tunnel is closed for maintenance every night from 22:00 to 5:00 for a set period of time. It is open during the day, and also over the weekend (say, Friday night to Monday morning).

Forecasts follow a similar pattern. Here, events may even differ based on time: for example, slow traffic on weekdays 8:00–9:00, heavy traffic on weekdays 7:00–8:00 and 9:00–10:00.

TraFF 0.8 does not provide a way to model that: we would need to create separate events for each occurrence, which is not efficient.

A solution would need:

  • a data model for recurrence (on certain days during certain hours)
  • a way to encode events so they do not get misinterpreted by older TraFF implementations which do not support schedules
  • proper timezone information, as schedules are typically given in local time
    • not only UTC offset, but also DST switchover dates (at least for the validity period of the message)
    • preferably without relying on a local timezone database

OSM opening hours have a similar use case. The model is quite complex but should cover the vast majority of use cases. Some adaptations may be necessary.

This could be solved by adding a new tag, e.g. schedule. For backward compatibility, events affected by the schedule could be moved into that element, causing older parsers to ignore them. This also allows multiple schedule with multiple events.

Start and end time would retain their meaning, i.e. the events would only be valid between start and end time, and as indicated by the schedule.

For example:

<message id="sample:5.1.1:5.1.1327.n.1" receive_time="2025-02-15T21:01:28+01:00" update_time="2025-02-15T21:07:00+01:00" start_time="2025-03-01T00:00:00+01:00" end_time="2025-04-01T00:00:00+02:00" expiration_time="2025-04-15T22:22:00+02:00">
  <location>
    ...
  </location>
  <!-- TODO time zone not represented -->
  <schedule value="Mo-Fr 08:00-09:00">
    <events>
      <event class="CONGESTION" type="CONGESTION_SLOW_TRAFFIC"/>
    </events>
  </schedule>
  <schedule value="Mo-Fr 07:00-08:00,09:00-10:00">
    <events>
      <event class="CONGESTION" type="CONGESTION_HEAVY_TRAFFIC"/>
    </events>
  </schedule>
</message>