Scantron Integration - Scheduling (Private)
The Scantron integration is a “2nd class citizen” in LearningBuilder. It requires some advanced configuration in LearningBuilder and some AWS configuration, but does not require any client-specific customization of core files.
See also: Scantron Integration - Eligibility
Executive Summary
The Scantron integration consists of two pieces:
Eligibility: A “Call External API” Behavior that uses a Template to construct an API call, notifying Scantron of a candidate’s eligibility to test
Scheduling: An AWS Lambda that receives scheduling information and can store that information in Workflow attributes
This document describes the technical architecture of the integration and the instructions for implementing it.
Setting up the integration takes approximately <TODO>.
Technical summary
Scantron makes a single, nightly API call containing a batch of all members who have completed the Scantron Eligibility process. This endpoint is protected by Basic Authentication and accepts the Candidate Exams payload format.
To support the performance and security requirements of the integration, the following components have been created.
AWS Http Gateway - HTTP GATEWAY Receives requests for he scheduling process. Configured to use the LearningBuilder-Basic-Authorizer for security and to call the LearningBuilder-Queue lambda.
Simple Queuing Service - SQS Receives messages from the LearningBuilder-Queue lambda. Configured to send messages to the LearningBuilder-Scantron lambda.
ScantronConfig - DYNAMODB Stores the configuration data for the scantron process. Uses stages to support multiple clients.
LearningBuilder-Basic-Authorizer - LAMBDA UNIVERSAL Extracts a LearningBuilder API Key from the Basic Auth header and confirms it has the rights to complete the process. For Scantron, it needs to be able to call the Perform Workflow Step API and OData.
LearningBuilder-Queue - LAMBDA UNIVERSAL Copies the content of the REST call onto a pre-defined SQS queue.
LearningBuilder.Scantron - LAMBDA
Parses the batch payload into individual scheduling updates
For each update, calls a series of LearningBuilder API endpoints to perform
Workflow Actions
1 that store the scheduling data and, optionally, trigger additional Behaviors
For each scheduling update, the Lambda calls two LearningBuilder APIs:
OData2 - obtains the
ActivityInstanceId
andWorkflowInstanceId
valuesPerformStep/ - Executes a specific
Workflow Action
. TheWorkflowActionId
is configured in AWS. (See below)
This Lambda is not part of the core LearningBuilder solution, but is designed so that it can be reused by multiple clients. It does not contain any client-specific code in the Lambda function itself.
1 PerformStep: This integration was initially completed for ABO who were on 10.0.x at the time and did not have access to Data Import Steps from 10.4.
In the future, this integration should be updated to use Data Import Steps because:
It removes the need for the target
Workflow Instance
to be on a particularStep
when the scheduling data is received, andIt reduces the risk that the target
Action
is inadvertently updated by an unrelated change to theWorkflow
, such as the changing of fields displayed on a specificStep
Configuration Instructions
Step 1: LearningBuilder Authentication Configuration
We are using the built in API Keys to manage security for the feature.
Create a new Authorization Rule Set (/SysAdmin/Authorization/Rules) for Scantron.
Determine who needs to be able to run the feature and add the appropriate role. If Scantron does not have an account inside LearningBuilder, you may want to restrict it to System Administrators.
Add the PERFORM_WORKFLOW_STEP permission and add a custom permission called SCANTRON
Create a new OData Entity (/SysAdmin/Odata/Entities)
Add view vRPT_LearningPlanInstance to LearningBuilder
Expost vRPT_LearningPlanInstance as a new OData Entity and make it accessible to the SCANTRON permission added in step #1.
Create an API Key (/Admin/Profile/ApiKey) for the account that will be used to process scheduling event
Create a Key for the Scantron Authorization Rule Set
Step 2: LearningBuilder Workflow Configuration
Add Scheduling Attributes to the Learning Plan Workflow Step that is awaiting the Test Results.
Step 3: Configure AWS
3.1: Configure DynamoDb
Add Configuration to DynamoDb table ScantronConfig in AWS
Add Stage that uses the client’s Client ID
Add the LearningPlanId and ActionId values. The Perform Step Action needs to know which Learning Plan Definition and Action to use.
Add LbDomain of the LearningBuilder Instance
Add the Attribute Mappings for each Attribute we want to set. The Mappings include the attribute name and the XPath value of where the value is located in the Registration Status Export.
Lambda Configuration in DynamoDb | Registration Status Export |
---|---|
3.2: Configure authentication
Confirm that the LearningBuilder-Scantron and LearningBuilder-Basic-Authorizer AWS lambdas have been installed. Production only needs a single instance of both lambdas.
Confirm that the LearningBuilder-Scantron-API API Gateway has been installed.
There should be routes defined for Scheduling and Health
Both routes should be protected by the LearningBuilder-Basic-Authorizer AWS lambda as an authorizer
Both routes should be configured to integrate with the LearningBuilder-Scantron AWS lambda
Add a Stage to the LearningBuilder-Scantron-API API Gateway that matches the client ID of the LearningBuilder Instance
Add a Stage variable of credential_validator that points to an API for the target LearningBuilder instance.
Enable Automatic Deployment so that the stage always uses the latest version of the lambdas.
Appendix A: Scantron Scheduling Logging
All the Scantron Scheduling Logs are located in CloudWatch. Each component has its own Log Group. AWS lambdas LearningBuilder-Scantron and LearningBuilder-Basic-Authorizer. Each Registration Status Export triggers the following log messages.
Scheduling
. We store everything that is sent to the endpoint before any processing or analysis occurs. This prevents us from losing any data that is sent to the lambdas.GetWorkflowInstanceId
. Using our OData endpoint, we find the Workflow Instance Id for the Learning Plan Instance for the given Unique Id. The Learning Plan Instance must be have a Completion Status of “Incomplete”, belongs to the Learning Plan Definition defined in the DynamoDb Config, and is on the step where the Workflow Action defined in the DynamoDb Config resides.ProcessSchedule
. We log the request of the Perform Step API for each record.ProcessResponse
. We log the response of the Perform Step API for each record.