Show:

Exp-frame-select Class

These docs have moved here.

Frame that allows you to specify a list of possible frames to show, plus an index or list of indices of which ones to actually show. The frame(s) will be inserted into the sequence of frames for this study on the fly, so that you can use a custom generateProperties function to select which frame(s) to show.

This frame serves as a wrapper for the randomizer select, which is evaluated during experiment parsing and cannot be modified on the fly.

For more information about making study behavior conditional on data collected, see the Lookit docs.

Example usage:

       "study-procedure": {
           "kind": "exp-frame-select",
           "frameOptions": [
               {
                   "kind": "exp-lookit-text",
                   "blocks": [
                       {
                           "emph": true,
                           "text": "Cats are great"
                       },
                       {
                           "text": "We are measuring how much your child loves cats now. Beep boop!"
                       }
                   ]
               },
               {
                   "kind": "exp-lookit-text",
                   "blocks": [{
                           "emph": true,
                           "text": "Your child is not eligible for this study"
                       },
                       {
                           "text": "Either you do not have any cats or your child does not love cats."
                       }
                   ]
               }
           ],
           "generateProperties": "function(expData, sequence, child, pastSessions) {var formData = expData['0-eligibility-survey'].formData; if (formData.nCats >= 1 && formData.loveCats == 'yes') { console.log('eligible'); return { 'whichFrames': 0, 'ELIGIBLE': true } } else { console.log('ineligible'); return { 'whichFrames': 1,  'ELIGIBLE': false } } }"
       }

Warning: to avoid unpredictable behavior, this frame does not itself use any selectNextFrame passed to it. (Frames within the frameOptions list are welcome to make use of selectNextFrame, though!)

Data will be stored for this frame so that any generatedProperties are available for future use; however, it will proceed immediately upon loading to the first frame that is specified (or the next frame in the original sequence, if it turns out that whichFrames is an empty list).

In expData, the frame keys for all frames generated by this frame will be prefixed by this frame's ID, with an index within whichFrames appended to the end of the ID. For instance, if this frame's ID is 1-study-procedure, and it generates three frames, we would have keys 1-study-procedure, 1-study-procedure-0, 1-study-procedure-1, and 1-study-procedure-2.

Methods

destroySessionRecorder

()
Destroy recorder and stop accessing webcam

exitFullscreen

()
Exit fullscreen mode

makeTimeEvent

(
  • eventName
  • [extra]
)
Object

Create the time event payload for a particular frame / event. This can be overridden to add fields to every event sent by a particular frame

Parameters:

  • eventName String
  • [extra] Object optional

    An object with additional properties to be sent to the server

Returns:

Object:

Event type, time, and any additional metadata provided

onSessionRecordingStarted

()
Function called when session recording is started automatically. Override to do frame-specific actions at this point (e.g., beginning a test trial).

serializeContent

(
  • eventTimings
)
Object

Each frame that extends ExpFrameBase will send at least an array eventTimings, a frame type, and any generateProperties back to the server upon completion. Individual frames may define additional properties that are sent.

Parameters:

Returns:

setupRecorder

(
  • element
)
Promise
Set up a video recorder instance

Parameters:

  • element Node
    A DOM node representing where to mount the recorder

Returns:

Promise: A promise representing the result of installing the recorder

showFullscreen

()
Make a specified element fullscreen

startSessionRecorder

()
Start recording

Returns:

Promise Resolves when recording has started

stopSessionRecorder

()
Stop recording

Returns:

Promise Resolves when recording has been uploaded or timed out

whenPossibleToRecordSessionObserver

()
Observer that starts recording once session recorder is ready.

Properties

commonFrameProperties

Object

Specific to this element. Defined in app/components/exp-frame-select/component.js:111

Object describing common parameters to use in EVERY frame created by this randomizer. Parameter names and values are as described in the documentation for the frameType used.

displayFullscreen

Boolean private

Inherited from Full-screen (click for formatted description): app/mixins/full-screen.js:27

Whether to display this frame fullscreen

Default: false

displayFullscreenOverride

String

Inherited from Full-screen (click for formatted description): app/mixins/full-screen.js:165

Set to true to display this frame in fullscreen mode, even if the frame type is not always displayed fullscreen. (For instance, you might use this to keep a survey between test trials in fullscreen mode.)

Default: false

endSessionRecording

Number

Inherited from Session-record (click for formatted description): app/mixins/session-record.js:98

Whether to end any session (multi-frame) recording at the end of this frame.

Default: false

frameOptions

Object[]

Specific to this element. Defined in app/components/exp-frame-select/component.js:89

List of frames that can be created by this randomizer. Each frame is an object with any necessary frame-specific properties specified. The 'kind' of frame can be specified either here (per frame) or in commonFrameProperties. If a property is defined for a given frame both in this frame list and in commonFrameProperties, the value in the frame list will take precedence.

(E.g., you could include 'kind': 'normal-frame' in commmonFrameProperties, but for a single frame in frameOptions, include 'kind': 'special-frame'.)

fsButtonID

String private

Inherited from Full-screen (click for formatted description): app/mixins/full-screen.js:35

The element ID of a button to show if the user leaves fullscreen mode

fullScreenElementId

String private

Inherited from Full-screen (click for formatted description): app/mixins/full-screen.js:20

The element ID of the thing to make full screen (video element, div, etc)

generateProperties

String

Inherited from Exp-frame-base (click for formatted description): app/components/exp-frame-base/component.js:78

Function to generate additional properties for this frame (like {"kind": "exp-lookit-text"}) at the time the frame is initialized. Allows behavior of study to depend on what has happened so far (e.g., answers on a form or to previous test trials). Must be a valid Javascript function, returning an object, provided as a string.

Arguments that will be provided are: expData, sequence, child, pastSessions, conditions.

expData, sequence, and conditions are the same data as would be found in the session data shown on the Lookit experimenter interface under 'Individual Responses', except that they will only contain information up to this point in the study.

expData is an object consisting of frameId: frameData pairs; the data associated with a particular frame depends on the frame kind.

sequence is an ordered list of frameIds, corresponding to the keys in expData.

conditions is an object representing the data stored by any randomizer frames; keys are frameIds for randomizer frames and data stored depends on the randomizer used.

child is an object that has the following properties - use child.get(propertyName) to access:

  • additionalInformation: String; additional information field from child form
  • ageAtBirth: String; child's gestational age at birth in weeks. Possible values are "24" through "39", "na" (not sure or prefer not to answer), "<24" (under 24 weeks), and "40>" (40 or more weeks).
  • birthday: Date object
  • gender: "f" (female), "m" (male), "o" (other), or "na" (prefer not to answer)
  • givenName: String, child's given name/nickname
  • id: String, child UUID
  • languageList: String, space-separated list of languages child is exposed to (2-letter codes)
  • conditionList: String, space-separated list of conditions/characteristics
  • of child from registration form, as used in criteria expression, e.g. "autism_spectrum_disorder deaf multiple_birth"

