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: model for upstream-downstream links #269

Closed
wants to merge 7 commits into from

Conversation

navinkarkera
Copy link
Contributor

@navinkarkera navinkarkera commented Jan 15, 2025

Adds models and api's for Publishable entity links.

See openedx/edx-platform#36111 for more information and testing instructions.

Related to openedx/modular-learning#243

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jan 15, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Jan 15, 2025

Thanks for the pull request, @navinkarkera!

This repository is currently maintained by @axim-engineering.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 I left a few nits/questions about some field types and naming conventions, but this is working well :)

  • I tested this using the test instructions on feat: upstream-downstream entity linking edx-platform#36111
  • I read through the code
  • I checked for accessibility issues by using my keyboard to navigate N/A
  • Includes documentation -- code comments for modules and classes
  • User-facing strings are extracted for translation -- mostly, but I've noted where the model verbose_name fields need marking too.

openedx_learning/apps/authoring/linking/models.py Outdated Show resolved Hide resolved
openedx_learning/apps/authoring/linking/models.py Outdated Show resolved Hide resolved
openedx_learning/apps/authoring/linking/models.py Outdated Show resolved Hide resolved
openedx_learning/apps/authoring/linking/models.py Outdated Show resolved Hide resolved
@navinkarkera navinkarkera force-pushed the navin/link-table branch 3 times, most recently from eb706d7 to 89d47ca Compare January 20, 2025 04:56
@navinkarkera navinkarkera requested a review from ormsbee January 20, 2025 05:56
@navinkarkera navinkarkera marked this pull request as ready for review January 20, 2025 05:56
@ChrisChV
Copy link
Contributor

@ormsbee Pinging you here if you want to take a look 👀

@ormsbee
Copy link
Contributor

ormsbee commented Jan 23, 2025

@ChrisChV: I'll review this tomorrow (Thursday). Thank you.

"""
This represents link between any two publishable entities or link between publishable entity and a course
xblock. It helps in tracking relationship between xblocks imported from libraries and used in different courses.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Is the fact that this is living in openedx-learning distorting the design and making it harder than it needs to be? Because if this was in edx-platform, we'd be using UsageKey fields, CourseKeyFields, and using a join to CourseOverview for the context title, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Except for usagekey and coursekey fields, there won't be much difference. All details about the xblock can be fetched from meilisearch index from the frontend, see this wip code section as CourseOverview can only help us with course name, while we need block name, description, type, location etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we storing the "context title" anyways?

I am also wondering if edx-platform is a better place for this. Because Learning Core generally deals with Components, PublishableEntities, and LearningPackages, whereas these ____stream_usage_key and ____stream_context_key fields are more platform-specific workarounds for the fact that courses are not yet using Learning Core.

usage_key and context_key don't yet appear in this codebase, for example.

If we do want to keep this approach though, would it be crazy to have a LegacyXBlock(PublishableEntityMixin) that wraps a UsageKey field?

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, I realize now the concepts of "upstream/downstream syncing" don't yet appear in Learning Core at all anyways. So it seems a bit odd if we have some APIs for tracking the links here, but no sync code, and the edx-platform codebase has APIs for syncing only.

We need to decide if this is a useful primitive that we want people to use to build things with, or if this is a layer on top of learning core that's more platform specific. There's a future world where everything is in Learning Core, and this model can be much simpler - ForeignKey(PublishableEntity) on both sides. I am wondering if we should wait until then before moving it into Learning Core. But i don't really have a strong opinion on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why are we storing the "context title" anyways?

Displaying list of courses using the library block in library authoring page. We can however remove it and fetch the title (and other details if required) via meilisearch index.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a future world where everything is in Learning Core, and this model can be much simpler - ForeignKey(PublishableEntity) on both sides. I am wondering if we should wait until then before moving it into Learning Core.

This seems like a good option, we will be in a much better position then.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @bradenmacdonald on this. Apologies if I was the one that suggested it be here in the first place, but after seeing how it needs to be implemented, I think it's better in edx-platform for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ormsbee @bradenmacdonald Done, moved this to edx-platform. We can close this PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants