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: adds How To do xAPI Transforms #114

Merged
merged 5 commits into from
Feb 8, 2024
Merged

Conversation

pomegranited
Copy link
Contributor

Description

Adds a "how to" document for creating new xAPI Transforms.

Supporting information

Closes #75

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

Thanks for the pull request, @pomegranited! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

Copy link
Contributor

@Ian2012 Ian2012 left a comment

Choose a reason for hiding this comment

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

Thanks for this documentation

Copy link
Contributor

@bmtcril bmtcril left a comment

Choose a reason for hiding this comment

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

Couple of nits and comments, otherwise this looks great. Couple of last thoughts:

  • Maybe you could throw in a reference to the ERB filters somewhere, so that people know they don't necessarily have to create their own transforms if they only want to override some default behavior.
  • Related, it's probably also worth noting that there can be only one registered xapi transformer per tracking log event name, so it is possible to completely override the default transforms, and also may be an unintended side effect of writing your own.


Verb
~~~~
Verbs in xAPI are URIs from the paired with short, translated, human-friendly labels. Verbs
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Couple of typos in this sentence

Copy link
Contributor Author

@pomegranited pomegranited Feb 1, 2024

Choose a reason for hiding this comment

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

It can be a learner, instructor, system administrator, or any other agent
involved in the learning process.

Actors in Aspects are uniquely identified using a platform-generated ``external_id`` which
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to link in this doc: changing_actor_identifier somewhere here as it has some important specifics.

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 verb is the primary differentiator between different xAPI events in Open edX. Select a verb that describes the event as concisely and accurately as possible, so that future, similar
events can still be discerned.

Where possible, reuse verbs from one of the registered `xAPI profiles`_. See `ERB's verb list`_ for verbs currently in use in Aspects.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably discourage people from reusing verbs that are already in use in ERB whenever possible, as we do a lot of processing based on the verb and it will potentially lead to confusion and maybe performance issues to overload terms.

Copy link
Contributor

Choose a reason for hiding this comment

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

Talking about it, we should also update our filters to not only filter events based on the verb but also the object type and even the context activities. Mainly to allow developers to use the same verb and don't trigger any error on the downstream tables.

For the completion-aggregator and with internal libraries @andrey-canon had a lot of issues with the completion events because he was using the same verb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talking about it, we should also update our filters to not only filter events based on the verb but also the object type and even the context activities.

That's a good point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pomegranited
Copy link
Contributor Author

@bmtcril

Maybe you could throw in a reference to the ERB filters somewhere, so that people know they don't necessarily have to create their own transforms if they only want to override some default behavior.

Yep, happy to do that.

But I'm having trouble figuring out how these filters work.. does the filter_type passed to the decorator need to match the key used when registering the transformer class? For example, is this how to override CompletionCreatedTransformer.get_object?

@openedx_filter(filter_type="edx.completion.block_completion.changed")
def get_object(self):
   ...

@bmtcril
Copy link
Contributor

bmtcril commented Feb 1, 2024

@Ian2012
Copy link
Contributor

Ian2012 commented Feb 1, 2024

@pomegranited Brian is right, you need to use one of those filters. Here are some examples for the filters: https://github.com/eduNEXT/eox-nelp/blob/master/eox_nelp/openedx_filters/xapi/filters.py

@pomegranited
Copy link
Contributor Author

@Ian2012 @bmtcril Ah cool, thank you for these pointers.

But xAPI filters doesn't seem to be a complete list? e.g. XApiContextFilter uses event_routing_backends.processors.xapi.transformer.xapi_transformer.get_context, which is not on that list. So does that actually mean we can override any method on any transformer?

@andrey-canon
Copy link

@Ian2012 @bmtcril Ah cool, thank you for these pointers.

But xAPI filters doesn't seem to be a complete list? e.g. XApiContextFilter uses event_routing_backends.processors.xapi.transformer.xapi_transformer.get_context, which is not on that list. So does that actually mean we can override any method on any transformer?

@pomegranited basically that is not in the list because that is not in the master code, the library that you are checking depends on a specific version of event-routing-backends that included that filter in this pr however I haven't had enough time to open the upstream pr

@pomegranited
Copy link
Contributor Author

@andrey-canon Ahh... I understand now, thank you! I've updated the code example to use a filter that's already in upstream: 123930a

@bmtcril could you take another look at this PR when you get a chance?

Copy link
Contributor

@bmtcril bmtcril left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@bmtcril bmtcril merged commit 413a29e into main Feb 8, 2024
3 checks passed
@bmtcril bmtcril deleted the jill/howto-xapi-transforms branch February 8, 2024 14:32
@openedx-webhooks
Copy link

@pomegranited 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

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
Archived in project
Development

Successfully merging this pull request may close these issues.

Docs: How-to - xAPI Transforms
5 participants