Brightspace Data Streams (July 2023)

Processing BDS Events

«  Lambda Basics   ·  [   home  ·   community   |   search  ·   index   ·  next   ·  previous   ]   ·  Recommended Testing Procedures  »

In order for a lambda function to process a stream of BDS event objects, the function must have the proper permissions on the Kinesis stream. The AWSLambdaKinesisExecutionRole managed policy includes these permissions.

Kinesis data is base64 encoded, so lambdas must decode the data before processing it. This is demonstrated in a number of lambda code examples provided by AWS. These code examples also contain links to pages describing how to deploy lambdas written in various programming languages. For example, AWS Lambda Deployment Package in Node.js describes how to deploy lambdas written in Javascript.

All BDS event objects currently have an xAPI format. For a list of supported event objects, see BDS xAPI events.

Lambdas should be written in accordance with AWS recommendations for best practices.

Obtaining Information from Brightspace

BDS event objects use UUIDs to refer to people, courses, and other entities. These are used in order to conform with the xAPI standard and to simplify the process of aggregating data that involves a particular person or entity. However, BDS users will often want more information than just the UUID. For example, if a UUID refers to a student, you may want to know the student’s name, email address, and so on.

You can obtain such information from Brightspace itself, using information provided in the event object’s context section. For example, if the actor section of the event object specifies the UUID of a student, you can obtain the student’s Brightspace ID number from

context.extensions["https://api.brightspace.com/xapi/extension_keys/context/actor"].userId

Your lambda can then use the Brightspace API action

GET /d2l/api/lp/(version)/users/(userid)

(and similar actions) to obtain information about the user.

Your lambda function can use a similar approach for obtaining data on a larger scale, using appropriate functions. For example, if an event refers to an OrgUnit, you can use the action

GET /d2l/api/le/(version)/orgUnitId/classlist/paged

to obtain the full class list for the OrgUnit. Note that this uses the “paged” version of the action to obtain a paged data set. This avoids problems that might arise if the class size is very large.

«  Lambda Basics   ·  [   home  ·   community   |   search  ·   index   ·  next   ·  previous   ]   ·  Recommended Testing Procedures  »