Skip to content
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

feat: Cross Product Recommendations Logic #32003

Merged
merged 22 commits into from
Apr 7, 2023

Conversation

JodyBaileyy
Copy link
Contributor

@JodyBaileyy JodyBaileyy commented Mar 29, 2023

Description

This PR encompasses our initial logic for our Personalised Cross Product Recommendation Upsell project. It consists of adding a new endpoint to the learner recommendation app where associated course data is returned based on the key provided to the endpoint.

Key additions are a new view, utility method, and serializer that utilises fields from an existing serializer, but houses an extra field, "course_type". The experiment will be targeted towards anonymous user and will include course filtering based on their location.

Example of a successful response from the endpoint using dummy data:
Screenshot 2023-04-05 at 14 40 41

Supporting information

Finishes PTECH-3169, PTECH-3170, PTECH-3171, PTECH-3172, PTECH-3190
PR for adding dictionary values

Testing instructions

We tested this endpoint by adding an entry to the CROSS_PRODUCT_RECOMMENDATIONS_KEYS settings variable of one course key associated to an array of two course keys, eg "TESTx+KEYx": ["TESTx+KEYy", "TESTx+KEYz]. These course keys will need to obviously be of courses that are present in your local dev environment. Then we query the endpoint /api/learner_recommendations/cross_product/<course_id>/ and then expect back an array of two courses, or an empty array of courses.

@JodyBaileyy JodyBaileyy marked this pull request as ready for review March 29, 2023 16:34
Comment on lines +4792 to +4794
### DEFAULT KEY DICTIONARY FOR CROSS_PRODUCT_RECOMMENDATIONS ###
CROSS_PRODUCT_RECOMMENDATIONS_KEYS = {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dictionary values for each environment will be stored in the edx-internal repository. This PR is for adding in the values for the dictionaries, but it is still a work in progress for getting keys for staging

Copy link
Contributor

@zainab-amir zainab-amir left a comment

Choose a reason for hiding this comment

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

Last few changes otherwise looks good 👍🏽

Comment on lines 220 to 224
@ddt.data(
("HKUx+FinTechT1x", ["ColumbiaX+BC24FNTC", "MITx+BLN"]),
("RITx+CYBER501x", ["UniversityofUtah+BC24CYB", "HarvardX+CYB"]),
('NoKeyAssociated', None)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we update these course keys to some random test keys? We should avoid using actual course keys in the tests.

Comment on lines 164 to 165
course_data = [get_course_data(key, fields) for key in associated_course_keys]
filtered_courses = [course for course in course_data if course]
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Adding the query string marketable_course_runs_only': 1 will reduce the size of response and
  • return course runs for a course that are active. This will help recommend course runs that are active to users and not course runs that a user cannot enroll in.
Suggested change
course_data = [get_course_data(key, fields) for key in associated_course_keys]
filtered_courses = [course for course in course_data if course]
course_data = [get_course_data(key, fields, querystring={'marketable_course_runs_only': 1}) for key in associated_course_keys]
filtered_courses = [course for course in course_data if course and course_data.get("course_runs")]

@JodyBaileyy JodyBaileyy merged commit ba1c018 into master Apr 7, 2023
@JodyBaileyy JodyBaileyy deleted the jodybaileyy/cross-product-recommendations-logic branch April 7, 2023 11:17
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@pdpinch
Copy link
Contributor

pdpinch commented Dec 5, 2023

Is this feature available in open edX installations, or does it depend on a commercial service? None of the linked docs are public so I can't tell.

@zainab-amir
Copy link
Contributor

It's not and has now been moved to private plugin.

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.

4 participants