Methods
This article details methods the host page can use to interact with Reports API.
LearnosityReports
The following methods are accessed via the window.LearnosityReports
object.
When the <script src="https://reports-va.learnosity.com"></script>
tag is included on the page, the window.LearnosityReports
object is instantiated, and ready for use.
LearnosityReports.init()
method initializes Reports API and returns an instance
of the application object (ReportsApp). This instance
needs to be saved locally for future access to initialized reports.
Parameters | |
---|---|
initObject |
Type:
object See the Reports API initialization object for more information. |
callbacks |
Type:
object See the Reports API events during initialization for more information. |
reportsApp
The following methods are accessed via the reportsApp
object returned by window.LearnosityReports.init()
. This object provides methods to interact with, and receive information relating to the reports placed on page.
ReportsApp.getReport()
returns a Report object used for interacting with an initialized report, based on the id
of the report provided in the request object.
Parameters | |
---|---|
reportId |
Type:
string The report ID provided in the request object when calling the |
report
The following methods are accessed via the report
object returned by reportsApp.getReport()
. This object provides methods to interact with, and receive information for reports used.
Binds a callback function that will be invoked whenever the eventName is triggered.
Parameters | |
---|---|
eventName |
Type:
string Name of the event that you want to start listening to See Report specific events for more information. |
eventCallback |
Type:
callback() Callback function that will be triggered whenever the event is fired. |
Subscribe to and control additional user IDs.
Important Only applicable to the live-activity-status-by-user report.
Parameters | |
---|---|
userArray |
Type:
array[userObject] Array of users to be added to the report. |
Discard and terminate the test for the user IDs provided.
Important Only applicable to the live-activity-status-by-user report.
Parameters | |
---|---|
userArray |
Type:
array[string] Array of user_ids to be added to the report. |
Save and terminate the test for the user IDs provided.
Important Only applicable to the live-activity-status-by-user report.
Parameters | |
---|---|
userArray |
Type:
array[string] Array of user_ids to be added to the report. |
Submit and then exit the test for the user IDs provided.
Important Only applicable to the live-activity-status-by-user report.
Parameters | |
---|---|
userArray |
Type:
array[string] Array of user_ids to be added to the report. |
Extend time (in seconds) for the test of the user IDs provided.
Important Only applicable to the live-activity-status-by-user report.
Parameters | |
---|---|
userArray |
Type:
array[string] Array of user_ids to be added to the report. |
seconds |
Type:
number number of seconds to extend the assessment timer by |
Pause the test for the user IDs provided.
Important Only applicable to the live-activity-status-by-user report.
Parameters | |
---|---|
userArray |
Type:
array[string] Array of user_ids to be added to the report. |
Unpause the test for the user IDs provided.
Important Only applicable to the live-activity-status-by-user report.
Parameters | |
---|---|
userArray |
Type:
array[string] Array of user_ids to be added to the report. |
Each of the user IDs provided will navigate to the specified item.
The assessment will be automatically started if the student is still on the intro item.
The item is specified by reference (a string) or number (a 1-indexed number).
Important Only applicable to the live-activity-status-by-user report.
Parameters | |||||||||
---|---|---|---|---|---|---|---|---|---|
userArray |
Type:
array[userObject] Array of users to be added to the report. |
||||||||
itemObject |
Type:
object object containing either an item_number or item_reference property.
|
Returns array of user_id strings for the currently selected users.
Important Only applicable to the live-activity-status-by-user report.
Retrieves a specific portion of raw score data that is available to the report, based on a given set of user and tag filters.
This method retrieves the data asynchronously, and returns a promise that resolves with the data.
Important Only applicable to the item-scores-by-tag-by-user report.
Parameters | |||||||||
---|---|---|---|---|---|---|---|---|---|
params |
Type:
object A collection of required and optional parameters for selecting and filtering the data to be retrieved.
|
Returns the group path currently displayed in the report..
Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.
Navigates the report to the given group path.
Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.
Parameters | |
---|---|
groupPathObject |
Type:
groupPathObject an object containing a reportPathArray. |
var reportObject = reportsApp.getReport("activity-summary-by-group-report");
reportObject.viewGroup({"path": ["Simpson", "Springfield High"]});
Retrieves the raw JSON data for the specified group path and passes it to a callback.
Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.
Parameters | |||||
---|---|---|---|---|---|
reportPathObject |
Type:
reportPathObject |
||||
callback |
Type:
function function to be called once the data set has been fetched from Learnosity infrastructure.
|
Sets options on the report. Used to modify or update the report's behavior after initialization.
Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.
Parameters | |||||||||
---|---|---|---|---|---|---|---|---|---|
options |
Type:
object Object containing options to configure UI and behaviour. Contains one or more of the below properties.
|
Object Definitions
In the Method section above, there are some object definitions which are complex enough to document separately. These are listed below, and linked from the relevant documentation above.
Properties: | |
---|---|
id |
Type:
string the user id that should be tracked in this report. This is the same user_id used when initializing the Items API. |
name |
Type:
string the user name to be displayed in the UI. |
hash |
Type:
string a sha256 hash of the user_id and consumer secret. |
Properties: | |
---|---|
path |
Type:
reportPathArray |
Properties: | |
---|---|
then |
Type:
function(ItemScoresByTagByUserData) |
catch |
Type:
function() |
Properties: | |
---|---|
item_tags |
Type:
object |
scores |
Type:
object |
{
"item_tags": {
"ch_curriculum_code": {
"ACMGM000": {
"sort_key": 0,
"description": null
},
"ACMGM001": {
"sort_key": 1,
"description": null
}
}
},
"scores": [
{
"user_id": "user_20180417a_00001",
"item_tags": [
{
"type": "ch_proficiency_strand",
"name": "Fluency"
},
{
"type": "ch_topic",
"name": "2. Matrices"
}
],
"score": 2,
"max_score_of_attempted": 4,
"max_score_of_unmarked": 0,
"max_score": 4,
"count": 2
}
]
}
ItemScoresByTagByUserDataitem_tags
objectProperties: | |
---|---|
[tag_type] |
Type:
object |
ItemScoresByTagByUserDataitem_tags[tag_type]
objectProperties: | |
---|---|
[tag_name] |
Type:
TagMetadata |
ItemScoresByTagByUserDatascores
objectProperties: | |
---|---|
user_id |
Type:
string |
item_tags |
Type:
array[TagsV2|] An array of tags describing the path through the hierarchy that this score belongs to. This includes column and row tags. An empty array represents the overall total score for the given user. |
score |
Type:
float Sum of scores that has been calculated for the given user and combination of item tags. |
max_score_of_attempted |
Type:
float For all attempted responses by the given user within the given combination of item tags, this is the sum of the highest scores that can be awarded. |
max_score_of_unmarked |
Type:
float For all unmarked responses by the given user within the given combination of item tags, this is the sum of the highest scores that can be awarded. |
max_score |
Type:
float Sum of the highest scores that can be awarded for the given user and combination of item tags. |
Properties: | |
---|---|
sort_key |
Type:
string |
description |
Type:
string |