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

docs: [FC-0074] add docs about creating new filters with pipeline steps #242

Merged
merged 17 commits into from
Jan 31, 2025

Conversation

mariajgrimaldi
Copy link
Member

@mariajgrimaldi mariajgrimaldi commented Dec 25, 2024

Description

Update how-to documents to create and implement pipeline steps considering design suggestions introduced in #240.

Here are the main documents to review:

Testing instructions

You can review the docs here: https://docsopenedxorg--242.org.readthedocs.build/projects/openedx-filters/en/242/how-tos/index.html

Deadline

None

Checklists

Check off if complete or not applicable:

Merge Checklist:

  • All reviewers approved
  • Reviewer tested the code following the testing instructions
  • CI build is green
  • Version bumped
  • Changelog record added with short description of the change and current date
  • Documentation updated (not only docstrings)
  • Code dependencies reviewed
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

Post Merge:

  • Create a tag
  • Create a release on GitHub
  • Check new version is pushed to PyPI after tag-triggered build is
    finished.
  • Delete working branch (if not needed anymore)
  • Upgrade the package in the Open edX platform requirements (if applicable)

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Dec 25, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Dec 25, 2024

Thanks for the pull request, @mariajgrimaldi!

This repository is currently maintained by @openedx/hooks-extension-framework.

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.

@mariajgrimaldi mariajgrimaldi changed the title Mjg/create a new filter docs: add docs about creating new filters with pipeline steps Dec 26, 2024
@mariajgrimaldi mariajgrimaldi changed the title docs: add docs about creating new filters with pipeline steps docs: [FC-0074] add docs about creating new filters with pipeline steps Dec 26, 2024
@mariajgrimaldi mariajgrimaldi added the FC Relates to an Axim Funded Contribution project label Dec 26, 2024
@mariajgrimaldi mariajgrimaldi marked this pull request as ready for review December 26, 2024 13:06
@mariajgrimaldi mariajgrimaldi requested a review from a team as a code owner December 26, 2024 13:06
docs/how-tos/create-a-pipeline-step.rst Outdated Show resolved Hide resolved
docs/how-tos/create-a-pipeline-step.rst Outdated Show resolved Hide resolved
docs/how-tos/create-a-pipeline-step.rst Show resolved Hide resolved
docs/reference/architecture-subdomains.rst Outdated Show resolved Hide resolved
Copy link

@MaferMazu MaferMazu left a comment

Choose a reason for hiding this comment

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

I have one suggestion, but the rest looks good to me.

Thanks @mariajgrimaldi

docs/how-tos/create-a-pipeline-step.rst Outdated Show resolved Hide resolved
@MaferMazu
Copy link

Thanks for addressing my feedback. This looks good to me ✅

Base automatically changed from MJG/practices-suggestions-adr to main January 14, 2025 09:44
@mariajgrimaldi mariajgrimaldi force-pushed the MJG/create-a-new-filter branch from ad4a794 to de53680 Compare January 14, 2025 09:46
Copy link
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

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

Some inline comments. Overall looks good, but I'm starting to see something that we are doing rather unintentionally. By focusing our documentation effort on all the parts of the lifecycle of : creating a new filter that did not previously exist, add said filter to the platform, implement pipeline steps with your feature, we are creating the impression on devs that they all need to take this route. I think we need to make it very well known that there are already quite a few filters and events available and that for every one of those you only need the part where you develop your code. This misconception is pushing people to believe that using filters is too complicated and not worth doing.


In our example our use case proposal could be:

I want to add a filter that will be triggered when a user enrolls in a course from the course about page. This filter will be used to prfilter users from enrolling in a course if they do not meet the eligibility criteria. The filter will be triggered when the user clicks the enroll button on the course about page and will check if the user meets the eligibility criteria. If the user does not meet the criteria, the filter will raise an exception to prfilter the user from enrolling in the course.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
I want to add a filter that will be triggered when a user enrolls in a course from the course about page. This filter will be used to prfilter users from enrolling in a course if they do not meet the eligibility criteria. The filter will be triggered when the user clicks the enroll button on the course about page and will check if the user meets the eligibility criteria. If the user does not meet the criteria, the filter will raise an exception to prfilter the user from enrolling in the course.
I want to add a filter that will be triggered when a user enrolls in a course from the course about page. This filter will be used to prevent users from enrolling in a course if they do not meet the eligibility criteria. The filter will be triggered when the user clicks the enroll button on the course about page and will check if the user meets the eligibility criteria. If the user does not meet the criteria, the filter will raise an exception to prevent the user from enrolling in the course.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for noticing!

