A good guide to event calendaring / scheduling?
In an application I am developing, the user must be able to define rather complex event scheduling (continuous time block and daily time blocks, exception date / time, recurrence patterns, etc.).
Does anyone know of a good design page for such a thing on the web? For example, I was very impressed with this page's description of how to do database audit logs and would like something like this.
Current thinking
- My database will contain the following tables: Events and ScheduleItems
- The interaction will consist of events {1 - 0 .. *} ScheduleItems
- Events would have the following columns: eventId, schedulePattern
- ScheduleItems will have the following columns: eventId, startDateTime, endDateTime
- Front panel controls allow the user to define general rules (daily / continuous, include / exclude holidays, start / end date / time, etc.). If they are not satisfied with the existing controls, they can then choose to display and manually adjust the generated "time blocks"
- When saving the event schedule ...
- If only the provided controls were used (no customization), I would store their selection as a template in the Events table (e.g. sd: 2010-04-28; st: 09: 20: 00; ed: 2010-05-12; et : 17: 20: 00; r: 2w [M-Th]; z: EST "etc.).
- If the user manually changed the generated timeblocks, I would store each individual timeblock in the ScheduleItems table and provide Events.schedulePattern with a custom code ("MANUAL" or whatever).
Pros
I should be able to save> 90% of the events via the template field directly and be able to handle any other corner cases via the brute force ScheduleItems table. Since some of the processed cases involve events that can last for months (which would otherwise result in a very large number of time blocks), having on a single line is pretty attractive.
Against
This is a pretty tricky decision; any other system requiring this data must be able to handle parsing the SchedulePattern and also know when to retrieve ScheduleItems.
a source to share
"schedulePattern", in a mature way, uses Cron to keep the users' schedule, is a good idea to complete the task.
This format is simple but complex. In a relational database, there will be some performance advantage if you split each Cron "record" into a table column with appropriate indexes.
However, the effort is to translate between this format and the user interface. And the original data for which user input should be recorded initially.
I would design two kinds of table, one for the raw data entered by the user, the other for running a task for a schedule.
a source to share