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: use course cache to retrieve course data #72

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

alangsto
Copy link
Member

COSMO-22

The Xpert Platform course index does not include courses based on certain enrollment dates and other discovery fields, like is_marketable. This means that Xpert is only available to a more limited set of courses.

To increase the number of courses in which Xpert is available, we can opt to not rely on the Xpert Platform backend to inject the course title and course skills into the prompt template, and instead use an already-defined cache in the LMS to retrieve that same data.

learning_assistant/views.py Outdated Show resolved Hide resolved
_, unit_content = get_block_content(request, user_id, course_id, unit_usage_key)
_, unit_content = get_block_content(request, user_id, course_run_id, unit_usage_key)

course_data = get_cache_course_data(course_id, ['skill_names', 'title'])
Copy link
Member Author

Choose a reason for hiding this comment

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

I am concerned about adding another potential blocking call to discovery to retrieve this data. If we don't include skill names, we would only need to call one cache (course run cache), not two. Skill names are only associated with courses, not course runs, which is why we need to call both caches right now.

@alangsto alangsto force-pushed the alangsto/use_course_cache branch 2 times, most recently from f82293a to bc76158 Compare February 27, 2024 18:37
@alangsto alangsto marked this pull request as ready for review February 27, 2024 18:37
course on edX. The discovery service is the source of truth for mappings between course run ID and course IDs, and
string manipulation cannot be relied on as an accurate way to map between the two forms of ID.

The learning-assistant CourseChatView NEED LINK accepts a course run ID as a query parameter, but parts of the python API defined
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to add a link here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, thanks for catching that


Decision
********
In order to determine the mapping between a course run ID and course ID in the learning-assistant app, we will make
Copy link
Member

Choose a reason for hiding this comment

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

I think we should also mention the course cache to get the skill names and title.

mock_get_content.return_value = (len(unit_content), unit_content)
mock_is_flag_enabled.return_value = flag_enabled
mock_cache.return_value = {'skill_names': ['skills'], 'title': ['title']}
Copy link
Member

Choose a reason for hiding this comment

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

I think we should assert that the title and skills appear in prompt_text somewhere. Do you think this is a good place for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I can add that check!

Copy link
Member

@MichaelRoytman MichaelRoytman left a comment

Choose a reason for hiding this comment

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

This looks good! Two of the links in the ADR are not formatted correctly, so it would be great if you could fix those before merging. Thanks!

Decision
********
In order to determine the mapping between a course run ID and course ID in the learning-assistant app, we will make
use of an `existing course run cache that is defined in edx-platform`_. Similarly, to retrieve the skill names and title of a course, we will also use
Copy link
Member

Choose a reason for hiding this comment

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

This link isn't rendering properly because the text here and in the link definition are different (this one has "run" and the one below doesn't).

********
In order to determine the mapping between a course run ID and course ID in the learning-assistant app, we will make
use of an `existing course run cache that is defined in edx-platform`_. Similarly, to retrieve the skill names and title of a course, we will also use
an `existing course cache`_. Both caches store data from the discovery API for course runs and courses, respectively.
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this link is missing a definition below.

@alangsto alangsto merged commit dc9179c into main Feb 28, 2024
8 checks passed
@alangsto alangsto deleted the alangsto/use_course_cache branch February 28, 2024 16:20
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.

2 participants