hackforla / hackforla/peopledepot

Epic: Redesign event schema

Open
#88 40 comments 0 reactions 1 assignee Claimed by @fyliu View on GitHub
complexity: large draft epic feature: DB design p-feature: events PII: TRUE ready for dev lead research role: dev lead s: CTJ s: hackforla.org s: PD team s: VRMS size: 3pt
Dominant language
Python
Stars
14
Forks
37
Avg merge
9d 15h
Merged PRs (30d)
5

Description

### Dependency

- #173 to rename `recurring_event` table to `event` and make simple changes first

### Overview
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
- [x] discuss the pros/cons
- [x] compare to the existing design
- [x] present some scenarios where it does better
- new design related tasks
- [x] write down the final table design here. Added to the issue description.
- [x] modify the ERD
- [x] modify the spreadsheet
- [x] modify #173 to rename to `event`
- [x] close #47 since we will rename `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
- [x] #151
- [x] Revisit #55 to see if it's still relevant

### Resources/Instructions
- [rrule demo](https://jakubroztocil.github.io/rrule/)
- search for "data model for recurring calendar events"
- stackoverflow [answer](https://stackoverflow.com/a/38359184) - other answers could be useful as well
- iCalendar standard [RFC 5545](https://www.rfc-editor.org/rfc/rfc5545)
- Tim Shaker's [schema](https://github.com/tmshkr/vrms) is also worth referencing. It is modeled after google calendar

- Why it needs to be changed
- it's unnecessarily complex
- it only has weekly recurrence but no monthly like the CoP Leads meetings
- each recurring event instance doesn't need to generate a new database record, unless there's design considerations for doing so
- use the iCalendar standard rrule to define recurrence in a single field (replaces day_of_week, frequency_id (interval), fields missing(start_datetime, end_datetime, timezone, yearly, monthly, and more)
- unnecessary data duplication with location data fields. #55

### New Design

- It's mostly the same as the old one except the 3 core event tables are combined into one and the recurrences field is going to take care of the functionalities that were spread across the 3 tables. Some tables were dropped because the recurrences field also takes care of their functions.
- To edit the diagram, copy the link and replace `png` with `uml`.

![New Design](https://www.plantuml.com/plantuml/png/dLJDZjj63BxFKx2v-D0uG7DS1460jW62Ne8Yjs0XZ3MqnUveA70ekqvstxr3IPwrZNMBvY9p-7ty9_qXgnST--XM-O4I26Tqgv-qmnvXJnlnIUjx4qSSXCuqhUZQznkK2yrE45FLz5voVGpHKt9N_fsIHeHNduK7pXW0zvWK0cRQfLVEhI9k5PH1QDSLFGcsIfoSfJnuyJr4IgZ70O55EtQh5v21uz4UpfcvJxk8yFiKwBjp04KWFG8k6W20dodSmTvBstc1T-y-__7-_QoVI8rvROoou1yhddoFrN9M1Sojq61fNo7J19hW5Hibi_kjY5-Az94mXiLw56-c3QMcf-A1aiw8O3kAO6enty6VzJ7RpfGz1UIcvRJ52Mj6YNTGFZCSkPrzrsglgXc4_y9MR-ARCXOVy2Ly9lWGo2BuMFBVScKjS3zcROGZvefylR-8a3iUO_XtJliVb2S7a5WHb8SYVkae0sNG3g7bVaEfxbtF0QE30dajM59FQIO-Dxl0LehqK-l0fm2jB_eOJsxo6ollaq9Wp1OPyZWCB0gSS6sJddc5n7iKeO3vTU6q7VWC6LKfxS0NED1scfo23q4mPs2nyRsPjZPCLPrlS5tE6sly_zUqDc--mALzLZ5i4CeNqzXFzVxAgHHZgHT43uWpDZKeersaehNMRo9Q-mlv20FdJ4LHocUWBHoCSl1fkldfF82tMyZK3qOoXmxCsiEEEG1F-LwqetRZjDq_q8jw62zWooIQNsxetzxorPQaAlO9Ehz7kA9azLhYJGlyzluA_4R3bUkXuuHLTsFJf-kmOVK-80npIssd7Pnl_MlOZ6f9sG19pqTse1Z1nyW76BCDHd1B2Sq71Az-keXC0SjFm07B9vs2p25E1z7xesLoOD4E8lE31TkoWFd8wbFm4kWRXhhl5nVPsmhQpHONL3nucE-mu7iVANXbkTY59-TM-BUY91z1UQat7xDYxvOr6JFAIHQEU9AN_xxJS_whgsZROVlGK79kzhaEwyVlPmUug9yUrxAkctZYndNrlcZ6TGrmRYWSJmfxFWUrf8rZGP-rAy7ebVPeTqKMSMfkuhIU4Kwveo6xrH8Urbyx2W7JVJZBSZLvhz3udEtA4Zf7QjQhMRW4QsOtpIfm7MdvVT7e0wOmzl4V)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.