ProjectSidewalk / SidewalkWebpage

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

Validate prioritizes label types based on need, other Validate fixes #3515

Closed misaugstad closed 3 months ago

misaugstad commented 3 months ago

Resolves #2530 Fixes #3513

This PR ends up doing a few related things since they came up while I was already working on this...

  1. We now prioritize which label type to choose for a Validate mission based on need. Each of our 6 primary label types have at least a 3% chance of being selected (if there are any such labels left for the user to validate). The remaining probability of being chosen is split up proportionally based no the number of labels remaining of that label type that either has no validations or needs a tie breaking vote. As before, we only assign No Sidewalk missions if there is nothing available for the other label types. As an example, I tested on my Seattle db dump, and the probabilities for the various label types were: 48% Curb Ramp, 15% Missing Curb Ramp, 9% Obstacle, 21.5% Surface Problem, 3.5% Crosswalk, and 3% Pedestrian Signal. We'll be validating a lot of curb ramps for awhile here while we catch up!
  2. I tweaked the label prioritization algorithm for choosing labels to validate as well, and you could even consider it fixing bugs in the algorithm. Both of these changes increased the frequency that I saw labels that actually needed validations in local testing:
    1. We have been giving a label higher priority if the user who labeled it has fewer than 50 labels validated... But I didn't add the condition that the label in question still required a validation itself! I've added that condition so we don't repeatedly validate a label just bc a user doesn't have 50 labels to validate.
    2. We were adding a weight that was proportional to the number of validations: 100 / (1 + validation_count). I've adjusted this to consider how far we are from consensus instead of how far we are from having no validations: 100 / (1 + abs(agree_count - disagree_count)).
  3. Fixed mobile validate not showing new mission after the first (#3513).
  4. I added label ID to the Admin Validate page.
  5. I added the Admin Validate info to the admin versions of the LabelMap popup. Visible on Admin page "Map" tab, admin user dashboard, etc... anywhere that shows the Label Map popup except for LabelMap itself; I want to keep LabelMap looking clean for demos and such.
  6. Fixes a bug where our mobile page's warning for being in landscape mode wasn't showing up on initial page load.
Before/After screenshots (if applicable)

Here are screenshots of the changes to Admin Validate. The others don't really have screenshots to show. Screenshot from 2024-03-11 12-29-39 Screenshot from 2024-03-11 12-28-40

Things to check before submitting the PR