Skip to content

Commit

Permalink
feat: Add IDV attempt events (#385)
Browse files Browse the repository at this point in the history
Adding events for status changes to the new VerificationAttempt model planned for edx-platform.
  • Loading branch information
ilee2u authored Sep 5, 2024
1 parent bc353f9 commit f790bd4
Show file tree
Hide file tree
Showing 8 changed files with 394 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Change Log
Unreleased
----------

[9.13.0] - 2024-09-05
---------------------

Added
~~~~~~~

* Added new IDV events ``LEARNER_CREDIT_COURSE_ENROLLMENT_REVOKED``, ``IDV_ATTEMPT_CREATED``, ``IDV_ATTEMPT_PENDING``, ``IDV_ATTEMPT_APPROVED``, and ``IDV_ATTEMPT_DENIED`` in learning.

[9.12.0] - 2024-07-31
---------------------

Expand Down
2 changes: 1 addition & 1 deletion openedx_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
more information about the project.
"""

__version__ = "9.12.0"
__version__ = "9.13.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "idv_attempt",
"type": {
"name": "VerificationAttemptData",
"type": "record",
"fields": [
{
"name": "attempt_id",
"type": "long"
},
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "status",
"type": "string"
},
{
"name": "name",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "expiration_date",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
],
"namespace": "org.openedx.learning.idv_attempt.approved.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "idv_attempt",
"type": {
"name": "VerificationAttemptData",
"type": "record",
"fields": [
{
"name": "attempt_id",
"type": "long"
},
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "status",
"type": "string"
},
{
"name": "name",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "expiration_date",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
],
"namespace": "org.openedx.learning.idv_attempt.created.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "idv_attempt",
"type": {
"name": "VerificationAttemptData",
"type": "record",
"fields": [
{
"name": "attempt_id",
"type": "long"
},
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "status",
"type": "string"
},
{
"name": "name",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "expiration_date",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
],
"namespace": "org.openedx.learning.idv_attempt.denied.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "idv_attempt",
"type": {
"name": "VerificationAttemptData",
"type": "record",
"fields": [
{
"name": "attempt_id",
"type": "long"
},
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "status",
"type": "string"
},
{
"name": "name",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "expiration_date",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
],
"namespace": "org.openedx.learning.idv_attempt.pending.v1"
}
20 changes: 20 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,3 +589,23 @@ class BadgeData:
uuid = attr.ib(type=str)
user = attr.ib(type=UserData)
template = attr.ib(type=BadgeTemplateData)


@attr.s(frozen=True)
class VerificationAttemptData:
"""
Attributes defined for the Open edX IDV attempt data object.
Arguments:
attempt_id (int): the id of the verification attempt
user (User): the user (usually a learner) performing the verification attempt.
status (string): the status of the verification attempt.
name (string): the name being ID verified. Defaults to None.
expiration_datetime (datetime, optional): When the verification attempt expires. Defaults to None.
"""

attempt_id = attr.ib(type=int)
user = attr.ib(type=UserData)
status = attr.ib(type=str)
name = attr.ib(type=str, default=None)
expiration_date = attr.ib(type=datetime, default=None)
Loading

0 comments on commit f790bd4

Please sign in to comment.