pastSessions is a list of previous response objects for this child and this study, ordered starting from most recent (at index 0 is this session!). Each has properties (access as pastSessions[i].get(propertyName)):

  • completed: Boolean, whether they submitted an exit survey
  • completedConsentFrame: Boolean, whether they got through at least a consent frame
  • conditions: Object representing any conditions assigned by randomizer frames
  • createdOn: Date object
  • expData: Object consisting of frameId: frameData pairs
  • globalEventTimings: list of any events stored outside of individual frames - currently just used for attempts to leave the study early
  • sequence: ordered list of frameIds, corresponding to keys in expData
  • isPreview: Boolean, whether this is from a preview session (possible in the event this is an experimenter's account)

Example:

function(expData, sequence, child, pastSessions, conditions) {
    return {
       'blocks':
            [
                {
                    'text': 'Name: ' + child.get('givenName')
                },
                {
                    'text': 'Frame number: ' + sequence.length
                },
                {
                    'text': 'N past sessions: ' + pastSessions.length
                }
            ]
      };
  }

(This example is split across lines for readability; when added to JSON it would need to be on one line.)

Default: null

parameters

Object[]

Inherited from Exp-frame-base (click for formatted description): app/components/exp-frame-base/component.js:232

An object containing values for any parameters (variables) to use in this frame. Any property VALUES in this frame that match any of the property NAMES in parameters will be replaced by the corresponding parameter value. For example, suppose your frame is:

{
   'kind': 'FRAME_KIND',
   'parameters': {
       'FRAME_KIND': 'exp-lookit-text'
   }
}

Then the frame kind will be exp-lookit-text. This may be useful if you need to repeat values for different frame properties, especially if your frame is actually a randomizer or group. You may use parameters nested within objects (at any depth) or within lists.

You can also use selectors to randomly sample from or permute a list defined in parameters. Suppose STIMLIST is defined in parameters, e.g. a list of potential stimuli. Rather than just using STIMLIST as a value in your frames, you can also:

  • Select the Nth element (0-indexed) of the value of STIMLIST: (Will cause error if N >= THELIST.length)
   'parameterName': 'STIMLIST#N'
  • Select (uniformly) a random element of the value of STIMLIST:
   'parameterName': 'STIMLIST#RAND'
  • Set parameterName to a random permutation of the value of STIMLIST:
   'parameterName': 'STIMLIST#PERM'
  • Select the next element in a random permutation of the value of STIMLIST, which is used across all substitutions in this randomizer. This allows you, for instance, to provide a list of possible images in your parameterSet, and use a different one each frame with the subset/order randomized per participant. If more STIMLIST#UNIQ parameters than elements of STIMLIST are used, we loop back around to the start of the permutation generated for this randomizer.
   'parameterName': 'STIMLIST#UNIQ'

Default: {}

selectNextFrame

String

Inherited from Exp-frame-base (click for formatted description): app/components/exp-frame-base/component.js:169

Function to select which frame index to go to when using the 'next' action on this frame. Allows flexible looping / short-circuiting based on what has happened so far in the study (e.g., once the child answers N questions correctly, move on to next segment). Must be a valid Javascript function, returning a number from 0 through frames.length - 1, provided as a string.

Arguments that will be provided are: frames, frameIndex, expData, sequence, child, pastSessions

frames is an ordered list of frame configurations for this study; each element is an object corresponding directly to a frame you defined in the JSON document for this study (but with any randomizer frames resolved into the particular frames that will be used this time).

frameIndex is the index in frames of the current frame

expData is an object consisting of frameId: frameData pairs; the data associated with a particular frame depends on the frame kind.

sequence is an ordered list of frameIds, corresponding to the keys in expData.

child is an object that has the following properties - use child.get(propertyName) to access:

  • additionalInformation: String; additional information field from child form
  • ageAtBirth: String; child's gestational age at birth in weeks. Possible values are "24" through "39", "na" (not sure or prefer not to answer), "<24" (under 24 weeks), and "40>" (40 or more weeks).
  • birthday: timestamp in format "Mon Apr 10 2017 20:00:00 GMT-0400 (Eastern Daylight Time)"
  • gender: "f" (female), "m" (male), "o" (other), or "na" (prefer not to answer)
  • givenName: String, child's given name/nickname
  • id: String, child UUID

pastSessions is a list of previous response objects for this child and this study, ordered starting from most recent (at index 0 is this session!). Each has properties (access as pastSessions[i].get(propertyName)):

  • completed: Boolean, whether they submitted an exit survey
  • completedConsentFrame: Boolean, whether they got through at least a consent frame
  • conditions: Object representing any conditions assigned by randomizer frames
  • createdOn: timestamp in format "Thu Apr 18 2019 12:33:26 GMT-0400 (Eastern Daylight Time)"
  • expData: Object consisting of frameId: frameData pairs
  • globalEventTimings: list of any events stored outside of individual frames - currently just used for attempts to leave the study early
  • sequence: ordered list of frameIds, corresponding to keys in expData

Example that just sends us to the last frame of the study no matter what: `"function(frames, frameIndex, frameData, expData, sequence, child, pastSessions) {return frames.length - 1;}"``

Default: null

sessionAudioOnly

Number

Inherited from Session-record (click for formatted description): app/mixins/session-record.js:108

Whether to do audio-only (vs also video) recording for session (multiframe) recording. Only used if starting session recording this frame.

Default: 0

sessionMaxUploadSeconds

Number

Inherited from Session-record (click for formatted description): app/mixins/session-record.js:89

Maximum time allowed for whole-session video upload before proceeding, in seconds. Can be overridden by researcher, based on tradeoff between making families wait and losing data.

Default: 10

startSessionRecording

Number

Inherited from Session-record (click for formatted description): app/mixins/session-record.js:82

Whether to start a session (multi-frame) recording as soon as possible upon loading this frame. This allows you to conduct video recording across multiple frames, simply specifying which frame to start and end on. Individual frames may also provide frame-specific recording capabilities; it is best NOT to conduct both a multiframe 'session' recording and frame-specific recording simultaneously as multiple video streams will eat up bandwidth. If you decide to use session recording, turn off recording for any frames that would otherwise record. There can be multiple session recordings in an experiment, e.g. from frames 1-3 and 5-10.

Default: false

whichFrames

Number

Specific to this element. Defined in app/components/exp-frame-select/component.js:124

Index or indices (0-indexed) within frameOptions to actually use. This can be either a number (e.g., 0 or 1 to use the first or second option respectively) or an array providing an ordered list of indices to use (e.g., [0, 1] or [1, 0] to use the first then second or second then first options, respectively). All indices must be integers in [0, frameOptions.length).

If not provided or -1, the entire frameOptions list is used in order. (If empty list is provided, however, that is respected and no frames are inserted by this randomizer.)

Data keys collected

These are the fields that will be captured by this frame and sent back to the Lookit server. Each of these fields will correspond to one row of the CSV frame data for a given response - the row will have key set to the data key name, and value set to the value for this response. Equivalently, this data will be available in the exp_data field of the response JSON data.

eventTimings

Ordered list of events captured during this frame (oldest to newest). Each event is represented as an object with at least the properties {'eventType': EVENTNAME, 'timestamp': TIMESTAMP}. See Events tab for details of events that might be captured.

frameDuration

Duration between frame being inserted and call to next

frameType

Type of frame: EXIT (exit survey), CONSENT (consent or assent frame), or DEFAULT (anything else)

generatedProperties

Any properties generated via a custom generateProperties function provided to this frame (e.g., a score you computed to decide on feedback). In general will be null.

Events

enteredFullscreen

Upon detecting change to fullscreen mode

hasCamAccess

When recorder detects a change in camera access

Event Payload:

leftFullscreen

Upon detecting change out of fullscreen mode

nextFrame

Move to next frame

previousFrame

Move to previous frame

sessionRecorderReady

When session video recorder has been installed

startSessionRecording

When session video recorder has begun recording

stoppingCapture

Just before stopping webcam video capture

stopSessionRecording

When session video recorder is stopped (upload may continue afterwards)

videoStreamConnection

When recorder detects a change in video stream connection status

Event Payload:

  • status String
    status of video stream connection, e.g. 'NetConnection.Connect.Success' if successful