Skip to content

Schedule validation #365

Open
Open
@nickevansuk

Description

@nickevansuk

This issue actually likely contains a number of rules, and the various requirements below could be split into different rules in a number of ways. Generally it's better to keep rule files as focussed as possible, with a good separation of concerns between the validation being conducted by each file.

Validate recurrence rule from Schedule

The validator should include a rule that validates that a Schedule contains a valid iCal recurrence rule.

There's already schedule generation logic in the conformance services, so it should be easy to convert this into some validation logic for the same fields, creating an rrule.

Note the logic above does not include scheduleTimezone (which it definitely should), so this will need to be added.

If there are not enough properties to create an rrule (e.g. the rrule library might return an error saying this?), display #292

If the properties do not create a valid rrule, return an error from the rrule library that explains what’s wrong, as a FAILURE

Using the rrule, validate that all exceptDate values are actually part of the recurrence defined by the rrule, and produce a WARNING if any are outside of the rrule.

Also note this other rrule library that has better support for timezones, if the library used above is problematic https://www.npmjs.com/package/@rschedule/core - however it has much lower usage so the rrule library is preferred if possible.

The Bookwhen (http://data.bookwhen.com/) and Open Sessions (https://opensessions.io/openactive) feeds should contain good test data for this.

Validate specific properties within PartialSchedule (target only PartialSchedule)

  • validate that if a PartialSchedule includes startTime or endTime, it must also include scheduleTimezone, producing a FAILURE otherwise

Validate specific properties within Schedule (target only Schedule)

  • validate that idTemplate and urlTemplate include a {startDate} placeholder, and are valid .

  • validate that scheduledEventType is a valid Event subclass.

    • This should be achievable using subClassGraph as here, perhaps by loading in the model specified by the value using DataModelHelper, producing a FAILURE if not

Validate specific properties within Schedule and PartialSchedule (target both)

  • validate that repeatCount is a positive integer greater than zero

  • validate that scheduleTimezone matches a value from the IANA Time Zone Database.

    • A specific rule that targets scheduleTimezone and uses e.g. moment.tz.names() (which requires adding moment-timezone) to validate the entries, producing a FAILURE if the value does not match. Note this is a separate rule from the generic rrule validation as it also applies to PartialSchedule.

Also consider whether extending the below could be an approach to implementing any of the above:

See further documentation:

Metadata

Metadata

Assignees

Labels

ruleA rule suggestion for implementationschedule-relatedTicket relates to the correct and consistent indication of a time when an Event is occurring.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions