Dynamic Questions, Data Tables, and Data Table Scripting

Assessment authors can use Atomic Assessments Dynamic Questions to efficiently create multiple versions of a question. Dynamic Questions are commonly used to provide multiple practice opportunities and help prevent cheating.

Dynamic Questions - Dynamic questions are Atomic Assessment questions that use data table parameters. Parameters can be used in any question type, turning it into a dynamic question. To turn a question into a dynamic question, define the parameter names and values and then insert parameters into the question stem and scoring criteria. 


Data Tables - Data tables are spreadsheet-like tables that define the parameter names and values to be used in questions. You can define data tables in the following ways:


  1. Manually entering them.
  2. Using the Math Question Generator question type.
  3. Creating and running data table scripts.

Dynamic Question Example. Instead of asking a question:


What is 3 + 5 ?


You can use a data table to define parameters A and B and specify multiple possible rows of values for those parameters. 

A, B

3, 5

7, 9

10, 7


Then when you write the question, you use the parameters instead of hardcoding the values. So it becomes:

After you have defined a data table for an item, you can insert parameters from the data table into a question by choosing them from the Data drop down button displayed in the rich content editor. Note that the drop down only appears if a data table is defined for the item.

 


Manually editing data tables. To manually edit a data table for an item: 


  1. Edit the item.
  2. Click the Settings button.
  3. Choose the Data table tab.
  4. Click Edit.
  5. Enter a header row for the table, specifying parameter names and separating them with commas.
  6. Enter rows specifying values for the parameters, separating them with commas.

It can sometimes be easier to generate tables using a spreadsheet program, downloading a CSV of the table, and copying and pasting it into the Data Table user interface.


NOTE: Atomic Assessment data tables do not support including comma characters in values. This is a known limitation inherited from Learnosity that we are working to resolve. If you need to include a comma, you can instead use an HTML comma character ,


Item Data Table Scripts. An item data table script is a script associated with an Atomic Assessment item that can be run to update the data table for the item. Atomic Assessment data table scripts support Javascript format and provide functions to specify the names of the data table columns (setColumns) and to add rows to the table (addRow).


To create and use a data table script for an item:


  1. Edit an Item and go to the Data Table tab.
  2. Click the Add Script below the Data Table.
  3. Enter a script that specifies the columns and rows for the data table.
  4. Run the script and preview the result using the Preview tab.
  5. After the script runs successfully, click the Copy button to copy the results to the Data Table.
  6. Save the script.
  7. Apply the Data Table changes.


Data Table Script API. Data table scripts can use most Javascript functions. In addition, Atomic Assessments defines functions that you need to use to specify the column names and the row values for a data table:


setColumns(column_names) - Specifies the names of the data table columns.

  • column_names must be an array of strings specifying the names of the data table columns.

addRow(row_cell_values) - Adds a row to the data table.

  • row_cell_values must be an array of values for the row being added. It must have the same number of elements as the array passed to setColumns.

In addition, it defines two functions for generating random values.


getRandom() - Generates a random number between 0 and 1.


seed(seed_value) - Specifies the seed for the random number generator. If you do not call this function or call it with different values, each time you run your script, the randomly generated values will be different. It is important to use the same seed each time so that your table values will remain the same. It is important to not change your data table values between the time when students take an assessment and when you score or rescore it.

  • seed_value value to seed the random number generator with. It must be a number. 


Simple script example. A simple example that adds two rows is:


setColumns(["slope","intercept"]);

addRow([3,5]);

addRow([7,-2]);


When you run this script, it will generate a data table with two columns, named slope and intercept and two rows with values 3,5 and 7,-2.


Random generation example script. More commonly, you will use loops to generate multiple rows by randomly generating numbers or selecting from lists. For example:


function round(value, decimal_places){

  return value.toFixed(decimal_places);

}


function randomValue(min, max, decimal_places){

  return round(min + getRandom()*(max-min), decimal_places);

}


function randomItem(list){

  var selection = randomValue(0, list.length-1, 0);

  return list[selection];

}


function randomColor(){

  return randomItem(["red","green","blue"]);

}


function randomSlope(){

  return randomValue (-3, 5, 1);

}


function randomIntercept(){

  return randomValue (-10, 9, 0);

}


setColumns(["color","slope","intercept"]);


seed(55);

const rows = 10;

for(i=0; i<rows; i++){

  addRow([randomColor(), randomSlope(), randomIntercept()]);

}


Running this table will generate a table with three columns named color, slope, and intercept and 10 rows, with randomly generated values.


Course Level Scripts. In order to avoid repeating and maintaining the same code in multiple item scripts, you can write code at the course level that will be prepended to your item scripts before they are run. This can be a good place to put helper functions. In order to use course level scripts, you must:


  1. Ask your Atomic Jolt Customer Support Manager to enable course level scripting.
  2. Navigate to the Atomic Assessments Content Manager in your course.
  3. Bulk Update Item Scripts from the three dot menu at the top right.
  4. Enter your Course Level Data Table Script in the editor.
  5. Click Save.



You can also bulk test and run all item scripts in a course from this screen.