ProjectSidewalk / SidewalkWebpage

Project Sidewalk web page
http://projectsidewalk.org
MIT License
80 stars 23 forks source link

Prepares back end for validating severity and tags #3525

Closed misaugstad closed 3 months ago

misaugstad commented 3 months ago

Partially addresses #2575 Partially addresses #2859

Sets up our back end to be able to accommodate a new UI that will allow users to validate labels' severity and tags! I'm merging the back end portion now because it includes some changes to the database that will make it easier to write some back end queries, and I have some other tasks I need to do soon that would benefit from these changes!

Changes to the database include:

  1. Adding a new label_history table to keep track of changes to the severity and tags for a label over time.
  2. Replacing the label_tag table with a tags column in the label table. The tags column is an array of strings (TEXT[] in SQL). This simplifies a lot of queries because it removes the need to left join the label_tag table and group by to get the list of tags. Updating the tags is slightly harder, but it is worth the tradeoff.
  3. Adding a user_id column to the label table. This also simplifies a lot of queries. We often want to know something about the labels added by a given user, or grouped by a user. We no longer have to do a circuitous join with the audit_task or mission table to figure out who added each label.
  4. Adds old_severity, new_severity, old_tags, and new_tags columns to the label_validation table, preparing to record the changes that users make through the new Validate UI.
Before/After screenshots (if applicable)

No visual changes!

Things to check before submitting the PR