Step 7: Implement Your Pipeline Steps
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Implementing pipeline steps allows you to modify the behavior of the application when the filter is triggered. Pipeline steps are a sequence of steps that are executed in a specific order to modify the behavior of the application. You can configure them with the :term:`filter configuration` to define the sequence of steps that are executed when the filter is triggered. Follow the steps in the :doc:`../how-tos/create-a-pipeline-step` guide to implement the pipeline steps for the filter.
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 say here that the pipeline steps are meant to be written in the plugin code and not in the openedx-filters library.

Copy link
Member Author

Choose a reason for hiding this comment

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

Step 2: Install Open edX Filters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

First, add the ``openedx-filters`` plugin into your dependencies so the library's environment recognizes the event you want to consume. You can install ``openedx-filters`` by running:
Copy link
Member

Choose a reason for hiding this comment

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

openedx-filters plugin -> openedx-filters library. To not make it more confusing plugin should refer always to the developer's pluggable code and the openedx-filters or openedx-events should be called the library.

Copy link
Member

Choose a reason for hiding this comment

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

"so the library's environment recognizes the event you want to consume" this is also confusing. We are not consuming an event, but creating a filter pipeline in this guide.

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 borrowed this from the consume events docs, that's why it is all mixed up. Thank you for noticing! Although I now have a question, technically openedx-events is a plugin, do you think that would cause misunderstandings? Calling openedx-events a plugin instead?

Copy link
Member

Choose a reason for hiding this comment

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

What threshold do you use to recognize something as a plugin? For me the defining characteristic of a plugin, is that it defines the plugin_app in its apps.py config. Neither events nor filters do that. That is why I call them libraries.

I could certainly be picking the wrong definition here. The other approach that I use for this, which is what triggered the comment, is that plugin is something that is not part of the core. We try to gently push developers in the direction of using plugins for the custom development instead of forking. By this approach also events and filters would not be considered plugins.

Copy link
Member Author

@mariajgrimaldi mariajgrimaldi Jan 30, 2025

Choose a reason for hiding this comment

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

Sorry for the misunderstanding. opened-events is a Django application, which makes it more than a library -- in my humble opinion, at least. I thought it actually defined a plugin_app, but after reviewing apps.py I realized it didn't.

@mariajgrimaldi mariajgrimaldi force-pushed the MJG/create-a-new-filter branch from de53680 to 19d18f6 Compare January 24, 2025 09:43
@mariajgrimaldi
Copy link
Member Author

mariajgrimaldi commented Jan 24, 2025

Thank you, @felipemontoya, for the thorough review.

Overall looks good, but I'm starting to see something that we are doing rather unintentionally. By focusing our documentation effort on all the parts of the lifecycle of : creating a new filter that did not previously exist, add said filter to the platform, implement pipeline steps with your feature, we are creating the impression on devs that they all need to take this route. I think we need to make it very well known that there are already quite a few filters and events available and that for every one of those you only need the part where you develop your code.

I hear what you're saying, but I'm not sure I follow, given that one of the first steps in creating a pipeline specifically mentions reviewing the list of available filters to identify the right one for the use case: https://docsopenedxorg--242.org.readthedocs.build/projects/openedx-filters/en/242/how-tos/create-a-pipeline-step.html#step-1-understand-your-use-case-and-identify-the-filter-to-use. Do you think that part isn't clear enough? I’m open to suggestions to make it more obvious.

Maybe a note at the beginning of creating a new filter warning devs that they don't need to create one if there's already one that fits their use case.

@mariajgrimaldi
Copy link
Member Author

@felipemontoya: I've addressed all your comments in this commit 2ee41e3. Thank you again!

Copy link
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

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

Thanks @mariajgrimaldi I think the note makes it clear that this is not the first step, but one that must be taken only when there is no similar available filter.

@mariajgrimaldi mariajgrimaldi merged commit 2390400 into main Jan 31, 2025
8 checks passed
@mariajgrimaldi mariajgrimaldi deleted the MJG/create-a-new-filter branch January 31, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants