Open fyliu opened 2 years ago
I meant to be farther along before presenting this, but since you're also looking at this, this is what I have so far.
The recurring event model need fixing.
It does not adequately support common recurring event cases. This problem is easily addressed by adding an rrule field and possibly a couple other fields.
It supports only weekly recurrences, which is most of team meetings, except some that are 2nd Tuesdays, for example.
RRULE:FREQ=WEEKLY;BYDAY=WE
It doesn't support one-time events, but puts them in a separate table. event
vs recurring_event
RRULE:COUNT=1
It doesn't support weekly except first week of the month CoP events
RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=2WE,3WE,4WE,5WE
It doesn't support monthly CoP leads events
RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=1WE
It doesn't support biweekly alternating weekdays onboarding events (onboarding)
DTSTART[0]:20230221T122700Z
RRULE[0]:FREQ=WEEKLY;INTERVAL=2;BYDAY=TU
DTSTART[1]:20230227T122700Z
RRULE[1]:FREQ=WEEKLY;INTERVAL=2;BYDAY=MO
Question about event instance design: is there a strong reason for keeping record of each event instance for recurring events? Seems like a lot of duplication.
Question: How badly do we want to support having a single recurring event to happen Monday or Tuesday for alternating weeks? We can implement this using 2 rrules in one event. "Normal calendar apps like Google and Apple don't allow this, probably because not many people would use it. It's not a lot of work to do. It's not possible to do with a single one. Example for 2 separate events in google calendar
@fyliu I think we can use django-recurrence to simplify this. I'm testing this currently.
Update: I've tested this and it works. There is an error in the installation instructions so I've created this pr in their repo to correct.
@chelseybeck this looks like exactly what we need. It even handles multiples rrules, which would allow us to have a single event for the slightly complex onboarding schedule, which Google calendar doesn’t support.
Great work finding this! This is what I meant for this issue to do, which is to get rid of all the extra tables and have just the event table doing everything and working better than before. This package does all the heavy lifting for us. Maybe we’ll need another model for overriding single occurrences, to store overwritten fields like different url or different address or changed time. I’m not sure if this package has a recommendation for doing that. Maybe the override part could be designed later if it’s not easy.
That bug is kind of weird since the project says it tests against django 4. The PR may need some kind of guard to work for the several Django versions they support before they will accept it. Or if all their tests passed with the bug, then maybe it needs one more test. Oops, I misread the PR. You're trying to update their docs.
Product to make issues for
For reference: Fang's visual comparisons between the current and new table designs. django-recurrence will make it even simpler.
Moving this here to clean up Bonnie's original comment above.
- does DR (Django-recurrence) replace this issue Create Table: cancelled_event #57
- In a word, NO. But we can make it work. See the next point.
- Functionally, we don't need a list of cancelled events that #57 would provide. We really need a list of "all" events, including cancelled ones. DR doesn't come with a way to return all events including cancelled ones. It only does the "smart" thing and return all included events minus all excluded ones. Given it provides so much out of the box (models, managers, wrapper code around dateutil.rrule.rrule and rruleset, etc.), I think we still want to keep it rather than implement our own. The way I see it is we have options to give us the cancelled events we need, with tradeoffs.
- add the functionality in DR to return all events with cancellation status. There are sub-options in this and we have flexibility to choose one that best fits our needs. This is the place to modify.
- we can make the default behavior do what we want, which is to return the unfiltered events list with an added field for whether or not each one is cancelled. This is okay since we're the only one using this modified code. It'll break the existing tests because we're modifying the underlying assumptions about the behaviors of that code. On the up side, it's cleaner when we use it. We just call the same interface and it does exactly what we want. We can fix the broken tests too.
- we can leave the default behavior that gives us all the non-cancelled events, and add a separate function to give us only the cancelled events. Code-wise, this is cleaner. It leaves the existing code and tests that go along with them. Interface-wise, This is messier, since it adds a little extra work when we use it, since we would need to combine the lists. Ultimately, it's up to how VRMS wants the data. It could be that they also need just the cancelled events for one of their displays.
- add an exdate array (list of excluded dates, meaning cancelled events) outside of DR RecurrenceField and don't set the exdate field inside RecurrenceField. This will make DR give us all the event dates and we manually apply the cancelled dates. This is less good since it means having an extra field, but it means we can use the RecurrenceField without modification. It's also less good if we consider the case where we want to use the exrule (recurrence rule that is an exclude, like NOT on the first Wednesdays of the month)
- We should discuss these options as a team to see what we think of each one. We should also talk to VRMS about what they need from this.
I created an issue to work on this
@Neecolaa and I decided to rename the recurring_event
table to event
since that's what the new event
table is actually doing. I'm adding notes to related issues that should be informed of this redesign.
Since this is an epic issue, we need to
event
model.I think this needs some more work to create work issues. Moved to New Issues with Draft label.
I started a thread to compare a new option that showed up recently at
Their differences are not small, and we'd have to use each in a different way.
A GH discussion feels like a good place to hold this information. We can copy a summary of it to the top of this issue later.
Progress update
Progress:
Blockers: It'd be better if I have a clearer set of our Event requirements for evaluating the packages.
Availability: M-Th next week
ETA: Maybe next week
Pictures or links* (if necessary): Discussion link from above.
Status update:
@fyliu I don't know whether your last status update was from before or after last week's team meeting but just in case, here's the usual update request:
Please provide update
Progress: I haven't been able to work on this the past week. I'll make sure to spend time on this this coming week. Blockers: None Availability: M-Th a few hours during the day ETA: Next week
recurrence
is the best match for what we want, because it has support for exrules
.
Dependency
173 to rename
recurring_event
table toevent
and make simple changes firstOverview
As database architects, we would like to make sure the schema is designed well and adhere to good relational design. The current event tables are modeled after the old VRMS non-relational database, and doesn't fit some normal use cases very well as well as having data duplication. We need to redesign it to be simpler, more useful, with no data duplication, and follow the iCalendar (not related to Apple) standard.
Action Items
[x] Research. Read through a few designs
[x] Create a design that includes the use of the django-recurrence field
Propose the design at a meeting
new design related tasks
event
recurring_event
to it in #173[x] close #55 if we don't need it anymore
[ ] review #57 and close if we don't need it anymore
[ ] #151
[x] Revisit #55 to see if it's still relevant
Resources/Instructions
rrule demo
search for "data model for recurring calendar events"
stackoverflow answer - other answers could be useful as well
iCalendar standard RFC 5545
Tim Shaker's schema is also worth referencing. It is modeled after google calendar
Why it needs to be changed
New Design
png
withuml
.