Open edX events
edX pydantic models.
base
¶
Base event model definitions.
AbstractBaseEventField (BaseModelWithConfig)
pydantic-model
¶
Pydantic model for core event
fields.
The base model does not have any attributes as event field does not have common sub-fields.
Source code in ralph/models/edx/base.py
class AbstractBaseEventField(BaseModelWithConfig):
"""Pydantic model for core `event` fields.
The base model does not have any attributes as event field does not have common
sub-fields.
"""
BaseContextField (BaseModelWithConfig)
pydantic-model
¶
Pydantic model for core context
field.
Attributes:
Name | Type | Description |
---|---|---|
course_user_tags |
Dict of str |
Content from |
user_id |
int or str or None |
Consists of the ID of the authenticated user.
Retrieved with:
|
org_id |
str |
Consists of the organization name that lists the course.
Retrieved with:
|
course_id |
str |
Consists of the unique identifier for the visited course page.
Retrieved with:
|
path |
Path |
Consist of the relative URL (without the hostname) of the
requested page.
Retrieved with:
|
Source code in ralph/models/edx/base.py
class BaseContextField(BaseModelWithConfig):
"""Pydantic model for core `context` field.
Attributes:
course_user_tags (Dict of str): Content from `user_api_usercoursetag` table.
Retrieved with:
`dict(
UserCourseTag.objects.filter(
user=request.user.pk, course_id=course_key
).values_list('key', 'value')
)`
Note:
Is only present when a course page is requested.
Is an empty dictionary when the user is not logged in or not found in
the `user_api_usercoursetag` table.
user_id (int or str or None): Consists of the ID of the authenticated user.
Retrieved with:
`request.user.pk` querying the `auth_user` table.
Note:
Is an integer when the user is found in the `auth_user` table.
Is an empty string when an exception is raised while retrieving the ID.
Is `None` when the user is not logged in.
org_id (str): Consists of the organization name that lists the course.
Retrieved with:
`course_id.org` where `course_id` is an
`opaque_keys.edx.locator.CourseLocator` which is created using the URL
of the requested page.
Note:
Is an empty string when the requested page is not a course page.
course_id (str): Consists of the unique identifier for the visited course page.
Retrieved with:
`course_id.to_deprecated_string()` where `course_id` is an
`opaque_keys.edx.locator.CourseLocator` which is created using the URL
of the requested page.
Note:
Is an empty string when the requested page is not a course page.
path (Path): Consist of the relative URL (without the hostname) of the
requested page.
Retrieved with:
`request.META['PATH_INFO']`
"""
course_id: constr(regex=r"^$|^course-v1:.+\+.+\+.+$") # noqa:F722
course_user_tags: Optional[Dict[str, str]]
module: Optional[ContextModuleField]
org_id: str
path: Path
user_id: Union[int, Literal[""], None]
BaseEdxModel (BaseModelWithConfig)
pydantic-model
¶
Pydantic model for core statement.
WARNING: it does not define the event
, event_type
and event_source
fields.
Attributes:
Name | Type | Description |
---|---|---|
username |
str |
Consists of the unique username identifying the logged in user.
Retrieved with:
|
ip |
IPv4Address or str |
Consists of the public IPv4 address of the user.
Retrieved with:
|
agent |
str |
Consists of the |
host |
str |
Consists of the hostname of the server.
Retrieved with:
|
referer |
Path |
Consists of the |
accept_language |
str |
Consists of the |
context |
BaseContextField |
see BaseContextField. |
time |
datetime |
Consists of the UTC time in ISO format at which the event was
emitted.
Retrieved with:
|
page |
None |
Consists of the value |
Source code in ralph/models/edx/base.py
class BaseEdxModel(BaseModelWithConfig):
"""Pydantic model for core statement.
WARNING: it does not define the `event`, `event_type` and `event_source` fields.
Attributes:
username (str): Consists of the unique username identifying the logged in user.
Retrieved with:
`request.user.username` querying the `auth_user` table.
Note:
Is an empty string when the user is not logged in.
If an exception is raised when retrieving the username from the table
then the value is `anonymous`.
Usernames are made of 2-30 ASCII letters / numbers / underscores (_) /
hyphens (-)
ip (IPv4Address or str): Consists of the public IPv4 address of the user.
Retrieved with:
`get_ip(request)` cf. https://github.com/un33k/django-ipware/tree/1.1.0
Note:
Can be an empty string if the IP address is not found.
agent (str): Consists of the `User-Agent` HTTP request header.
Retrieved with:
`request.META[HTTP_USER_AGENT]`
Note:
Can be an empty string if the header is not present in the request.
Contains information about:
Browser name and version
Operating system name and version
Default language
host (str): Consists of the hostname of the server.
Retrieved with:
`request.META[SERVER_NAME]`
referer (Path): Consists of the `Referer` HTTP request header.
Retrieved with:
`request.META[HTTP_REFERER]`
Note:
Can be an empty string if the header is not present in the request.
Contains the referring URL (previous URL visited by the user).
accept_language (str): Consists of the `Accept-Language` HTTP request header.
Retrieved with:
`request.META[HTTP_ACCEPT_LANGUAGE]`
Note:
Can be an empty string if the header is not present in the request.
Contains the default language settings of the user.
context (BaseContextField): see BaseContextField.
time (datetime): Consists of the UTC time in ISO format at which the event was
emitted.
Retrieved with:
`datetime.datetime.utcnow()`
page (None): Consists of the value `None`
Note:
In JSON the value is `null` instead of `None`.
"""
username: Union[constr(min_length=2, max_length=30), Literal[""]]
ip: Union[IPv4Address, Literal[""]]
agent: str
host: str
referer: Union[AnyHttpUrl, Literal[""]]
accept_language: str
context: BaseContextField
time: datetime
page: None
BaseModelWithConfig (BaseModel)
pydantic-model
¶
Pydantic model for base configuration shared among all models.
Source code in ralph/models/edx/base.py
class BaseModelWithConfig(BaseModel):
"""Pydantic model for base configuration shared among all models."""
class Config: # pylint: disable=missing-class-docstring # noqa: D106
extra = "forbid"
ContextModuleField (BaseModelWithConfig)
pydantic-model
¶
Pydantic model for context
.module
field.
Attributes:
Name | Type | Description |
---|---|---|
usage_key |
str |
Consists of a block ID of the current component. |
display_name |
str |
Consists of a short description or title of the component. |
Source code in ralph/models/edx/base.py
class ContextModuleField(BaseModelWithConfig):
"""Pydantic model for `context`.`module` field.
Attributes:
usage_key (str): Consists of a block ID of the current component.
display_name (str): Consists of a short description or title of the component.
"""
usage_key: constr(regex=r"^block-v1:.+\+.+\+.+type@.+@[a-f0-9]{32}$") # noqa:F722
display_name: str
original_usage_key: Optional[
constr(
regex=r"^block-v1:.+\+.+\+.+type@problem\+block@[a-f0-9]{32}$" # noqa:F722
)
]
original_usage_version: Optional[str]
browser
¶
Browser event model definitions.
BaseBrowserModel (BaseEdxModel)
pydantic-model
¶
Pydantic model for core browser statements.
This type of event is triggered on (XHR) POST/GET requests to the /event
URL.
Attributes:
Name | Type | Description |
---|---|---|
event_source |
str |
Consists of the value |
page |
AnyUrl |
Consists of the URL (with hostname) of the visited page.
Retrieved with:
|
session |
str |
Consists of the md5 encrypted Django session key or an empty string. |
Source code in ralph/models/edx/browser.py
class BaseBrowserModel(BaseEdxModel):
"""Pydantic model for core browser statements.
This type of event is triggered on (XHR) POST/GET requests to the `/event` URL.
Attributes:
event_source (str): Consists of the value `browser`.
page (AnyUrl): Consists of the URL (with hostname) of the visited page.
Retrieved with:
`window.location.href` from the JavaScript front-end.
session (str): Consists of the md5 encrypted Django session key or an empty
string.
"""
event_source: Literal["browser"]
page: AnyUrl
session: Union[constr(regex=r"^[a-f0-9]{32}$"), Literal[""]] # noqa: F722
converters
special
¶
xapi
special
¶
edX to xAPI conversion sets.
base
¶
Base xAPI Converter.
BaseXapiConverter (BaseConversionSet)
¶
Base xAPI Converter.
WARNING: The converter may not include the following edX fields:
- context.org_id: When org_id
is an empty string.
- context.course_id: When course_id
is an empty string.
WARNING: The converter should not include the following edX fields as they may
contain sensitive data: username
, referer
, event
, event_source
, ip
,
agent
, accept_language:
, context.course_user_tags
.
Source code in ralph/models/edx/converters/xapi/base.py
class BaseXapiConverter(BaseConversionSet):
"""Base xAPI Converter.
WARNING: The converter may not include the following edX fields:
- context.org_id: When `org_id` is an empty string.
- context.course_id: When `course_id` is an empty string.
WARNING: The converter should not include the following edX fields as they may
contain sensitive data: `username`, `referer`, `event`, `event_source`, `ip`,
`agent`, `accept_language:`, `context.course_user_tags`.
"""
def __init__(self, uuid_namespace: str, platform_url: str):
"""Initializes BaseXapiConverter."""
self.platform_url = platform_url
try:
self.uuid_namespace = UUID(uuid_namespace)
except (TypeError, ValueError, AttributeError) as err:
raise ConfigurationException("Invalid UUID namespace") from err
super().__init__()
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
return {
ConversionItem(
"id",
None,
lambda event_str: str(uuid5(self.uuid_namespace, event_str)),
True,
),
ConversionItem(
"actor__account__homePage", transformers=lambda _: self.platform_url
),
ConversionItem(
"actor__account__name",
"context__user_id",
lambda user_id: str(user_id) if user_id else "anonymous",
),
ConversionItem(
"object__definition__extensions__" + CONTEXT_EXTENSION_SCHOOL_ID,
"context__org_id",
),
ConversionItem(
"object__definition__extensions__" + CONTEXT_EXTENSION_COURSE_ID,
"context__course_id",
(self.parse_course_id, lambda x: x["course"]),
),
ConversionItem(
"object__definition__extensions__" + CONTEXT_EXTENSION_MODULE_ID,
"context__course_id",
(self.parse_course_id, lambda x: x["module"]),
),
ConversionItem("timestamp", "time"),
}
@staticmethod
def parse_course_id(course_id: str):
"""Parses edX event's `context`.`course_id`.
Returns a dictionary with `course` and `module`.
"""
match = re.match(r"^course-v1:.+\+(.+)\+(.+)$", course_id)
if not match:
return {"course": None, "module": None}
return {"course": match.group(1), "module": match.group(2)}
__init__(self, uuid_namespace, platform_url)
special
¶
Initializes BaseXapiConverter.
Source code in ralph/models/edx/converters/xapi/base.py
def __init__(self, uuid_namespace: str, platform_url: str):
"""Initializes BaseXapiConverter."""
self.platform_url = platform_url
try:
self.uuid_namespace = UUID(uuid_namespace)
except (TypeError, ValueError, AttributeError) as err:
raise ConfigurationException("Invalid UUID namespace") from err
super().__init__()
parse_course_id(course_id)
staticmethod
¶
Parses edX event’s context
.course_id
.
Returns a dictionary with course
and module
.
Source code in ralph/models/edx/converters/xapi/base.py
@staticmethod
def parse_course_id(course_id: str):
"""Parses edX event's `context`.`course_id`.
Returns a dictionary with `course` and `module`.
"""
match = re.match(r"^course-v1:.+\+(.+)\+(.+)$", course_id)
if not match:
return {"course": None, "module": None}
return {"course": match.group(1), "module": match.group(2)}
navigational
¶
Navigational event xAPI Converter.
UIPageCloseToPageTerminated (BaseXapiConverter)
¶
Converts a common edX page_close
event to xAPI.
Example Statement: John terminated https://www.fun-mooc.fr/ page.
WARNING: The converter does not use the self.platform_url
in the object__id
because the platform_url
is present in the edX’s event page
field.
Source code in ralph/models/edx/converters/xapi/navigational.py
class UIPageCloseToPageTerminated(BaseXapiConverter):
"""Converts a common edX `page_close` event to xAPI.
Example Statement: John terminated https://www.fun-mooc.fr/ page.
WARNING: The converter does not use the `self.platform_url` in the `object__id`
because the `platform_url` is present in the edX's event `page` field.
"""
__src__ = UIPageClose
__dest__ = PageTerminated
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union({ConversionItem("object__id", "page")})
__dest__ (BaseXapiStatement)
pydantic-model
¶
Pydantic model for page terminated statement.
Example: John terminated the https://www.fun-mooc.fr/ page.
Attributes:
Name | Type | Description |
---|---|---|
object |
dict |
See PageActivity. |
verb |
dict |
See TerminatedVerb. |
Source code in ralph/models/edx/converters/xapi/navigational.py
class PageTerminated(BaseXapiStatement):
"""Pydantic model for page terminated statement.
Example: John terminated the https://www.fun-mooc.fr/ page.
Attributes:
object (dict): See PageActivity.
verb (dict): See TerminatedVerb.
"""
__selector__ = selector(
object__definition__type="http://activitystrea.ms/schema/1.0/page",
verb__id="http://adlnet.gov/expapi/verbs/terminated",
)
object: PageActivity
verb: TerminatedVerb = TerminatedVerb()
__src__ (BaseBrowserModel)
pydantic-model
¶
Pydantic model for page_close
statement.
The browser emits this statement when the user navigates to the next page
or closes the browser window (when the JavaScript window.onunload
event
is called).
Attributes:
Name | Type | Description |
---|---|---|
event |
str |
Consists of the string value |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/converters/xapi/navigational.py
class UIPageClose(BaseBrowserModel):
"""Pydantic model for `page_close` statement.
The browser emits this statement when the user navigates to the next page
or closes the browser window (when the JavaScript `window.onunload` event
is called).
Attributes:
event (str): Consists of the string value `{}`.
event_type (str): Consists of the value `page_close`.
name (str): Consists of the value `page_close`.
"""
__selector__ = selector(event_source="browser", event_type="page_close")
# pylint: disable=unsubscriptable-object
event: Literal["{}"]
event_type: Literal["page_close"]
name: Literal["page_close"]
server
¶
Server event xAPI Converter.
ServerEventToPageViewed (BaseXapiConverter)
¶
Converts a common edX server event to xAPI.
Example Statement: John viewed https://www.fun-mooc.fr/ page.
Source code in ralph/models/edx/converters/xapi/server.py
class ServerEventToPageViewed(BaseXapiConverter):
"""Converts a common edX server event to xAPI.
Example Statement: John viewed https://www.fun-mooc.fr/ page.
"""
__src__ = Server
__dest__ = PageViewed
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union(
{
ConversionItem(
"object__id",
"event_type",
lambda event_type: self.platform_url + event_type,
),
}
)
__dest__ (BaseXapiStatement)
pydantic-model
¶
Pydantic model for page viewed statement.
Example: John viewed the https://www.fun-mooc.fr/ page.
Attributes:
Name | Type | Description |
---|---|---|
object |
dict |
See PageActivity. |
verb |
dict |
See ViewedVerb. |
Source code in ralph/models/edx/converters/xapi/server.py
class PageViewed(BaseXapiStatement):
"""Pydantic model for page viewed statement.
Example: John viewed the https://www.fun-mooc.fr/ page.
Attributes:
object (dict): See PageActivity.
verb (dict): See ViewedVerb.
"""
__selector__ = selector(
object__definition__type="http://activitystrea.ms/schema/1.0/page",
verb__id="http://id.tincanapi.com/verb/viewed",
)
object: PageActivity
verb: ViewedVerb = ViewedVerb()
__src__ (BaseServerModel)
pydantic-model
¶
Pydantic model for common server statement.
This type of event is triggered from the django middleware on each request
excluding: /event
, login
, heartbeat
, /segmentio/event
and /performance
.
Attributes:
Name | Type | Description |
---|---|---|
event_type |
str |
Consist of the relative URL (without the hostname) of the
requested page.
Retrieved with:
|
event |
str |
Consist of a JSON string holding the content of the GET or POST
request.
Retrieved with:
|
Source code in ralph/models/edx/converters/xapi/server.py
class Server(BaseServerModel):
"""Pydantic model for common server statement.
This type of event is triggered from the django middleware on each request
excluding: `/event`, `login`, `heartbeat`, `/segmentio/event` and `/performance`.
Attributes:
event_type (str): Consist of the relative URL (without the hostname) of the
requested page.
Retrieved with:
`request.META['PATH_INFO']`
event (str): Consist of a JSON string holding the content of the GET or POST
request.
Retrieved with:
```json.dumps(
{
'GET': dict(request.GET),
'POST': dict(request.POST)
}
)[:512]```
Note:
Values for ['password', 'newpassword', 'new_password', 'oldpassword',
'old_password', 'new_password1', 'new_password2'] are replaced by
`********`.
The JSON string is truncated at 512 characters resulting in invalid
JSON.
"""
__selector__ = selector(
event_source="server", event_type=LazyModelField("context__path")
)
# pylint: disable=unsubscriptable-object
event_type: Path
event: Union[Json[ServerEventField], ServerEventField]
video
¶
Video event xAPI Converter.
UILoadVideoToVideoInitialized (VideoBaseXapiConverter)
¶
Converts a common edX load_video
event to xAPI.
Source code in ralph/models/edx/converters/xapi/video.py
class UILoadVideoToVideoInitialized(VideoBaseXapiConverter):
"""Converts a common edX `load_video` event to xAPI."""
__src__ = UILoadVideo
__dest__ = VideoInitialized
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union(
{
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_LENGTH,
None,
# Set the video length to null by default.
# This information is mandatory in the xAPI template
# and does not exist in the edX `load_video` event model.
lambda _: 0.0,
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_SESSION_ID,
"session",
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_USER_AGENT, "agent"
),
},
)
__dest__ (BaseVideoStatement)
pydantic-model
¶
Pydantic model for video initialized statement.
Example: A video has been fully initialized.
Attributes:
Name | Type | Description |
---|---|---|
verb |
dict |
See InitializedVerb. |
context |
dict |
See VideoInitializedContext. |
Source code in ralph/models/edx/converters/xapi/video.py
class VideoInitialized(BaseVideoStatement):
"""Pydantic model for video initialized statement.
Example: A video has been fully initialized.
Attributes:
verb (dict): See InitializedVerb.
context (dict): See VideoInitializedContext.
"""
__selector__ = selector(
object__definition__type="https://w3id.org/xapi/video/activity-type/video",
verb__id="http://adlnet.gov/expapi/verbs/initialized",
)
verb: InitializedVerb = InitializedVerb()
context: VideoInitializedContext
__src__ (BaseBrowserModel)
pydantic-model
¶
Pydantic model for load_video
statement.
The browser emits this statement when the video is fully rendered and ready to play.
Attributes:
Name | Type | Description |
---|---|---|
event |
VideoBaseEventField |
See VideoBaseEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/converters/xapi/video.py
class UILoadVideo(BaseBrowserModel):
"""Pydantic model for `load_video` statement.
The browser emits this statement when the video is fully rendered and ready to
play.
Attributes:
event (VideoBaseEventField): See VideoBaseEventField.
event_type (str): Consists of the value `load_video`.
name (str): Consists either of the value `load_video` or `edx.video.loaded`.
"""
__selector__ = selector(event_source="browser", event_type="load_video")
event: Union[
Json[VideoBaseEventField], # pylint: disable=unsubscriptable-object
VideoBaseEventField,
]
event_type: Literal["load_video"]
name: Literal["load_video", "edx.video.loaded"]
UIPauseVideoToVideoPaused (VideoBaseXapiConverter)
¶
Converts a common edX pause_video
event to xAPI.
Source code in ralph/models/edx/converters/xapi/video.py
class UIPauseVideoToVideoPaused(VideoBaseXapiConverter):
"""Converts a common edX `pause_video` event to xAPI."""
__src__ = UIPauseVideo
__dest__ = VideoPaused
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union(
{
ConversionItem(
"result__extensions__" + RESULT_EXTENSION_TIME,
"event__currentTime",
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_LENGTH,
None,
# Set the video length to null by default.
# This information is mandatory in the xAPI template
# and does not exist in the edX `pause_video` event model.
lambda _: 0.0,
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_SESSION_ID,
"session",
),
},
)
__dest__ (BaseVideoStatement)
pydantic-model
¶
Pydantic model for video paused statement.
Example: John paused the video or clicked the pause button.
Attributes:
Name | Type | Description |
---|---|---|
verb |
dict |
See PausedVerb. |
result |
dict |
See VideoPausedResult. |
context |
dict |
See VideoPausedContext. |
Source code in ralph/models/edx/converters/xapi/video.py
class VideoPaused(BaseVideoStatement):
"""Pydantic model for video paused statement.
Example: John paused the video or clicked the pause button.
Attributes:
verb (dict): See PausedVerb.
result (dict): See VideoPausedResult.
context (dict): See VideoPausedContext.
"""
__selector__ = selector(
object__definition__type="https://w3id.org/xapi/video/activity-type/video",
verb__id="https://w3id.org/xapi/video/verbs/paused",
)
verb: PausedVerb = PausedVerb()
result: VideoPausedResult
context: VideoPausedContext
__src__ (BaseBrowserModel)
pydantic-model
¶
Pydantic model for pause_video
statement.
The browser emits this statement when a user selects the video player’s pause control.
Attributes:
Name | Type | Description |
---|---|---|
event |
PauseVideoEventField |
See PauseVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/converters/xapi/video.py
class UIPauseVideo(BaseBrowserModel):
"""Pydantic model for `pause_video` statement.
The browser emits this statement when a user selects the video player's pause
control.
Attributes:
event (PauseVideoEventField): See PauseVideoEventField.
event_type (str): Consists of the value `pause_video`.
name (str): Consists either of the value `pause_video` or `edx.video.paused`.
"""
__selector__ = selector(event_source="browser", event_type="pause_video")
event: Union[
Json[PauseVideoEventField], # pylint: disable=unsubscriptable-object
PauseVideoEventField,
]
event_type: Literal["pause_video"]
name: Optional[Literal["pause_video", "edx.video.paused"]]
UIPlayVideoToVideoPlayed (VideoBaseXapiConverter)
¶
Converts a common edX play_video
event to xAPI.
Source code in ralph/models/edx/converters/xapi/video.py
class UIPlayVideoToVideoPlayed(VideoBaseXapiConverter):
"""Converts a common edX `play_video` event to xAPI."""
__src__ = UIPlayVideo
__dest__ = VideoPlayed
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union(
{
ConversionItem(
"result__extensions__" + RESULT_EXTENSION_TIME,
"event__currentTime",
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_SESSION_ID,
"session",
),
},
)
__dest__ (BaseVideoStatement)
pydantic-model
¶
Pydantic model for video played statement.
Example: John played the video or clicked the play button.
Attributes:
Name | Type | Description |
---|---|---|
verb |
dict |
See PlayedVerb. |
result |
dict |
See VideoPlayedResult. |
context |
dict |
See VideoPlayedContext. |
Source code in ralph/models/edx/converters/xapi/video.py
class VideoPlayed(BaseVideoStatement):
"""Pydantic model for video played statement.
Example: John played the video or clicked the play button.
Attributes:
verb (dict): See PlayedVerb.
result (dict): See VideoPlayedResult.
context (dict): See VideoPlayedContext.
"""
__selector__ = selector(
object__definition__type="https://w3id.org/xapi/video/activity-type/video",
verb__id="https://w3id.org/xapi/video/verbs/played",
)
verb: PlayedVerb = PlayedVerb()
result: VideoPlayedResult
context: Optional[VideoPlayedContext]
__src__ (BaseBrowserModel)
pydantic-model
¶
Pydantic model for play_video
statement.
The browser emits this statement when a user selects the video player’s play control.
Attributes:
Name | Type | Description |
---|---|---|
event |
PlayVideoEventField |
See PlayVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/converters/xapi/video.py
class UIPlayVideo(BaseBrowserModel):
"""Pydantic model for `play_video` statement.
The browser emits this statement when a user selects the video player's play
control.
Attributes:
event (PlayVideoEventField): See PlayVideoEventField.
event_type (str): Consists of the value `play_video`.
name (str): Consists either of the value `play_video` or `edx.video.played`.
"""
__selector__ = selector(event_source="browser", event_type="play_video")
event: Union[
Json[PlayVideoEventField], # pylint: disable=unsubscriptable-object
PlayVideoEventField,
]
event_type: Literal["play_video"]
name: Optional[Literal["play_video", "edx.video.played"]]
UISeekVideoToVideoSeeked (VideoBaseXapiConverter)
¶
Converts a common edX seek_video
event to xAPI.
Source code in ralph/models/edx/converters/xapi/video.py
class UISeekVideoToVideoSeeked(VideoBaseXapiConverter):
"""Converts a common edX `seek_video` event to xAPI."""
__src__ = UISeekVideo
__dest__ = VideoSeeked
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union(
{
ConversionItem(
"result__extensions__" + RESULT_EXTENSION_TIME_FROM,
"event__old_time",
),
ConversionItem(
"result__extensions__" + RESULT_EXTENSION_TIME_TO,
"event__new_time",
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_SESSION_ID,
"session",
),
},
)
__dest__ (BaseVideoStatement)
pydantic-model
¶
Pydantic model for video seeked statement.
!!! example “John moved the progress bar forward or backward to a specific time in the” video.
Attributes:
Name | Type | Description |
---|---|---|
verb |
dict |
See SeekedVerb. |
result |
dict |
See VideoSeekedResult. |
context |
dict |
See VideoSeekedContext. |
Source code in ralph/models/edx/converters/xapi/video.py
class VideoSeeked(BaseVideoStatement):
"""Pydantic model for video seeked statement.
Example: John moved the progress bar forward or backward to a specific time in the
video.
Attributes:
verb (dict): See SeekedVerb.
result (dict): See VideoSeekedResult.
context (dict): See VideoSeekedContext.
"""
__selector__ = selector(
object__definition__type="https://w3id.org/xapi/video/activity-type/video",
verb__id="https://w3id.org/xapi/video/verbs/seeked",
)
verb: SeekedVerb = SeekedVerb()
result: VideoSeekedResult
context: Optional[VideoSeekedContext]
__src__ (BaseBrowserModel)
pydantic-model
¶
Pydantic model for seek_video
statement.
The browser emits this statement when a user selects a user interface control to go to a different point in the video file.
Attributes:
Name | Type | Description |
---|---|---|
event |
SeekVideoEventField |
See SeekVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/converters/xapi/video.py
class UISeekVideo(BaseBrowserModel):
"""Pydantic model for `seek_video` statement.
The browser emits this statement when a user selects a user interface control to go
to a different point in the video file.
Attributes:
event (SeekVideoEventField): See SeekVideoEventField.
event_type (str): Consists of the value `seek_video`.
name (str): Consists either of the value `seek_video` or
`edx.video.position.changed`.
"""
__selector__ = selector(event_source="browser", event_type="seek_video")
event: Union[
Json[SeekVideoEventField], # pylint: disable=unsubscriptable-object
SeekVideoEventField,
]
event_type: Literal["seek_video"]
name: Optional[Literal["seek_video", "edx.video.position.changed"]]
UIStopVideoToVideoTerminated (VideoBaseXapiConverter)
¶
Converts a common edX stop_video
event to xAPI.
Source code in ralph/models/edx/converters/xapi/video.py
class UIStopVideoToVideoTerminated(VideoBaseXapiConverter):
"""Converts a common edX `stop_video` event to xAPI."""
__src__ = UIStopVideo
__dest__ = VideoTerminated
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union(
{
ConversionItem(
"result__extensions__" + RESULT_EXTENSION_TIME,
"event__currentTime",
),
ConversionItem(
"result__extensions__" + RESULT_EXTENSION_PROGRESS,
None,
# Set the video progress to null by default.
# This information is mandatory in the xAPI template
# and does not exist in the edX `stop_video` event model.
lambda _: 0.0,
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_LENGTH,
None,
# Set the video length to null by default.
# This information is mandatory in the xAPI template
# and does not exist in the edX `stop_video` event model.
lambda _: 0.0,
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_SESSION_ID,
"session",
),
},
)
__dest__ (BaseVideoStatement)
pydantic-model
¶
Pydantic model for video terminated statement.
Example: John ended a video (quit the player).
Attributes:
Name | Type | Description |
---|---|---|
verb |
dict |
See TerminatedVerb. |
result |
dict |
See VideoTerminatedResult. |
context |
dict |
See VideoTerminatedContext. |
Source code in ralph/models/edx/converters/xapi/video.py
class VideoTerminated(BaseVideoStatement):
"""Pydantic model for video terminated statement.
Example: John ended a video (quit the player).
Attributes:
verb (dict): See TerminatedVerb.
result (dict): See VideoTerminatedResult.
context (dict): See VideoTerminatedContext.
"""
__selector__ = selector(
object__definition__type="https://w3id.org/xapi/video/activity-type/video",
verb__id="http://adlnet.gov/expapi/verbs/terminated",
)
verb: TerminatedVerb = TerminatedVerb()
result: VideoTerminatedResult
context: VideoTerminatedContext
__src__ (BaseBrowserModel)
pydantic-model
¶
Pydantic model for stop_video
statement.
The browser emits this statement when the video player reaches the end of the video file and play automatically stops.
Attributes:
Name | Type | Description |
---|---|---|
event |
StopVideoEventField |
See StopVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/converters/xapi/video.py
class UIStopVideo(BaseBrowserModel):
"""Pydantic model for `stop_video` statement.
The browser emits this statement when the video player reaches the end of the video
file and play automatically stops.
Attributes:
event (StopVideoEventField): See StopVideoEventField.
event_type (str): Consists of the value `stop_video`.
name (str): Consists either of the value `stop_video` or `edx.video.stopped`.
"""
__selector__ = selector(event_source="browser", event_type="stop_video")
event: Union[
Json[StopVideoEventField], # pylint: disable=unsubscriptable-object
StopVideoEventField,
]
event_type: Literal["stop_video"]
name: Optional[Literal["stop_video", "edx.video.stopped"]]
VideoBaseXapiConverter (BaseXapiConverter)
¶
Base Video xAPI Converter.
Source code in ralph/models/edx/converters/xapi/video.py
class VideoBaseXapiConverter(BaseXapiConverter):
"""Base Video xAPI Converter."""
def _get_conversion_items(self):
"""Returns a set of ConversionItems used for conversion."""
conversion_items = super()._get_conversion_items()
return conversion_items.union(
{
ConversionItem(
"object__definition__name",
"event__id",
lambda id: {LANG_EN_US_DISPLAY: id},
),
ConversionItem(
"object__id",
None,
lambda event: self.platform_url
+ "/xblock/block-v1:"
+ event["context"]["course_id"]
+ "-course-v1:+type@video+block@"
+ event["event"]["id"],
),
ConversionItem(
"context__extensions__" + CONTEXT_EXTENSION_SESSION_ID,
"session",
),
},
)
enrollment
special
¶
fields
special
¶
contexts
¶
Enrollment event models context fields definitions.
EdxCourseEnrollmentUpgradeClickedContextField (BaseContextField)
pydantic-model
¶
Pydantic model for edx.course.enrollment.upgrade_clicked
.context
field.
In addition to the common context member fields, this statement also comprises the
mode
context member field.
Attributes:
Name | Type | Description |
---|---|---|
mode |
str |
Consists of either the |
Source code in ralph/models/edx/enrollment/fields/contexts.py
class EdxCourseEnrollmentUpgradeClickedContextField(BaseContextField):
"""Pydantic model for `edx.course.enrollment.upgrade_clicked`.`context` field.
In addition to the common context member fields, this statement also comprises the
`mode` context member field.
Attributes:
mode (str): Consists of either the `audit` or `honor` value. It identifies the
enrollment mode when the user clicked <kbd>Challenge Yourself</kbd>.
"""
mode: Union[Literal["audit"], Literal["honor"]]
EdxCourseEnrollmentUpgradeSucceededContextField (BaseContextField)
pydantic-model
¶
Pydantic model for edx.course.enrollment.upgrade.succeeded
.context
field.
In addition to the common context member fields, this statement also comprises the
mode
context member field.
Attributes:
Name | Type | Description |
---|---|---|
mode |
str |
Consists of the |
Source code in ralph/models/edx/enrollment/fields/contexts.py
class EdxCourseEnrollmentUpgradeSucceededContextField(BaseContextField):
"""Pydantic model for `edx.course.enrollment.upgrade.succeeded`.`context` field.
In addition to the common context member fields, this statement also comprises the
`mode` context member field.
Attributes:
mode (str): Consists of the `verified` value.
"""
mode: Literal["verified"]
events
¶
Enrollment models event field definition.
EnrollmentEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for enrollment event
field.
Note: Only server enrollment statements require an event
field.
Attributes:
Name | Type | Description |
---|---|---|
course_id |
str |
Consists in the course in which the student was enrolled or unenrolled. |
mode |
str |
Takes either |
user_id |
int |
Identifies the student who was enrolled or unenrolled. |
Source code in ralph/models/edx/enrollment/fields/events.py
class EnrollmentEventField(AbstractBaseEventField):
"""Pydantic model for enrollment `event` field.
Note: Only server enrollment statements require an `event` field.
Attributes:
course_id (str): Consists in the course in which the student was enrolled or
unenrolled.
mode (str): Takes either `audit`, `honor`, `professional` or `verified` value.
It identifies the student’s enrollment mode.
user_id (int): Identifies the student who was enrolled or unenrolled.
"""
course_id: str
mode: Union[
Literal["audit"], Literal["honor"], Literal["professional"], Literal["verified"]
]
user_id: Union[int, Literal[""], None]
statements
¶
Enrollment event model definitions.
EdxCourseEnrollmentActivated (BaseServerModel)
pydantic-model
¶
Pydantic model for edx.course.enrollment.activated
statement.
The server emits this statement when a student enrolls in a course.
Attributes:
Name | Type | Description |
---|---|---|
event |
EnrollmentEventField |
See EnrollmentEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/enrollment/statements.py
class EdxCourseEnrollmentActivated(BaseServerModel):
"""Pydantic model for `edx.course.enrollment.activated` statement.
The server emits this statement when a student enrolls in a course.
Attributes:
event (EnrollmentEventField): See EnrollmentEventField.
event_type (str): Consists of the value `edx.course.enrollment.activated`.
name (str): Consists of the value `edx.course.enrollment.activated`.
"""
__selector__ = selector(
event_source="server", event_type="edx.course.enrollment.activated"
)
event: Union[
Json[EnrollmentEventField], # pylint: disable=unsubscriptable-object
EnrollmentEventField,
]
event_type: Literal["edx.course.enrollment.activated"]
name: Literal["edx.course.enrollment.activated"]
EdxCourseEnrollmentDeactivated (BaseServerModel)
pydantic-model
¶
Pydantic model for edx.course.enrollment.deactivated
statement.
The server emits this statement when a student unenrolls from a course.
Attributes:
Name | Type | Description |
---|---|---|
event |
EnrollmentEventField |
See EnrollmentEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/enrollment/statements.py
class EdxCourseEnrollmentDeactivated(BaseServerModel):
"""Pydantic model for `edx.course.enrollment.deactivated` statement.
The server emits this statement when a student unenrolls from a course.
Attributes:
event (EnrollmentEventField): See EnrollmentEventField.
event_type (str): Consists of the value `edx.course.enrollment.deactivated`.
name (str): Consists of the value `edx.course.enrollment.deactivated`.
"""
__selector__ = selector(
event_source="server", event_type="edx.course.enrollment.deactivated"
)
event: Union[
Json[EnrollmentEventField], # pylint: disable=unsubscriptable-object
EnrollmentEventField,
]
event_type: Literal["edx.course.enrollment.deactivated"]
name: Literal["edx.course.enrollment.deactivated"]
EdxCourseEnrollmentModeChanged (BaseServerModel)
pydantic-model
¶
Pydantic model for edx.course.enrollment.mode_changed
statement.
The server emits this statement when the process of changing a student’s student_courseenrollment.mode to a different mode is complete.
Attributes:
Name | Type | Description |
---|---|---|
event |
EnrollmentEventField |
See EnrollmentEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/enrollment/statements.py
class EdxCourseEnrollmentModeChanged(BaseServerModel):
"""Pydantic model for `edx.course.enrollment.mode_changed` statement.
The server emits this statement when the process of changing a student’s
student_courseenrollment.mode to a different mode is complete.
Attributes:
event (EnrollmentEventField): See EnrollmentEventField.
event_type (str): Consists of the value `edx.course.enrollment.mode_changed`.
name (str): Consists of the value `edx.course.enrollment.mode_changed`.
"""
__selector__ = selector(
event_source="server", event_type="edx.course.enrollment.mode_changed"
)
event: Union[
Json[EnrollmentEventField], # pylint: disable=unsubscriptable-object
EnrollmentEventField,
]
event_type: Literal["edx.course.enrollment.mode_changed"]
name: Literal["edx.course.enrollment.mode_changed"]
EdxCourseEnrollmentUpgradeSucceeded (BaseServerModel)
pydantic-model
¶
Pydantic model for edx.course.enrollment.upgrade.succeeded
statement.
The server emits this statement when the process of upgrading a student’s
student_courseenrollment.mode from audit
or honor
to verified
is complete.
Attributes:
Name | Type | Description |
---|---|---|
context |
EdxCourseEnrollmentUpgradeSucceededContextField |
See EdxCourseEnrollmentUpgradeSucceededContextField. |
event_type |
str |
Consists of the value
|
name |
str |
Consists of the value |
Source code in ralph/models/edx/enrollment/statements.py
class EdxCourseEnrollmentUpgradeSucceeded(BaseServerModel):
"""Pydantic model for `edx.course.enrollment.upgrade.succeeded` statement.
The server emits this statement when the process of upgrading a student’s
student_courseenrollment.mode from `audit` or `honor` to `verified` is complete.
Attributes:
context (EdxCourseEnrollmentUpgradeSucceededContextField):
See EdxCourseEnrollmentUpgradeSucceededContextField.
event_type (str): Consists of the value
`edx.course.enrollment.upgrade.succeeded`.
name (str): Consists of the value `edx.course.enrollment.upgrade.succeeded`.
"""
__selector__ = selector(
event_source="server", event_type="edx.course.enrollment.upgrade.succeeded"
)
context: EdxCourseEnrollmentUpgradeSucceededContextField
event_type: Literal["edx.course.enrollment.upgrade.succeeded"]
name: Literal["edx.course.enrollment.upgrade.succeeded"]
UIEdxCourseEnrollmentUpgradeClicked (BaseBrowserModel)
pydantic-model
¶
Pydantic model for edx.course.enrollment.upgrade_clicked
statement.
The browser emits this statement when a student clicks ChallengeYourself
option, and the process of upgrading the student_courseenrollment.mode for the
student to verified
begins.
Attributes:
Name | Type | Description |
---|---|---|
context |
EdxCourseEnrollmentUpgradeClickedContextField |
See EdxCourseEnrollmentUpgradeClickedContextField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/enrollment/statements.py
class UIEdxCourseEnrollmentUpgradeClicked(BaseBrowserModel):
"""Pydantic model for `edx.course.enrollment.upgrade_clicked` statement.
The browser emits this statement when a student clicks <kbd>ChallengeYourself</kbd>
option, and the process of upgrading the student_courseenrollment.mode for the
student to `verified` begins.
Attributes:
context (EdxCourseEnrollmentUpgradeClickedContextField):
See EdxCourseEnrollmentUpgradeClickedContextField.
event_type (str): Consists of the value `edx.course.enrollment.upgrade_clicked`.
name (str): Consists of the value `edx.course.enrollment.upgrade_clicked`.
"""
__selector__ = selector(
event_source="browser", event_type="edx.course.enrollment.upgrade_clicked"
)
context: EdxCourseEnrollmentUpgradeClickedContextField
event_type: Literal["edx.course.enrollment.upgrade_clicked"]
name: Literal["edx.course.enrollment.upgrade_clicked"]
navigational
special
¶
fields
special
¶
events
¶
Navigational event field definition.
NavigationalEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for navigational event
field.
Note: All navigational statements are emitted from the browser.
Attributes:
Name | Type | Description |
---|---|---|
id |
str |
Consists of the edX ID of the sequence. |
old |
int |
For |
new |
int |
For |
Source code in ralph/models/edx/navigational/fields/events.py
class NavigationalEventField(AbstractBaseEventField):
"""Pydantic model for navigational `event` field.
Note: All navigational statements are emitted from the browser.
Attributes:
id (str): Consists of the edX ID of the sequence.
old (int): For `seq_goto`, it consists of the index of the unit being jumped to.
For `seq_next` and `seq_prev`, it consists of the index of the unit being
navigated to.
new (int): For `seq_goto`, it consists of the index of the unit being jumped
from. For `seq_next` and `seq_prev`, it consists of the index of the unit
being navigated away from.
"""
id: constr(
regex=(
r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+type" # noqa : F722
r"@sequential\+block@[a-f0-9]{32}$" # noqa : F722
)
)
new: int
old: int
statements
¶
Navigational event model definitions.
UIPageClose (BaseBrowserModel)
pydantic-model
¶
Pydantic model for page_close
statement.
The browser emits this statement when the user navigates to the next page
or closes the browser window (when the JavaScript window.onunload
event
is called).
Attributes:
Name | Type | Description |
---|---|---|
event |
str |
Consists of the string value |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/navigational/statements.py
class UIPageClose(BaseBrowserModel):
"""Pydantic model for `page_close` statement.
The browser emits this statement when the user navigates to the next page
or closes the browser window (when the JavaScript `window.onunload` event
is called).
Attributes:
event (str): Consists of the string value `{}`.
event_type (str): Consists of the value `page_close`.
name (str): Consists of the value `page_close`.
"""
__selector__ = selector(event_source="browser", event_type="page_close")
# pylint: disable=unsubscriptable-object
event: Literal["{}"]
event_type: Literal["page_close"]
name: Literal["page_close"]
UISeqGoto (BaseBrowserModel)
pydantic-model
¶
Pydantic model for seq_goto
statement.
The browser emits this statement when a user jumps between units in a sequence.
Attributes:
Name | Type | Description |
---|---|---|
event |
obj |
Consists of member fields that identify specifics triggered event. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/navigational/statements.py
class UISeqGoto(BaseBrowserModel):
"""Pydantic model for `seq_goto` statement.
The browser emits this statement when a user jumps between units in a sequence.
Attributes:
event (obj): Consists of member fields that identify specifics triggered event.
event_type (str): Consists of the value `seq_goto`.
name (str): Consists of the value `seq_goto`.
"""
__selector__ = selector(event_source="browser", event_type="seq_goto")
# pylint: disable=unsubscriptable-object
event: Union[Json[NavigationalEventField], NavigationalEventField]
event_type: Literal["seq_goto"]
name: Literal["seq_goto"]
UISeqNext (BaseBrowserModel)
pydantic-model
¶
Pydantic model for seq_next
statement.
The browser emits this statement when a user navigates to the next unit in a sequence.
Attributes:
Name | Type | Description |
---|---|---|
event |
obj |
Consists of member fields that identify specifics triggered event. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/navigational/statements.py
class UISeqNext(BaseBrowserModel):
"""Pydantic model for `seq_next` statement.
The browser emits this statement when a user navigates to the next unit in a
sequence.
Attributes:
event (obj): Consists of member fields that identify specifics triggered event.
event_type (str): Consists of the value `seq_next`.
name (str): Consists of the value `seq_next`.
"""
__selector__ = selector(event_source="browser", event_type="seq_next")
# pylint: disable=unsubscriptable-object
event: Union[Json[NavigationalEventField], NavigationalEventField]
event_type: Literal["seq_next"]
name: Literal["seq_next"]
@validator("event")
@classmethod
def validate_next_jump_event_field(cls, value):
"""Checks that event.new is equal to event.old + 1."""
if value.new != value.old + 1:
raise ValueError("event.new - event.old should be equal to 1")
return value
validate_next_jump_event_field(value)
classmethod
¶
Checks that event.new is equal to event.old + 1.
Source code in ralph/models/edx/navigational/statements.py
@validator("event")
@classmethod
def validate_next_jump_event_field(cls, value):
"""Checks that event.new is equal to event.old + 1."""
if value.new != value.old + 1:
raise ValueError("event.new - event.old should be equal to 1")
return value
UISeqPrev (BaseBrowserModel)
pydantic-model
¶
Pydantic model for seq_prev
statement.
The browser emits this statement when a user navigates to the previous unit in a sequence.
Attributes:
Name | Type | Description |
---|---|---|
event |
obj |
Consists of member fields that identify specifics triggered event. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/navigational/statements.py
class UISeqPrev(BaseBrowserModel):
"""Pydantic model for `seq_prev` statement.
The browser emits this statement when a user navigates to the previous unit in a
sequence.
Attributes:
event (obj): Consists of member fields that identify specifics triggered event.
event_type (str): Consists of the value `seq_prev`.
name (str): Consists of the value `seq_prev`.
"""
__selector__ = selector(event_source="browser", event_type="seq_prev")
# pylint: disable=unsubscriptable-object
event: Union[Json[NavigationalEventField], NavigationalEventField]
event_type: Literal["seq_prev"]
name: Literal["seq_prev"]
@validator("event")
@classmethod
def validate_prev_jump_event_field(cls, value):
"""Checks that event.new is equal to event.old - 1."""
if value.new != value.old - 1:
raise ValueError("event.old - event.new should be equal to 1")
return value
validate_prev_jump_event_field(value)
classmethod
¶
Checks that event.new is equal to event.old - 1.
Source code in ralph/models/edx/navigational/statements.py
@validator("event")
@classmethod
def validate_prev_jump_event_field(cls, value):
"""Checks that event.new is equal to event.old - 1."""
if value.new != value.old - 1:
raise ValueError("event.old - event.new should be equal to 1")
return value
problem_interaction
special
¶
fields
special
¶
events
¶
Problem interaction events model event fields definitions.
CorrectMap (BaseModelWithConfig)
pydantic-model
¶
Pydantic model for problem interaction event
.correct_map
field.
Attributes:
Name | Type | Description |
---|---|---|
answervariable |
str |
Consists of the variable chosen in answer in the case of optionresponse provided with variables. |
correctness |
str |
Consists either of the |
hint |
str |
Consists of optional hint. |
hint_mode |
str |
Consists either of the value |
msg |
str |
Consists of extra message response. |
npoints |
int |
Consists of awarded points. |
queuestate |
json |
see QueueStateField. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class CorrectMap(BaseModelWithConfig):
"""Pydantic model for problem interaction `event`.`correct_map` field.
Attributes:
answervariable (str): Consists of the variable chosen in answer in the case of
optionresponse provided with variables.
correctness (str): Consists either of the `correct` or `incorrect` value.
hint (str): Consists of optional hint.
hint_mode (str): Consists either of the value `on_request` or `always` value.
msg (str): Consists of extra message response.
npoints (int): Consists of awarded points.
queuestate (json): see QueueStateField.
"""
answervariable: Union[Literal[None], None, str]
correctness: Union[Literal["correct"], Literal["incorrect"]]
hint: Optional[str]
hintmode: Optional[Union[Literal["on_request"], Literal["always"]]]
msg: str
npoints: Optional[int]
queuestate: Optional[QueueState]
EdxProblemHintDemandhintDisplayedEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for edx.problem.hint.demandhint_displayed
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
hint_index |
int |
Consists of the identifier for the hint that was displayed to the user. |
hint_len |
int |
Consists of the total number of hints defined for this problem. |
hint_text |
str |
Consists of the text of the hint that was displayed to the user. |
module_id |
str |
Consists of the identifier for the problem component for which the user requested the hint. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class EdxProblemHintDemandhintDisplayedEventField(AbstractBaseEventField):
"""Pydantic model for `edx.problem.hint.demandhint_displayed`.`event` field.
Attributes:
hint_index (int): Consists of the identifier for the hint that was displayed to
the user.
hint_len (int): Consists of the total number of hints defined for this problem.
hint_text (str): Consists of the text of the hint that was displayed to the
user.
module_id (str): Consists of the identifier for the problem component for which
the user requested the hint.
"""
hint_index: int
hint_len: int
hint_text: str
module_id: str
EdxProblemHintFeedbackDisplayedEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for edx.problem.hint.feedback_displayed
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
choice_all |
list |
Lists all of the answer choices for problems with multiple possible answers defined. |
correctness |
bool |
|
hint_label |
str |
Consists of the feedback message given for the answer correctness. |
hints |
list |
Consists of a text member field with the given feedback string. |
module_id |
str |
Consists of the identifier for the problem component for which the user received the feedback. |
problem_part_id |
str |
Consists of the specific problem for which the user received feedback. |
question_type |
str |
Consists of the XML tag that identifies the problem type. |
student_answer |
list |
Consists of the answer value(s) selected or supplied by the user. |
trigger_type |
str |
Identifies the type of feedback obtained by the
|
Source code in ralph/models/edx/problem_interaction/fields/events.py
class EdxProblemHintFeedbackDisplayedEventField(AbstractBaseEventField):
"""Pydantic model for `edx.problem.hint.feedback_displayed`.`event` field.
Attributes:
choice_all (list): Lists all of the answer choices for problems with multiple
possible answers defined.
correctness (bool): `True` if the `student_answer` value is correct, else
`False`.
hint_label (str): Consists of the feedback message given for the answer
correctness.
hints (list): Consists of a text member field with the given feedback string.
module_id (str): Consists of the identifier for the problem component for which
the user received the feedback.
problem_part_id (str): Consists of the specific problem for which the user
received feedback.
question_type (str): Consists of the XML tag that identifies the problem type.
student_answer (list): Consists of the answer value(s) selected or supplied by
the user.
trigger_type (str): Identifies the type of feedback obtained by the
`student_answer` response. Consists either of `single` or `compound` value.
"""
choice_all: Optional[List[str]]
correctness: bool
hint_label: str
hints: List[dict]
module_id: str
problem_part_id: str
question_type: Union[
Literal["stringresponse"],
Literal["choiceresponse"],
Literal["multiplechoiceresponse"],
Literal["numericalresponse"],
Literal["optionresponse"],
]
student_answer: List[str]
trigger_type: Union[Literal["single"], Literal["compound"]]
ProblemCheckEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for problem_check
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
answers |
dict |
Consists of a dictionary of problem ID and the corresponding internal answer identifier for each problem. |
attempts |
int |
Consists of the number of times the user attempted to answer the problem. |
correct_map |
dict |
Consists of the evaluation data for each answer. |
grade |
int |
Consists of the current grade value. |
max_grade |
int |
Consists of the maximum possible grade value. |
problem_id |
str |
Consists of the ID of the problem that was checked. |
state |
json |
Consists of the current problem state. |
submission |
dict |
Consists of a dictionnary of data about the given answer. |
success |
str |
Consists of either the |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class ProblemCheckEventField(AbstractBaseEventField):
"""Pydantic model for `problem_check`.`event` field.
Attributes:
answers (dict): Consists of a dictionary of problem ID and the corresponding
internal answer identifier for each problem.
attempts (int): Consists of the number of times the user attempted to answer
the problem.
correct_map (dict): Consists of the evaluation data for each answer.
grade (int): Consists of the current grade value.
max_grade (int): Consists of the maximum possible grade value.
problem_id (str): Consists of the ID of the problem that was checked.
state (json): Consists of the current problem state.
submission (dict): Consists of a dictionnary of data about the given answer.
success (str): Consists of either the `correct` or `incorrect` value.
"""
answers: Dict[
constr(regex=r"^[a-f0-9]{32}_[0-9]_[0-9]$"), # noqa : F722
Union[List[str], str],
]
attempts: int
correct_map: Dict[
constr(regex=r"^[a-f0-9]{32}_[0-9]_[0-9]$"), # noqa : F722
CorrectMap,
]
grade: int
max_grade: int
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
state: State
submission: Dict[
constr(regex=r"^[a-f0-9]{32}_[0-9]_[0-9]$"), # noqa : F722
SubmissionAnswerField,
]
success: Union[Literal["correct"], Literal["incorrect"]]
ProblemCheckFailEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for problem_check_fail
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
answers |
dict |
Consists of a dictionary of problem ID and the internal answer identifier for each problem. |
failure |
str |
Consists either of the |
problem_id |
str |
Consists of the ID of the problem that was checked. |
state |
dict |
Consists of the current problem state. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class ProblemCheckFailEventField(AbstractBaseEventField):
"""Pydantic model for `problem_check_fail`.`event` field.
Attributes:
answers (dict): Consists of a dictionary of problem ID and the internal answer
identifier for each problem.
failure (str): Consists either of the `closed` or `unreset` value.
problem_id (str): Consists of the ID of the problem that was checked.
state (dict): Consists of the current problem state.
"""
answers: Dict[
constr(regex=r"^[a-f0-9]{32}_[0-9]_[0-9]$"), # noqa : F722
Union[List[str], str],
]
failure: Union[Literal["closed"], Literal["unreset"]]
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
state: State
ProblemRescoreEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for problem_rescore
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
attempts |
int |
Consists of the number of attempts of rescoring. |
correct_map |
json |
see CorrectMapSubFields. |
new_score |
int |
Consists of the new score obtained after rescoring. |
new_total |
int |
Consists of the new total summed after rescoring. |
orig_score |
int |
Consists of the original scored before rescoring. |
problem_id |
str |
Consists of the ID of the problem being rescored. |
state |
json |
see StateField. |
success |
str |
Consists either of the |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class ProblemRescoreEventField(AbstractBaseEventField):
"""Pydantic model for `problem_rescore`.`event` field.
Attributes:
attempts (int): Consists of the number of attempts of rescoring.
correct_map (json): see CorrectMapSubFields.
new_score (int): Consists of the new score obtained after rescoring.
new_total (int): Consists of the new total summed after rescoring.
orig_score (int): Consists of the original scored before rescoring.
problem_id (str): Consists of the ID of the problem being rescored.
state (json): see StateField.
success (str): Consists either of the `correct` or `incorrect` value.
"""
attempts: int
correct_map: CorrectMap
new_score: int
new_total: int
orig_score: int
orig_total: int
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
state: State
success: Union[Literal["correct"], Literal["incorrect"]]
ProblemRescoreFailEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for problem_rescore_fail
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
failure |
str |
Consists either of the |
problem_id |
str |
Consists of the ID of the problem being checked. |
state |
json |
see StateField. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class ProblemRescoreFailEventField(AbstractBaseEventField):
"""Pydantic model for `problem_rescore_fail`.`event` field.
Attributes:
failure (str): Consists either of the `closed` or `unreset` value.
problem_id (str): Consists of the ID of the problem being checked.
state (json): see StateField.
"""
failure: Union[Literal["closed"], Literal["unreset"]]
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
state: State
QueueState (BaseModelWithConfig)
pydantic-model
¶
Pydantic model for problem interaction event
.correct_map
.queuestate
field.
Attributes:
Name | Type | Description |
---|---|---|
key |
str |
Consists of a secret string. |
time |
str |
Consists of a string dump of a DateTime object in the format ‘%Y%m%d%H%M%S’. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class QueueState(BaseModelWithConfig):
"""Pydantic model for problem interaction `event`.`correct_map`.`queuestate` field.
Attributes:
key (str): Consists of a secret string.
time (str): Consists of a string dump of a DateTime object in the format
'%Y%m%d%H%M%S'.
"""
key: str
time: datetime
ResetProblemEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for reset_problem
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
new_state |
json |
see StateField. |
old_state |
json |
see StateField. |
problem_id |
str |
Consists of the ID of the problem being reset. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class ResetProblemEventField(AbstractBaseEventField):
"""Pydantic model for `reset_problem`.`event` field.
Attributes:
new_state (json): see StateField.
old_state (json): see StateField.
problem_id (str): Consists of the ID of the problem being reset.
"""
new_state: State
old_state: State
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
ResetProblemFailEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for reset_problem_fail
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
failure |
str |
Consists either of |
old_state |
json |
see StateField. |
problem_id |
str |
Consists of the ID of the problem being reset. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class ResetProblemFailEventField(AbstractBaseEventField):
"""Pydantic model for `reset_problem_fail`.`event` field.
Attributes:
failure (str): Consists either of `closed` or `not_done` value.
old_state (json): see StateField.
problem_id (str): Consists of the ID of the problem being reset.
"""
failure: Union[Literal["closed"], Literal["not_done"]]
old_state: State
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
SaveProblemFailEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for save_problem_fail
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
answers |
dict |
Consists of a dict of the answer string or a list or a dict of the answer strings if multiple choices are allowed. |
failure |
str |
Consists either of |
problem_id |
str |
Consists of the ID of the problem being saved. |
state |
json |
see StateField. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class SaveProblemFailEventField(AbstractBaseEventField):
"""Pydantic model for `save_problem_fail`.`event` field.
Attributes:
answers (dict): Consists of a dict of the answer string or a list or a dict of
the answer strings if multiple choices are allowed.
failure (str): Consists either of `closed` or `done` value.
problem_id (str): Consists of the ID of the problem being saved.
state (json): see StateField.
"""
answers: Dict[str, Union[int, str, list, dict]]
failure: Union[Literal["closed"], Literal["done"]]
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
state: State
SaveProblemSuccessEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for save_problem_success
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
answers |
dict |
Consists of a dict of the answer string or a list or a dict of the answer strings if multiple choices are allowed. |
problem_id |
str |
Consists of the ID of the problem being saved. |
state |
json |
see StateField. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class SaveProblemSuccessEventField(AbstractBaseEventField):
"""Pydantic model for `save_problem_success`.`event` field.
Attributes:
answers (dict): Consists of a dict of the answer string or a list or a dict of
the answer strings if multiple choices are allowed.
problem_id (str): Consists of the ID of the problem being saved.
state (json): see StateField.
"""
answers: Dict[str, Union[int, str, list, dict]]
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
state: State
ShowAnswerEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for show_answer
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
problem_id |
str |
Consists of the ID of the problem being shown. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class ShowAnswerEventField(AbstractBaseEventField):
"""Pydantic model for `show_answer`.`event` field.
Attributes:
problem_id (str): Consists of the ID of the problem being shown.
"""
problem_id: constr(
regex=r"^block-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+" # noqa : F722
r"type@problem\+block@[a-f0-9]{32}$" # noqa : F722
)
State (BaseModelWithConfig)
pydantic-model
¶
Pydantic modelfor problem interaction event
.state
field.
Attributes:
Name | Type | Description |
---|---|---|
correct_map |
dict |
see CorrectMapSubFields. |
done |
bool |
|
input_state |
dict |
Consists of the state field given before answering. |
seed |
int |
Consists of the seed element for the current state. |
student_answers |
dict |
Consists of the answer(s) given by the user. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class State(BaseModelWithConfig):
"""Pydantic modelfor problem interaction `event`.`state` field.
Attributes:
correct_map (dict): see CorrectMapSubFields.
done (bool): `True` if the problem is answered, else `False`.
input_state (dict): Consists of the state field given before answering.
seed (int): Consists of the seed element for the current state.
student_answers (dict): Consists of the answer(s) given by the user.
"""
correct_map: Dict[
constr(regex=r"^[a-f0-9]{32}_[0-9]_[0-9]$"), # noqa : F722
CorrectMap,
]
done: Optional[bool]
input_state: dict
seed: int
student_answers: dict
SubmissionAnswerField (BaseModelWithConfig)
pydantic-model
¶
Pydantic model for problem_check
.event
.submission
field.
Attributes:
Name | Type | Description |
---|---|---|
answer |
str, list |
Consists of the answer string or a list of the answer strings if multiple choices are allorwed. |
correct |
bool |
|
input_type |
str |
Consists of the type of value that the student supplies for
the |
question |
str |
Consists of the question text. |
response_type |
str |
Consists of the type of problem. |
variant |
str |
Consists of the unique ID of the variant that was presented to this user. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class SubmissionAnswerField(BaseModelWithConfig):
"""Pydantic model for `problem_check`.`event`.`submission` field.
Attributes:
answer (str, list): Consists of the answer string or a list of the answer
strings if multiple choices are allorwed.
correct (bool): `True` if the `answer` value is correct, else `False`.
input_type (str): Consists of the type of value that the student supplies for
the `response_type`.
question (str): Consists of the question text.
response_type (str): Consists of the type of problem.
variant (str): Consists of the unique ID of the variant that was presented to
this user.
"""
answer: Union[str, List[str]]
correct: bool
input_type: str
question: str
response_type: str
variant: str
UIProblemResetEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for problem_reset
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
answers |
str, list |
Consists of the answer string or a list of the answer strings if multiple choices are allowed. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class UIProblemResetEventField(AbstractBaseEventField):
"""Pydantic model for `problem_reset`.`event` field.
Attributes:
answers (str, list): Consists of the answer string or a list of the answer
strings if multiple choices are allowed.
"""
answers: Union[str, List[str]]
UIProblemShowEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for problem_show
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
problem |
str |
Consists of the optional name value that the course creators supply or the system-generated hash code for the problem being shown. |
Source code in ralph/models/edx/problem_interaction/fields/events.py
class UIProblemShowEventField(AbstractBaseEventField):
"""Pydantic model for `problem_show`.`event` field.
Attributes:
problem (str): Consists of the optional name value that the course creators
supply or the system-generated hash code for the problem being shown.
"""
problem: str
statements
¶
Problem interaction events model definitions.
EdxProblemHintDemandhintDisplayed (BaseServerModel)
pydantic-model
¶
Pydantic model for edx.problem.hint.demandhint_displayed
statement.
The server emits this statement when a user requests a hint for a problem.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See EdxProblemHintDemandhintDisplayedEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class EdxProblemHintDemandhintDisplayed(BaseServerModel):
"""Pydantic model for `edx.problem.hint.demandhint_displayed` statement.
The server emits this statement when a user requests a hint for a problem.
Attributes:
event (dict): See EdxProblemHintDemandhintDisplayedEventField.
event_type (str): Consists of the value `edx.problem.hint.demandhint_displayed`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(
event_source="server", event_type="edx.problem.hint.demandhint_displayed"
)
event: EdxProblemHintDemandhintDisplayedEventField
event_type: Literal["edx.problem.hint.demandhint_displayed"]
page: Literal["x_module"]
EdxProblemHintFeedbackDisplayed (BaseServerModel)
pydantic-model
¶
Pydantic model for edx.problem.hint.feedback_displayed
statement.
The server emits this event when a user receives a hint after answering a problem.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See EdxProblemHintFeedbackDisplayedEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class EdxProblemHintFeedbackDisplayed(BaseServerModel):
"""Pydantic model for `edx.problem.hint.feedback_displayed` statement.
The server emits this event when a user receives a hint after answering a problem.
Attributes:
event (dict): See EdxProblemHintFeedbackDisplayedEventField.
event_type (str): Consists of the value `edx.problem.hint.feedback_displayed`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(
event_source="server", event_type="edx.problem.hint.feedback_displayed"
)
event: EdxProblemHintFeedbackDisplayedEventField
event_type: Literal["edx.problem.hint.feedback_displayed"]
page: Literal["x_module"]
ProblemCheck (BaseServerModel)
pydantic-model
¶
Pydantic model for problem_check
statement.
The server emits this event when a user checks a problem.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See ProblemCheckEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class ProblemCheck(BaseServerModel):
"""Pydantic model for `problem_check` statement.
The server emits this event when a user checks a problem.
Attributes:
event (dict): See ProblemCheckEventField.
event_type (str): Consists of the value `problem_check`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="problem_check")
event: ProblemCheckEventField
event_type: Literal["problem_check"]
page: Literal["x_module"]
ProblemCheckFail (BaseServerModel)
pydantic-model
¶
Pydantic model for problem_check_fail
statement.
The server emits this event when a user checks a problem and a failure prevents the problem from being checked successfully.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See ProblemCheckFailEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class ProblemCheckFail(BaseServerModel):
"""Pydantic model for `problem_check_fail` statement.
The server emits this event when a user checks a problem and a failure prevents the
problem from being checked successfully.
Attributes:
event (dict): See ProblemCheckFailEventField.
event_type (str): Consists of the value `problem_check_fail`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="problem_check_fail")
event: ProblemCheckFailEventField
event_type: Literal["problem_check_fail"]
page: Literal["x_module"]
ProblemRescore (BaseServerModel)
pydantic-model
¶
Pydantic model for problem_rescore
statement.
The server emits this statement when a problem is successfully rescored.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See ProblemRescoreEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class ProblemRescore(BaseServerModel):
"""Pydantic model for `problem_rescore` statement.
The server emits this statement when a problem is successfully rescored.
Attributes:
event (dict): See ProblemRescoreEventField.
event_type (str): Consists of the value `problem_rescore`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="problem_rescore")
event: ProblemRescoreEventField
event_type: Literal["problem_rescore"]
page: Literal["x_module"]
ProblemRescoreFail (BaseServerModel)
pydantic-model
¶
Pydantic model for problem_rescore_fail
statement.
The server emits this statement when a problem cannot be successfully rescored.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See ProblemRescoreFailEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class ProblemRescoreFail(BaseServerModel):
"""Pydantic model for `problem_rescore_fail` statement.
The server emits this statement when a problem cannot be successfully rescored.
Attributes:
event (dict): See ProblemRescoreFailEventField.
event_type (str): Consists of the value `problem_rescore_fail`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="problem_rescore_fail")
event: ProblemRescoreFailEventField
event_type: Literal["problem_rescore_fail"]
page: Literal["x_module"]
ResetProblem (BaseServerModel)
pydantic-model
¶
Pydantic model for reset_problem
statement.
The server emits this statement when a problem has been reset successfully.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See ResetProblemEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class ResetProblem(BaseServerModel):
"""Pydantic model for `reset_problem` statement.
The server emits this statement when a problem has been reset successfully.
Attributes:
event (dict): See ResetProblemEventField.
event_type (str): Consists of the value `reset_problem`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="reset_problem")
event: ResetProblemEventField
event_type: Literal["reset_problem"]
page: Literal["x_module"]
ResetProblemFail (BaseServerModel)
pydantic-model
¶
Pydantic model for reset_problem_fail
statement.
The server emits this statement when a problem cannot be reset successfully.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See ResetProblemFailEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class ResetProblemFail(BaseServerModel):
"""Pydantic model for `reset_problem_fail` statement.
The server emits this statement when a problem cannot be reset successfully.
Attributes:
event (dict): See ResetProblemFailEventField.
event_type (str): Consists of the value `reset_problem_fail`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="reset_problem_fail")
event: ResetProblemFailEventField
event_type: Literal["reset_problem_fail"]
page: Literal["x_module"]
SaveProblemFail (BaseServerModel)
pydantic-model
¶
Pydantic model for save_problem_fail
statement.
The server emits this statement when a problem cannot be saved successfully.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See SaveProblemFailEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class SaveProblemFail(BaseServerModel):
"""Pydantic model for `save_problem_fail` statement.
The server emits this statement when a problem cannot be saved successfully.
Attributes:
event (dict): See SaveProblemFailEventField.
event_type (str): Consists of the value `save_problem_fail`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="save_problem_fail")
event: SaveProblemFailEventField
event_type: Literal["save_problem_fail"]
page: Literal["x_module"]
SaveProblemSuccess (BaseServerModel)
pydantic-model
¶
Pydantic model for save_problem_success
statement.
The server emits this statement when a problem is saved successfully.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See SaveProblemSuccessEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class SaveProblemSuccess(BaseServerModel):
"""Pydantic model for `save_problem_success` statement.
The server emits this statement when a problem is saved successfully.
Attributes:
event (dict): See SaveProblemSuccessEventField.
event_type (str): Consists of the value `save_problem_success`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="save_problem_success")
event: SaveProblemSuccessEventField
event_type: Literal["save_problem_success"]
page: Literal["x_module"]
ShowAnswer (BaseServerModel)
pydantic-model
¶
Pydantic model for showanswer
statement.
The server emits this statement when the answer to a problem is shown.
Attributes:
Name | Type | Description |
---|---|---|
event |
dict |
See ShowAnswerEventField. |
event_type |
str |
Consists of the value |
page |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class ShowAnswer(BaseServerModel):
"""Pydantic model for `showanswer` statement.
The server emits this statement when the answer to a problem is shown.
Attributes:
event (dict): See ShowAnswerEventField.
event_type (str): Consists of the value `showanswer`.
page (str): Consists of the value `x_module`.
"""
__selector__ = selector(event_source="server", event_type="showanswer")
event: ShowAnswerEventField
event_type: Literal["showanswer"]
page: Literal["x_module"]
UIProblemCheck (BaseBrowserModel)
pydantic-model
¶
Pydantic model for problem_check
statement.
The browser emits this event when a user checks a problem.
Attributes:
Name | Type | Description |
---|---|---|
event |
str |
Consists of values of problem being checked, styled as |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class UIProblemCheck(BaseBrowserModel):
"""Pydantic model for `problem_check` statement.
The browser emits this event when a user checks a problem.
Attributes:
event (str): Consists of values of problem being checked, styled as `GET`
parameters.
event_type (str): Consists of the value `problem_check`.
name (str): Consists of the value `problem_check`.
"""
__selector__ = selector(event_source="browser", event_type="problem_check")
event: str
event_type: Literal["problem_check"]
name: Literal["problem_check"]
UIProblemGraded (BaseBrowserModel)
pydantic-model
¶
Pydantic model for problem_graded
statement.
The server emits this statement each time a user clicks Check for a problem and it is graded successfully.
Attributes:
Name | Type | Description |
---|---|---|
event |
list |
See ProblemGradedEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class UIProblemGraded(BaseBrowserModel):
"""Pydantic model for `problem_graded` statement.
The server emits this statement each time a user clicks <kbd>Check</kbd> for a
problem and it is graded successfully.
Attributes:
event (list): See ProblemGradedEventField.
event_type (str): Consists of the value `problem_graded`.
name (str): Consists of the value `problem_graded`.
"""
__selector__ = selector(event_source="browser", event_type="problem_graded")
event: List[Union[str, Literal[None], None]]
event_type: Literal["problem_graded"]
name: Literal["problem_graded"]
UIProblemReset (BaseBrowserModel)
pydantic-model
¶
Pydantic model for problem_reset
statement.
The browser emits problem_reset events when a user clicks Reset to reset the problem answer.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See ProblemResetEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class UIProblemReset(BaseBrowserModel):
"""Pydantic model for `problem_reset` statement.
The browser emits problem_reset events when a user clicks <kbd>Reset</kbd> to reset
the problem answer.
Attributes:
event (json): See ProblemResetEventField.
event_type (str): Consists of the value `problem_reset`.
name (str): Consists of the value `problem_reset`.
"""
__selector__ = selector(event_source="browser", event_type="problem_reset")
event: Union[
str,
Json[UIProblemResetEventField], # pylint: disable=unsubscriptable-object
UIProblemResetEventField,
]
event_type: Literal["problem_reset"]
name: Literal["problem_reset"]
UIProblemSave (BaseBrowserModel)
pydantic-model
¶
Pydantic model for problem_save
statement.
The browser emits this statement when a user saves a problem.
Attributes:
Name | Type | Description |
---|---|---|
event |
str |
Consists of all the answers saved for the problem. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class UIProblemSave(BaseBrowserModel):
"""Pydantic model for `problem_save` statement.
The browser emits this statement when a user saves a problem.
Attributes:
event (str): Consists of all the answers saved for the problem.
event_type (str): Consists of the value `problem_save`.
name (str): Consists of the value `problem_save`.
"""
__selector__ = selector(event_source="browser", event_type="problem_save")
event: str
event_type: Literal["problem_save"]
name: Literal["problem_save"]
UIProblemShow (BaseBrowserModel)
pydantic-model
¶
Pydantic model for problem_show
statement.
The browser emits this statement when the answer clicks Show Answer to show the problem answer.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See ProblemShowEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/problem_interaction/statements.py
class UIProblemShow(BaseBrowserModel):
"""Pydantic model for `problem_show` statement.
The browser emits this statement when the answer clicks <kbd>Show Answer</kbd> to
show the problem answer.
Attributes:
event (json): See ProblemShowEventField.
event_type (str): Consists of the value `problem_save`.
name (str): Consists of the value `problem_save`.
"""
__selector__ = selector(event_source="browser", event_type="problem_show")
event: Union[
Json[UIProblemShowEventField], # pylint: disable=unsubscriptable-object
UIProblemShowEventField,
]
event_type: Literal["problem_show"]
name: Literal["problem_show"]
server
¶
Server event model definitions.
BaseServerModel (BaseEdxModel)
pydantic-model
¶
Pydantic model for core server statement.
Source code in ralph/models/edx/server.py
class BaseServerModel(BaseEdxModel):
"""Pydantic model for core server statement."""
event_source: Literal["server"]
Server (BaseServerModel)
pydantic-model
¶
Pydantic model for common server statement.
This type of event is triggered from the django middleware on each request
excluding: /event
, login
, heartbeat
, /segmentio/event
and /performance
.
Attributes:
Name | Type | Description |
---|---|---|
event_type |
str |
Consist of the relative URL (without the hostname) of the
requested page.
Retrieved with:
|
event |
str |
Consist of a JSON string holding the content of the GET or POST
request.
Retrieved with:
|
Source code in ralph/models/edx/server.py
class Server(BaseServerModel):
"""Pydantic model for common server statement.
This type of event is triggered from the django middleware on each request
excluding: `/event`, `login`, `heartbeat`, `/segmentio/event` and `/performance`.
Attributes:
event_type (str): Consist of the relative URL (without the hostname) of the
requested page.
Retrieved with:
`request.META['PATH_INFO']`
event (str): Consist of a JSON string holding the content of the GET or POST
request.
Retrieved with:
```json.dumps(
{
'GET': dict(request.GET),
'POST': dict(request.POST)
}
)[:512]```
Note:
Values for ['password', 'newpassword', 'new_password', 'oldpassword',
'old_password', 'new_password1', 'new_password2'] are replaced by
`********`.
The JSON string is truncated at 512 characters resulting in invalid
JSON.
"""
__selector__ = selector(
event_source="server", event_type=LazyModelField("context__path")
)
# pylint: disable=unsubscriptable-object
event_type: Path
event: Union[Json[ServerEventField], ServerEventField]
ServerEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for common server event
field.
Source code in ralph/models/edx/server.py
class ServerEventField(AbstractBaseEventField):
"""Pydantic model for common server `event` field."""
GET: dict
POST: dict
textbook_interaction
special
¶
fields
special
¶
events
¶
Textbook interaction event fields definitions.
BookEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for book
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
chapter |
str |
Consists of the name of the PDF file. |
name |
str |
Consists of |
new |
int |
Consists of the destination page number. |
old |
int |
Consists of the original page number. It applies to |
type |
str |
Consists of |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class BookEventField(AbstractBaseEventField):
"""Pydantic model for `book`.`event` field.
Attributes:
chapter (str): Consists of the name of the PDF file.
name (str): Consists of `textbook.pdf.page.loaded` if type is set to
`gotopage`,
`textbook.pdf.page.navigatednext` if type is set to `prevpage`,
`textbook.pdf.page.navigatednext` if type is set to `nextpage`.
new (int): Consists of the destination page number.
old (int): Consists of the original page number. It applies to `gotopage` event
types only.
type (str): Consists of `gotopage` value when a page loads after the student
manually enters its number, `prevpage` value when the next page button is
clicked or `nextpage` value when the previous page button is clicked.
"""
chapter: constr(
regex=(
r"^\/asset-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+type@asset\+block.+$" # noqa
)
)
name: Union[
Literal["textbook.pdf.page.loaded"], Literal["textbook.pdf.page.navigatednext"]
]
new: int
old: Optional[int]
type: Union[Literal["gotopage"], Literal["prevpage"], Literal["nextpage"]] = Field(
alias="type"
)
TextbookInteractionBaseEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for textbook interaction core event
field.
Attributes:
Name | Type | Description |
---|---|---|
chapter |
str |
Consists of the name of the PDF file.
It begins with the |
page |
int |
The number of the page that is open when the event is emitted. |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookInteractionBaseEventField(AbstractBaseEventField):
"""Pydantic model for textbook interaction core `event` field.
Attributes:
chapter (str): Consists of the name of the PDF file.
It begins with the `block_id` value and ends with the `.pdf` extension.
page (int): The number of the page that is open when the event is emitted.
"""
page: int
chapter: constr(
regex=(
r"^\/asset-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+type@asset\+block.+$" # noqa
)
)
TextbookPdfChapterNavigatedEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.chapter.navigated
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
chapter |
str |
Consists of the name of the PDF file.
It begins with the |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfChapterNavigatedEventField(AbstractBaseEventField):
"""Pydantic model for `textbook.pdf.chapter.navigated`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.chapter.navigated`.
chapter (str): Consists of the name of the PDF file.
It begins with the `block_id` value and ends with the `.pdf` extension.
"""
name: Literal["textbook.pdf.chapter.navigated"]
chapter: constr(
regex=(
r"^\/asset-v1:[^\/+]+(\/|\+)[^\/+]+(\/|\+)[^\/?]+type@asset\+block.+$" # noqa
)
)
chapter_title: str
TextbookPdfDisplayScaledEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.display.scaled
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
amount |
str |
Consists of a floating point number string value. |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfDisplayScaledEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.display.scaled`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.display.scaled`.
amount (str): Consists of a floating point number string value.
"""
name: Literal["textbook.pdf.display.scaled"]
amount: float
TextbookPdfOutlineToggledEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.outline.toggled
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfOutlineToggledEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.outline.toggled`.`event` field.
Attribute:
name (str): Consists of the value `textbook.pdf.outline.toggled`.
"""
name: Literal["textbook.pdf.outline.toggled"]
TextbookPdfPageNavigatedEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.page.navigated
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfPageNavigatedEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.page.navigated`.`event` field.
Attribute:
name (str): Consists of the value `textbook.pdf.page.navigated`.
"""
name: Literal["textbook.pdf.page.navigated"]
TextbookPdfPageScrolledEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.page.scrolled
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
direction |
str |
Consists either of the |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfPageScrolledEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.page.scrolled`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.page.scrolled`.
direction (str): Consists either of the `up` or `down` value.
"""
name: Literal["textbook.pdf.page.scrolled"]
direction: Union[Literal["up"], Literal["down"]]
TextbookPdfSearchCaseSensitivityToggledEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.searchcasesensitivity.toggled
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
caseSensitive |
bool |
Consists either of the |
highlightAll |
bool |
Consists either of the |
query |
str |
Consists of the value in the search field. |
status |
str |
Consists either of the value |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfSearchCaseSensitivityToggledEventField(
TextbookInteractionBaseEventField
):
"""Pydantic model for `textbook.pdf.searchcasesensitivity.toggled`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.searchcasesensitivity.toggled`.
caseSensitive (bool): Consists either of the `true` value if the case sensitive
option is selected or `false` if this option is not selected.
highlightAll (bool): Consists either of the `true` value if the option to
highlight all matches is selected or `false` if this option is not selected.
query (str): Consists of the value in the search field.
status (str): Consists either of the value `not found` for a search string that
is unsuccessful or blank for successful search strings.
"""
name: Literal["textbook.pdf.searchcasesensitivity.toggled"]
caseSensitive: bool
highlightAll: bool
query: str
status: str
TextbookPdfSearchExecutedEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.search.executed
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
caseSensitive |
bool |
Consists either of the |
highlightAll |
bool |
Consists either of the |
query |
str |
Consists of the value in the search field. |
status |
str |
Consists either of the value |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfSearchExecutedEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.search.executed`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.search.executed`.
caseSensitive (bool): Consists either of the `true` value if the case sensitive
option is selected or `false` if this option is not selected.
highlightAll (bool): Consists either of the `true` value if the option to
highlight all matches is selected or `false` if this option is not selected.
query (str): Consists of the value in the search field.
status (str): Consists either of the value `not found` for a search string that
is unsuccessful or blank for successful search strings.
"""
name: Literal["textbook.pdf.search.executed"]
caseSensitive: bool
highlightAll: bool
query: str
status: str
TextbookPdfSearchHighlightToggledEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.search.highlight.toggled
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
caseSensitive |
bool |
Consists either of the |
highlightAll |
bool |
Consists either of the |
query |
str |
Consists of the value in the search field. |
status |
str |
Consists either of the value |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfSearchHighlightToggledEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.search.highlight.toggled`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.search.highlight.toggled`.
caseSensitive (bool): Consists either of the `true` value if the case sensitive
option is selected or `false` if this option is not selected.
highlightAll (bool): Consists either of the `true` value if the option to
highlight all matches is selected or `false` if this option is not selected.
query (str): Consists of the value in the search field.
status (str): Consists either of the value `not found` for a search string that
is unsuccessful or blank for successful search strings.
"""
name: Literal["textbook.pdf.search.highlight.toggled"]
caseSensitive: bool
highlightAll: bool
query: str
status: str
TextbookPdfSearchNavigatedNextEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.search.navigatednext
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
caseSensitive |
bool |
Consists either of the |
findPrevious(bool) |
Consists either of the ‘true’ value if the user clicks the Find Previous icon or ‘false’ if the user clicks the Find Next icon. |
|
highlightAll |
bool |
Consists either of the |
query |
str |
Consists of the value in the search field. |
status |
str |
Consists either of the value |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfSearchNavigatedNextEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.search.navigatednext`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.search.navigatednext`.
caseSensitive (bool): Consists either of the `true` value if the case sensitive
option is selected or `false` if this option is not selected.
findPrevious(bool): Consists either of the ‘true’ value if the user clicks the
Find Previous icon or ‘false’ if the user clicks the <kbd>Find Next</kbd>
icon.
highlightAll (bool): Consists either of the `true` value if the option to
highlight all matches is selected or `false` if this option is not selected.
query (str): Consists of the value in the search field.
status (str): Consists either of the value `not found` for a search string that
is unsuccessful or blank for successful search strings.
"""
name: Literal["textbook.pdf.search.navigatednext"]
caseSensitive: bool
findPrevious: bool
highlightAll: bool
query: str
status: str
TextbookPdfThumbnailNavigatedEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.thumbnail.navigated
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
thumbnail_title |
str |
Consists of the name of the thumbnail. |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfThumbnailNavigatedEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.thumbnail.navigated`.`event` field.
Attribute:
name (str): Consists of the value `textbook.pdf.thumbnail.navigated`.
thumbnail_title (str): Consists of the name of the thumbnail.
"""
name: Literal["textbook.pdf.thumbnail.navigated"]
thumbnail_title: str
TextbookPdfThumbnailsToggledEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.thumbnails.toggled
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfThumbnailsToggledEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.thumbnails.toggled`.`event` field.
Attribute:
name (str): Consists of the value `textbook.pdf.thumbnails.toggled`.
"""
name: Literal["textbook.pdf.thumbnails.toggled"]
TextbookPdfZoomButtonsChangedEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.zoom.buttons.changed
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
direction |
str |
Consists of either the |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfZoomButtonsChangedEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.zoom.buttons.changed`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.zoom.buttons.changed`.
direction (str): Consists of either the `in` or `out` value.
"""
name: Literal["textbook.pdf.zoom.buttons.changed"]
direction: Union[Literal["in"], Literal["out"]]
TextbookPdfZoomMenuChangedEventField (TextbookInteractionBaseEventField)
pydantic-model
¶
Pydantic model for textbook.pdf.zoom.menu.changed
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
Consists of the value |
amount |
str |
Consists either of the |
Source code in ralph/models/edx/textbook_interaction/fields/events.py
class TextbookPdfZoomMenuChangedEventField(TextbookInteractionBaseEventField):
"""Pydantic model for `textbook.pdf.zoom.menu.changed`.`event` field.
Attributes:
name (str): Consists of the value `textbook.pdf.zoom.menu.changed`.
amount (str): Consists either of the `0.5`, `0.75`, `1`, `1.25`, `1.5`, `2`,
`3`, `4`, `auto`, `custom`, `page-actual`, `page-fit`, `page-width` value.
"""
name: Literal["textbook.pdf.zoom.menu.changed"]
amount: Union[
Literal["0.5"],
Literal["0.75"],
Literal["1"],
Literal["1.25"],
Literal["1.5"],
Literal["2"],
Literal["3"],
Literal["4"],
Literal["auto"],
Literal["custom"],
Literal["page-actual"],
Literal["page-fit"],
Literal["page-width"],
]
statements
¶
Textbook interaction event model definitions.
UIBook (BaseBrowserModel)
pydantic-model
¶
Pydantic model for book
statement.
The browser emits this statement when a user navigates within the PDF Viewer or the PNG Viewer.
Attributes:
Name | Type | Description |
---|---|---|
event |
BookEventField |
See BookEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UIBook(BaseBrowserModel):
"""Pydantic model for `book` statement.
The browser emits this statement when a user navigates within the PDF Viewer or the
PNG Viewer.
Attributes:
event (BookEventField): See BookEventField.
event_type (str): Consists of the value `book`.
name (str): Consists of the value `book`.
"""
__selector__ = selector(event_source="browser", event_type="book")
event: Union[
Json[BookEventField], BookEventField # pylint: disable=unsubscriptable-object
]
event_type: Literal["book"]
name: Literal["book"]
UITextbookPdfChapterNavigated (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.chapter.navigated
statement.
The browser emits this statement when a user clicks on a link in the outline to navigate to a chapter.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfChapterNavigatedEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfChapterNavigated(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.chapter.navigated` statement.
The browser emits this statement when a user clicks on a link in the outline to
navigate to a chapter.
Attributes:
event (json): See TextbookPdfChapterNavigatedEventField.
event_type (str): Consists of the value `textbook.pdf.chapter.navigated`.
name (str): Consists of the value `textbook.pdf.chapter.navigated`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.chapter.navigated"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfChapterNavigatedEventField
],
TextbookPdfChapterNavigatedEventField,
]
event_type: Literal["textbook.pdf.chapter.navigated"]
name: Literal["textbook.pdf.chapter.navigated"]
UITextbookPdfDisplayScaled (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.display.scaled
statement.
The browser emits this statement when the display magnification changes or the first page is shown.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfDisplayScaledEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfDisplayScaled(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.display.scaled` statement.
The browser emits this statement when the display magnification changes or the
first page is shown.
Attributes:
event (json): See TextbookPdfDisplayScaledEventField.
event_type (str): Consists of the value `textbook.pdf.display.scaled`.
name (str): Consists of the value `textbook.pdf.display.scaled`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.display.scaled"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfDisplayScaledEventField
],
TextbookPdfDisplayScaledEventField,
]
event_type: Literal["textbook.pdf.display.scaled"]
name: Literal["textbook.pdf.display.scaled"]
UITextbookPdfOutlineToggled (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.outline.toggled
statement.
The browser emits this statement when a user clicks the outline icon to show or hide a list of the book’s chapters.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfOutlineToggledEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfOutlineToggled(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.outline.toggled` statement.
The browser emits this statement when a user clicks the outline icon to show or
hide a list of the book’s chapters.
Attributes:
event (json): See TextbookPdfOutlineToggledEventField.
event_type (str): Consists of the value `textbook.pdf.outline.toggled`.
name (str): Consists of the value `textbook.pdf.outline.toggled`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.outline.toggled"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfOutlineToggledEventField
],
TextbookPdfOutlineToggledEventField,
]
event_type: Literal["textbook.pdf.outline.toggled"]
name: Literal["textbook.pdf.outline.toggled"]
UITextbookPdfPageNavigated (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.page.navigated
statement.
The browser emits this statement when a user manually enters a page number.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfPageNavigatedEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfPageNavigated(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.page.navigated` statement.
The browser emits this statement when a user manually enters a page number.
Attributes:
event (json): See TextbookPdfPageNavigatedEventField.
event_type (str): Consists of the value `textbook.pdf.page.navigated`.
name (str): Consists of the value `textbook.pdf.page.navigated`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.page.navigated"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfPageNavigatedEventField
],
TextbookPdfPageNavigatedEventField,
]
event_type: Literal["textbook.pdf.page.navigated"]
name: Literal["textbook.pdf.page.navigated"]
UITextbookPdfPageScrolled (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.page.scrolled
statement.
The browser emits this statement when the user scrolls to the next or previous page and the transition takes less than 50 milliseconds.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfPageScrolledEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfPageScrolled(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.page.scrolled` statement.
The browser emits this statement when the user scrolls to the next or previous page
and the transition takes less than 50 milliseconds.
Attributes:
event (json): See TextbookPdfPageScrolledEventField.
event_type (str): Consists of the value `textbook.pdf.page.scrolled`.
name (str): Consists of the value `textbook.pdf.page.scrolled`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.page.scrolled"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfPageScrolledEventField
],
TextbookPdfPageScrolledEventField,
]
event_type: Literal["textbook.pdf.page.scrolled"]
name: Literal["textbook.pdf.page.scrolled"]
UITextbookPdfSearchCaseSensitivityToggled (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.searchcasesensitivity.toggled
statement.
The browser emits this statement when a user selects or clears the Match Case option.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfSearchCaseSensitivityToggledEventField. |
event_type |
str |
Consists of the value
|
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfSearchCaseSensitivityToggled(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.searchcasesensitivity.toggled` statement.
The browser emits this statement when a user selects or clears the
<kbd>Match Case</kbd> option.
Attributes:
event (json): See TextbookPdfSearchCaseSensitivityToggledEventField.
event_type (str): Consists of the value
`textbook.pdf.searchcasesensitivity.toggled`.
name (str): Consists of the value `textbook.pdf.searchcasesensitivity.toggled`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.searchcasesensitivity.toggled"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfSearchCaseSensitivityToggledEventField
],
TextbookPdfSearchCaseSensitivityToggledEventField,
]
event_type: Literal["textbook.pdf.searchcasesensitivity.toggled"]
name: Literal["textbook.pdf.searchcasesensitivity.toggled"]
UITextbookPdfSearchExecuted (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.search.executed
statement.
The browser emits this statement when a user searches for a text value in the file.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfSearchExecutedEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfSearchExecuted(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.search.executed` statement.
The browser emits this statement when a user searches for a text value in the file.
Attributes:
event (json): See TextbookPdfSearchExecutedEventField.
event_type (str): Consists of the value `textbook.pdf.search.executed`.
name (str): Consists of the value `textbook.pdf.search.executed`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.search.executed"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfSearchExecutedEventField
],
TextbookPdfSearchExecutedEventField,
]
event_type: Literal["textbook.pdf.search.executed"]
name: Literal["textbook.pdf.search.executed"]
UITextbookPdfSearchHighlightToggled (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.search.highlight.toggled
statement.
The browser emits this statement when a user selects or clears the Highlight All option.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfSearchHighlightToggledEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfSearchHighlightToggled(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.search.highlight.toggled` statement.
The browser emits this statement when a user selects or clears the
<kbd>Highlight All</kbd> option.
Attributes:
event (json): See TextbookPdfSearchHighlightToggledEventField.
event_type (str): Consists of the value `textbook.pdf.search.highlight.toggled`.
name (str): Consists of the value `textbook.pdf.search.highlight.toggled`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.search.highlight.toggled"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfSearchHighlightToggledEventField
],
TextbookPdfSearchHighlightToggledEventField,
]
event_type: Literal["textbook.pdf.search.highlight.toggled"]
name: Literal["textbook.pdf.search.highlight.toggled"]
UITextbookPdfSearchNavigatedNext (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.search.navigatednext
statement.
The browser emits this statement when a user clicks on the Find Next or Find Previous icons for an entered search string.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfSearchNavigatedNextEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfSearchNavigatedNext(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.search.navigatednext` statement.
The browser emits this statement when a user clicks on the <kbd>Find Next</kbd> or
<kbd>Find Previous</kbd> icons for an entered search string.
Attributes:
event (json): See TextbookPdfSearchNavigatedNextEventField.
event_type (str): Consists of the value `textbook.pdf.search.navigatednext`.
name (str): Consists of the value `textbook.pdf.search.navigatednext`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.search.navigatednext"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfSearchNavigatedNextEventField
],
TextbookPdfSearchNavigatedNextEventField,
]
event_type: Literal["textbook.pdf.search.navigatednext"]
name: Literal["textbook.pdf.search.navigatednext"]
UITextbookPdfThumbnailNavigated (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.thumbnail.navigated
statement.
The browser emits this statement when a user clicks on a thumbnail image to navigate to a page.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfThumbnailNavigatedEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfThumbnailNavigated(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.thumbnail.navigated` statement.
The browser emits this statement when a user clicks on a thumbnail image to
navigate to a page.
Attributes:
event (json): See TextbookPdfThumbnailNavigatedEventField.
event_type (str): Consists of the value `textbook.pdf.thumbnail.navigated`.
name (str): Consists of the value `textbook.pdf.thumbnail.navigated`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.thumbnail.navigated"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfThumbnailNavigatedEventField
],
TextbookPdfThumbnailNavigatedEventField,
]
event_type: Literal["textbook.pdf.thumbnail.navigated"]
name: Literal["textbook.pdf.thumbnail.navigated"]
UITextbookPdfThumbnailsToggled (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.thumbnails.toggled
statement.
The browser emits this statement when a user clicks on the icon to show or hide page thumbnails.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfThumbnailsToggledEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfThumbnailsToggled(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.thumbnails.toggled` statement.
The browser emits this statement when a user clicks on the icon to show or hide
page thumbnails.
Attributes:
event (json): See TextbookPdfThumbnailsToggledEventField.
event_type (str): Consists of the value `textbook.pdf.thumbnails.toggled`.
name (str): Consists of the value `textbook.pdf.thumbnails.toggled`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.thumbnails.toggled"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfThumbnailsToggledEventField
],
TextbookPdfThumbnailsToggledEventField,
]
event_type: Literal["textbook.pdf.thumbnails.toggled"]
name: Literal["textbook.pdf.thumbnails.toggled"]
UITextbookPdfZoomButtonsChanged (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.zoom.buttons.changed
statement.
The browser emits this statement when a user clicks either the Zoom In or Zoom Out icon.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfZoomButtonsChangedEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfZoomButtonsChanged(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.zoom.buttons.changed` statement.
The browser emits this statement when a user clicks either the <kbd>Zoom In</kbd>
or <kbd>Zoom Out</kbd> icon.
Attributes:
event (json): See TextbookPdfZoomButtonsChangedEventField.
event_type (str): Consists of the value `textbook.pdf.zoom.buttons.changed`.
name (str): Consists of the value `textbook.pdf.zoom.buttons.changed`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.zoom.buttons.changed"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfZoomButtonsChangedEventField
],
TextbookPdfZoomButtonsChangedEventField,
]
event_type: Literal["textbook.pdf.zoom.buttons.changed"]
name: Literal["textbook.pdf.zoom.buttons.changed"]
UITextbookPdfZoomMenuChanged (BaseBrowserModel)
pydantic-model
¶
Pydantic model for textbook.pdf.zoom.menu.changed
statement.
The browser emits this statement when a user selects a magnification setting.
Attributes:
Name | Type | Description |
---|---|---|
event |
json |
See TextbookPdfZoomMenuChangedEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists of the value |
Source code in ralph/models/edx/textbook_interaction/statements.py
class UITextbookPdfZoomMenuChanged(BaseBrowserModel):
"""Pydantic model for `textbook.pdf.zoom.menu.changed` statement.
The browser emits this statement when a user selects a magnification setting.
Attributes:
event (json): See TextbookPdfZoomMenuChangedEventField.
event_type (str): Consists of the value `textbook.pdf.zoom.menu.changed`.
name (str): Consists of the value `textbook.pdf.zoom.menu.changed`.
"""
__selector__ = selector(
event_source="browser", event_type="textbook.pdf.zoom.menu.changed"
)
event: Union[
Json[ # pylint: disable=unsubscriptable-object
TextbookPdfZoomMenuChangedEventField
],
TextbookPdfZoomMenuChangedEventField,
]
event_type: Literal["textbook.pdf.zoom.menu.changed"]
name: Literal["textbook.pdf.zoom.menu.changed"]
video
special
¶
fields
special
¶
events
¶
Video event fields definitions.
PauseVideoEventField (VideoBaseEventField)
pydantic-model
¶
Pydantic model for pause_video
.event
.
Attributes:
Name | Type | Description |
---|---|---|
currentTime |
float |
Consists of the time in the video at which the statement was emitted. |
Source code in ralph/models/edx/video/fields/events.py
class PauseVideoEventField(VideoBaseEventField):
"""Pydantic model for `pause_video`.`event`.
Attributes:
currentTime (float): Consists of the time in the video at which
the statement was emitted.
"""
currentTime: float
PlayVideoEventField (VideoBaseEventField)
pydantic-model
¶
Pydantic model for play_video
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
currentTime |
float |
Consists of the time in the video at which the statement was emitted. |
Source code in ralph/models/edx/video/fields/events.py
class PlayVideoEventField(VideoBaseEventField):
"""Pydantic model for `play_video`.`event` field.
Attributes:
currentTime (float): Consists of the time in the video at which
the statement was emitted.
"""
currentTime: float
SeekVideoEventField (VideoBaseEventField)
pydantic-model
¶
Pydantic model for seek_video
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
new_time |
float |
Consists of the point in time the actor changed to in a media object during a seek operation. |
old_time |
float |
Consists of the point in time the actor changed from in a media object during a seek operation. |
type |
str |
Consists of the navigational method used to change position
within the video, either |
Source code in ralph/models/edx/video/fields/events.py
class SeekVideoEventField(VideoBaseEventField):
"""Pydantic model for `seek_video`.`event` field.
Attributes:
new_time (float): Consists of the point in time the actor changed to in a media
object during a seek operation.
old_time (float): Consists of the point in time the actor changed from in a
media object during a seek operation.
type (str): Consists of the navigational method used to change position
within the video, either `onCaptionSeek` or `onSlideSeek` value.
"""
new_time: float
old_time: float
type: str
SpeedChangeVideoEventField (VideoBaseEventField)
pydantic-model
¶
Pydantic model for speed_change_video
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
currentTime |
float |
Consists of the time in the video at which the statement was emitted. |
Source code in ralph/models/edx/video/fields/events.py
class SpeedChangeVideoEventField(VideoBaseEventField):
"""Pydantic model for `speed_change_video`.`event` field.
Attributes:
currentTime (float): Consists of the time in the video at which
the statement was emitted.
"""
currentTime: float
new_speed: Literal["0.75", "1.0", "1.25", "1.50", "2.0"]
old_speed: Literal["0.75", "1.0", "1.25", "1.50", "2.0"]
StopVideoEventField (VideoBaseEventField)
pydantic-model
¶
Pydantic model for stop_video
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
currentTime |
float |
Consists of the time in the video at which the statement was emitted. |
Source code in ralph/models/edx/video/fields/events.py
class StopVideoEventField(VideoBaseEventField):
"""Pydantic model for `stop_video`.`event` field.
Attributes:
currentTime (float): Consists of the time in the video at which
the statement was emitted.
"""
currentTime: float
VideoBaseEventField (AbstractBaseEventField)
pydantic-model
¶
Pydantic model for video core event
field.
Attributes:
Name | Type | Description |
---|---|---|
code |
str |
Consists of the |
id |
str |
Consists of the additional videos name if given by the course creators, or the system-generated hash code otherwise. |
Source code in ralph/models/edx/video/fields/events.py
class VideoBaseEventField(AbstractBaseEventField):
"""Pydantic model for video core `event` field.
Attributes:
code (str): Consists of the `html5` value for browser-played
videos.
id (str): Consists of the additional videos name if given by the
course creators, or the system-generated hash code otherwise.
"""
class Config: # pylint: disable=missing-class-docstring # noqa: D106
extra = "allow"
code: str
id: str
VideoHideTranscriptEventField (VideoBaseEventField)
pydantic-model
¶
Pydantic model for hide_transcript
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
current_time |
float |
Consists of the time in the video at which the statement was emitted. |
Source code in ralph/models/edx/video/fields/events.py
class VideoHideTranscriptEventField(VideoBaseEventField):
"""Pydantic model for `hide_transcript`.`event` field.
Attributes:
current_time (float): Consists of the time in the video at which
the statement was emitted.
"""
current_time: float
VideoShowTranscriptEventField (VideoBaseEventField)
pydantic-model
¶
Pydantic model for show_transcript
.event
field.
Attributes:
Name | Type | Description |
---|---|---|
current_time |
float |
Consists of the time in the video at which the statement was emitted. |
Source code in ralph/models/edx/video/fields/events.py
class VideoShowTranscriptEventField(VideoBaseEventField):
"""Pydantic model for `show_transcript`.`event` field.
Attributes:
current_time (float): Consists of the time in the video at which
the statement was emitted.
"""
current_time: float
statements
¶
Video event model definitions.
UIHideTranscript (BaseBrowserModel)
pydantic-model
¶
Pydantic model for hide_transcript
statement.
The browser emits this statement when a user selects CC to suppress display of the video transcript.
Attributes:
Name | Type | Description |
---|---|---|
event |
VideoTranscriptEventField |
See VideoTranscriptEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/video/statements.py
class UIHideTranscript(BaseBrowserModel):
"""Pydantic model for `hide_transcript` statement.
The browser emits this statement when a user selects <kbd>CC</kbd> to suppress
display of the video transcript.
Attributes:
event (VideoTranscriptEventField): See VideoTranscriptEventField.
event_type (str): Consists of the value `hide_transcript`.
name (str): Consists either of the value `hide_transcript` or
`edx.video.transcript.hidden`.
"""
__selector__ = selector(event_source="browser", event_type="hide_transcript")
event: Union[
Json[VideoHideTranscriptEventField], # pylint: disable=unsubscriptable-object
VideoHideTranscriptEventField,
]
event_type: Literal["hide_transcript"]
name: Literal["hide_transcript", "edx.video.transcript.hidden"]
UILoadVideo (BaseBrowserModel)
pydantic-model
¶
Pydantic model for load_video
statement.
The browser emits this statement when the video is fully rendered and ready to play.
Attributes:
Name | Type | Description |
---|---|---|
event |
VideoBaseEventField |
See VideoBaseEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/video/statements.py
class UILoadVideo(BaseBrowserModel):
"""Pydantic model for `load_video` statement.
The browser emits this statement when the video is fully rendered and ready to
play.
Attributes:
event (VideoBaseEventField): See VideoBaseEventField.
event_type (str): Consists of the value `load_video`.
name (str): Consists either of the value `load_video` or `edx.video.loaded`.
"""
__selector__ = selector(event_source="browser", event_type="load_video")
event: Union[
Json[VideoBaseEventField], # pylint: disable=unsubscriptable-object
VideoBaseEventField,
]
event_type: Literal["load_video"]
name: Literal["load_video", "edx.video.loaded"]
UIPauseVideo (BaseBrowserModel)
pydantic-model
¶
Pydantic model for pause_video
statement.
The browser emits this statement when a user selects the video player’s pause control.
Attributes:
Name | Type | Description |
---|---|---|
event |
PauseVideoEventField |
See PauseVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/video/statements.py
class UIPauseVideo(BaseBrowserModel):
"""Pydantic model for `pause_video` statement.
The browser emits this statement when a user selects the video player's pause
control.
Attributes:
event (PauseVideoEventField): See PauseVideoEventField.
event_type (str): Consists of the value `pause_video`.
name (str): Consists either of the value `pause_video` or `edx.video.paused`.
"""
__selector__ = selector(event_source="browser", event_type="pause_video")
event: Union[
Json[PauseVideoEventField], # pylint: disable=unsubscriptable-object
PauseVideoEventField,
]
event_type: Literal["pause_video"]
name: Optional[Literal["pause_video", "edx.video.paused"]]
UIPlayVideo (BaseBrowserModel)
pydantic-model
¶
Pydantic model for play_video
statement.
The browser emits this statement when a user selects the video player’s play control.
Attributes:
Name | Type | Description |
---|---|---|
event |
PlayVideoEventField |
See PlayVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/video/statements.py
class UIPlayVideo(BaseBrowserModel):
"""Pydantic model for `play_video` statement.
The browser emits this statement when a user selects the video player's play
control.
Attributes:
event (PlayVideoEventField): See PlayVideoEventField.
event_type (str): Consists of the value `play_video`.
name (str): Consists either of the value `play_video` or `edx.video.played`.
"""
__selector__ = selector(event_source="browser", event_type="play_video")
event: Union[
Json[PlayVideoEventField], # pylint: disable=unsubscriptable-object
PlayVideoEventField,
]
event_type: Literal["play_video"]
name: Optional[Literal["play_video", "edx.video.played"]]
UISeekVideo (BaseBrowserModel)
pydantic-model
¶
Pydantic model for seek_video
statement.
The browser emits this statement when a user selects a user interface control to go to a different point in the video file.
Attributes:
Name | Type | Description |
---|---|---|
event |
SeekVideoEventField |
See SeekVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/video/statements.py
class UISeekVideo(BaseBrowserModel):
"""Pydantic model for `seek_video` statement.
The browser emits this statement when a user selects a user interface control to go
to a different point in the video file.
Attributes:
event (SeekVideoEventField): See SeekVideoEventField.
event_type (str): Consists of the value `seek_video`.
name (str): Consists either of the value `seek_video` or
`edx.video.position.changed`.
"""
__selector__ = selector(event_source="browser", event_type="seek_video")
event: Union[
Json[SeekVideoEventField], # pylint: disable=unsubscriptable-object
SeekVideoEventField,
]
event_type: Literal["seek_video"]
name: Optional[Literal["seek_video", "edx.video.position.changed"]]
UIShowTranscript (BaseBrowserModel)
pydantic-model
¶
Pydantic model for show_transcript
statement.
The browser emits this statement when a user selects CC to display the video transcript.
Attributes:
Name | Type | Description |
---|---|---|
event |
VideoTranscriptEventField |
See VideoTranscriptEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/video/statements.py
class UIShowTranscript(BaseBrowserModel):
"""Pydantic model for `show_transcript` statement.
The browser emits this statement when a user selects <kbd>CC</kbd> to display the
video transcript.
Attributes:
event (VideoTranscriptEventField): See VideoTranscriptEventField.
event_type (str): Consists of the value `show_transcript`.
name (str): Consists either of the value `show_transcript` or
`edx.video.transcript.shown`.
"""
__selector__ = selector(event_source="browser", event_type="show_transcript")
event: Union[
Json[VideoShowTranscriptEventField], # pylint: disable=unsubscriptable-object
VideoShowTranscriptEventField,
]
event_type: Literal["show_transcript"]
name: Literal["show_transcript", "edx.video.transcript.shown"]
UISpeedChangeVideo (BaseBrowserModel)
pydantic-model
¶
Pydantic model for speed_change_video
statement.
The browser emits this statement when a user selects a different playing speed for the video.
Attributes:
Name | Type | Description |
---|---|---|
event |
SpeedChangeVideoEventField |
See SpeedChangeVideoEventField. |
event_type |
str |
Consists of the value |
Source code in ralph/models/edx/video/statements.py
class UISpeedChangeVideo(BaseBrowserModel):
"""Pydantic model for `speed_change_video` statement.
The browser emits this statement when a user selects a different playing speed for
the video.
Attributes:
event (SpeedChangeVideoEventField): See SpeedChangeVideoEventField.
event_type (str): Consists of the value `speed_change_video`.
"""
__selector__ = selector(event_source="browser", event_type="speed_change_video")
event: Union[
Json[SpeedChangeVideoEventField], # pylint: disable=unsubscriptable-object
SpeedChangeVideoEventField,
]
event_type: Literal["speed_change_video"]
name: Optional[Literal["speed_change_video"]]
UIStopVideo (BaseBrowserModel)
pydantic-model
¶
Pydantic model for stop_video
statement.
The browser emits this statement when the video player reaches the end of the video file and play automatically stops.
Attributes:
Name | Type | Description |
---|---|---|
event |
StopVideoEventField |
See StopVideoEventField. |
event_type |
str |
Consists of the value |
name |
str |
Consists either of the value |
Source code in ralph/models/edx/video/statements.py
class UIStopVideo(BaseBrowserModel):
"""Pydantic model for `stop_video` statement.
The browser emits this statement when the video player reaches the end of the video
file and play automatically stops.
Attributes:
event (StopVideoEventField): See StopVideoEventField.
event_type (str): Consists of the value `stop_video`.
name (str): Consists either of the value `stop_video` or `edx.video.stopped`.
"""
__selector__ = selector(event_source="browser", event_type="stop_video")
event: Union[
Json[StopVideoEventField], # pylint: disable=unsubscriptable-object
StopVideoEventField,
]
event_type: Literal["stop_video"]
name: Optional[Literal["stop_video", "edx.video.stopped"]]
UIVideoHideCCMenu (BaseBrowserModel)
pydantic-model
¶
Pydantic model for video_hide_cc_menu
statement.
The browser emits this statement when a user selects a language from the CC menu for a video that has transcripts in multiple languages
Attributes:
Name | Type | Description |
---|---|---|
event |
VideoBaseEventField |
See VideoBaseEventField. |
event_type |
str |
Consists of the value |
Source code in ralph/models/edx/video/statements.py
class UIVideoHideCCMenu(BaseBrowserModel):
"""Pydantic model for `video_hide_cc_menu` statement.
The browser emits this statement when a user selects a language from the CC menu
for a video that has transcripts in multiple languages
Attributes:
event (VideoBaseEventField): See VideoBaseEventField.
event_type (str): Consists of the value `video_hide_cc_menu`.
"""
__selector__ = selector(event_source="browser", event_type="video_hide_cc_menu")
event: Union[
Json[VideoBaseEventField], # pylint: disable=unsubscriptable-object
VideoBaseEventField,
]
event_type: Literal["video_hide_cc_menu"]
name: Optional[Literal["video_hide_cc_menu"]]
UIVideoShowCCMenu (BaseBrowserModel)
pydantic-model
¶
Pydantic model for video_show_cc_menu
statement.
The browser emits this statement when a user selects CC for a video that has transcripts in multiple languages.
Note: This statement is emitted in addition to the show_transcript event.
Attributes:
Name | Type | Description |
---|---|---|
event |
VideoBaseEventField |
See VideoBaseEventField. |
event_type |
str |
Consists of the value |
Source code in ralph/models/edx/video/statements.py
class UIVideoShowCCMenu(BaseBrowserModel):
"""Pydantic model for `video_show_cc_menu` statement.
The browser emits this statement when a user selects CC for a video that has
transcripts in multiple languages.
Note: This statement is emitted in addition to the show_transcript event.
Attributes:
event (VideoBaseEventField): See VideoBaseEventField.
event_type (str): Consists of the value `video_show_cc_menu`.
"""
__selector__ = selector(event_source="browser", event_type="video_show_cc_menu")
event: Union[
Json[VideoBaseEventField], # pylint: disable=unsubscriptable-object
VideoBaseEventField,
]
event_type: Literal["video_show_cc_menu"]
name: Optional[Literal["video_show_cc_menu"]]