Skip to content

Conversation

@bella-buchanan
Copy link
Collaborator

@bella-buchanan bella-buchanan commented Feb 27, 2025

Resolves #3578

Problem: Tags are presented to users in an unordered manner. It could help taggers to see tags in the order they are most frequently used. Additionally, it is important that mutually exclusive tags are presented next to each other for ease of understanding the tag.

Solution: TagTable.getTagsForCurrentCity is an already implemented method that gets the tag frequencies for the city. In this PR, we use these counts to sort tags in LabelController.getLabelTags.

Before/After screenshots

before (unsorted):

Image

after (sorted and mutually exclusive pairing):

Image
Testing instructions
Things to check before submitting the PR
  • I've written a descriptive PR title.
  • I've added/updated comments for large or confusing blocks of code.
  • I've included before/after screenshots above.
  • I've asked for and included translations for any user facing text that was added or modified.
  • I've updated any logging. Clicks, keyboard presses, and other user interactions should be logged. If you're not sure how (or if you need to update the logging), ask Mikey. Then make sure the documentation on this wiki page is up to date for the logs you added/updated.
  • I've tested on mobile (only needed for validation page).

- adds a lookup to the  LabelTable to get global tag counts
- use counts to sort the tags order
- adds a lookup to the  LabelTable to get global tag counts
- use counts to sort the tags order
@misaugstad
Copy link
Member

@bella-buchanan it looks like the mutually exclusive pairing isn't happening in all cases. One example below ("one button" and "two buttons" are mutually exclusive but not adjacent):
Screenshot from 2025-03-03 14-06-42

And just because they're sorted in that API doesn't mean that they're sorted in the actual UIs! I think that the ordering is being used by default on the Explore page, but not on the New Validate Beta page. Pasting something I wrote in the original ticket on that front:

For the new Validate page, there is built-in functionality in the drop down search for adding tags that will sort based on a named field. I gave it a default name of "popularity" right now, and we would just need to add that property to the tag objects.

Here's an image from that UI:
Screenshot from 2025-03-03 14-15-41

@bella-buchanan
Copy link
Collaborator Author

@bella-buchanan it looks like the mutually exclusive pairing isn't happening in all cases. One example below ("one button" and "two buttons" are mutually exclusive but not adjacent): Screenshot from 2025-03-03 14-06-42

And just because they're sorted in that API doesn't mean that they're sorted in the actual UIs! I think that the ordering is being used by default on the Explore page, but not on the New Validate Beta page. Pasting something I wrote in the original ticket on that front:

For the new Validate page, there is built-in functionality in the drop down search for adding tags that will sort based on a named field. I gave it a default name of "popularity" right now, and we would just need to add that property to the tag objects.

Here's an image from that UI: Screenshot from 2025-03-03 14-15-41

@misaugstad thanks for the comments! I have addressed the sorting on the Explore page by making sure mutually exclusive tags are scored in a way that they are always next to one another:
image

I also changed the field from count to popularity so that new validate beta can have the correct sorting

@misaugstad
Copy link
Member

Things are looking good on the Explore page, but on the NewValidateBeta, it still doesn't look sorted! Below are what I'm seeing, and then the output from the /label/tags API:
Screenshot from 2025-04-08 10-53-20

Screenshot from 2025-04-08 10-53-52

@bella-buchanan
Copy link
Collaborator Author

Things are looking good on the Explore page, but on the NewValidateBeta, it still doesn't look sorted! Below are what I'm seeing, and then the output from the /label/tags API: Screenshot from 2025-04-08 10-53-20

Screenshot from 2025-04-08 10-53-52

Thanks @misaugstad, I've been struggling to login as an admin so let me figure that out to close out the new validate issue you're seeing!

@misaugstad
Copy link
Member

@bella-buchanan check these docs for help with that!
https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Process-for-contributing-new-code#do-you-need-to-login-as-an-admin-user

Copy link
Member

@misaugstad misaugstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things from testing:

  1. You somehow removed the following lines from the end of the escapeHTML function in Utilities.js, which made it so that neither the Explore nor Validate page would load... Had to figure out what happened to be able to test in the first place.
            }
        });
    }
    
  2. On Validate, it seems like maybe the tags start out sorted, but once you add or remove a tag, it removes the sorting..? Here's a before/after when adding a tag. It starts out sorted correctly, but sorting is totally different after adding a tag.
    Screenshot from 2025-04-17 15-26-22
    Screenshot from 2025-04-17 15-28-41

@bella-buchanan bella-buchanan requested a review from misaugstad May 20, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order tags by frequency of use in current city

3 participants