-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[back] feat: add the suggestions/tocompare API #1809
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…stionStrategy (wip)
...already compared videos
...instead of a single entity
GresilleSiffle
changed the title
WIP / [back] feat: add the random/tocompare API
WIP / [back] feat: add the suggestions/tocompare API
Oct 20, 2023
and add the test test_get_already_compared
…its... ... test case
also remove redundant comments
GresilleSiffle
changed the title
WIP / [back] feat: add the suggestions/tocompare API
[back] feat: add the suggestions/tocompare API
Oct 26, 2023
5 tasks
amatissart
reviewed
Nov 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have minor comments about the implementation, but overall the approach looks good to me 👍
backend/tournesol/lib/suggestions/strategies/tocompare/classic.py
Outdated
Show resolved
Hide resolved
backend/tournesol/lib/suggestions/strategies/tocompare/classic.py
Outdated
Show resolved
Hide resolved
backend/tournesol/lib/suggestions/strategies/tocompare/classic.py
Outdated
Show resolved
Hide resolved
amatissart
reviewed
Nov 2, 2023
Co-authored-by: Adrien Matissart <amatissart@users.noreply.github.com>
... and simplify some querysets
amatissart
approved these changes
Nov 9, 2023
GresilleSiffle
commented
Nov 9, 2023
backend/tournesol/tests/lib/suggestions/test_tocompare_classic.py
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
related issues #1785
Description
This PR adds the
/me/suggestions/{poll}/tocompare/
API.This endpoint aims to suggest to the logged-in user a list of entities for comparison. In the future updates, the namespace
/me/suggestions/
could be extended to include new endpoints with different purposes:The strategies
The added endpoint is flexible and can suggest entities using different strategies. It's possible to add new strategy by creating a class inheriting from the abstract base class
ContributionSuggestionStrategy
and adding it to the API view. The default strategy that comes with this PR, called "classic", has several goals:The classic strategy is simple because it is based on simple heuristics: entities the user may want to compare are entities he/she started comparing or are in his/her rate-later list.
We suppose that the entities the user may want to compare in priority are those he/she started to compare few times, but not enough regarding the setting
rate_later__auto_remove
. We also suppose that the rate-later is a also good place to find those kind of entities, but we consider the rate-later slightly less reliable because depending on the users' habits it can be used as a watch-later list instead.Finally, some flaws and limitations of the current frond end's Auto button have been fixed:
(a) We consider the compared pool as slightly more reliable than the rate-later list. The Auto button returns 75 % of entities from the rate-later list, the API returns 16 / 20 of entities from a combination of compared list and rate-later list.
(b) The complete compared list and rate-later list are queried for a better randomness, instead of just 100 enties.
(c) The recommended entities that represent 4 / 20 of the results come from the last month recommendations. Entities compared more than
rate_later__auto_remove
are excluded for a better experience. Future improvement: use the user's preferred languages.to-do
serializer
API endpoint
EntityToCompare view
ClassicEntitySuggestionStrategy
rate_later__auto_remove
rate_later__auto_remove
add randomness to determine the selected poolall pool are selected to build a list of entitiestest
future improvements
Make the
ClassicEntitySuggestionStrategy
behave differently for new and advanced users. The user profile can be determined by his/her number of comparisons, a low number indicates a new users, and high number indicates an advance users.The pool rate-later could be replaced by "tutorial" entities for new users. A new additional pool "to connect" could be added for advanced users.
Checklist