LUIDA Docs

ProcessAndSaveCollectedData

These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.

ProcessAndSaveCollectedData()StableData Logging
Fires
On State Start · During State · On State Exit · Always-on events

Description

Triggers LUIDA's Data Collector to snapshot the scratchpad into one queued upload row. Displayed in the State-listening Items editor as Save pushed data in collector. The CCK equivalent is the Save pushed data phase on LuidaDataCollectionGimmick.

Parameters

No parameters.

Side effects

  • Sends the signal exp_recordCustomData to the item's own scope ($.sendSignalCompat("this", "exp_recordCustomData")).
  • The LUIDA-DataCollector item listens for this signal. On receipt it runs the data calculator script generated by the Configure data collector windowcalculateData() returning a record object, with CONDITION, PARTICIPANTS, and COLLECTED_DATA available as globals.
  • The returned record is appended to $.state.customData[], the in-instance upload queue. Nothing leaves the Cluster instance until UploadCollectedData() is fired.
  • The same effect is produced by enabling the Save pushed data phase on a LuidaDataCollectionGimmick (the merged data-collection gimmick used for the trigger-driven pattern in Tutorial 1). The legacy LuidaProcessDataAndSaveToCollectionGimmick component is deprecated but still works.

Example

In Tutorial 3 (Stroop), the TimeRecorder × Trial - Start cell snapshots each trial's record on On State Exit, right after writing the timer to the scratchpad:

// On State Exit (Customized Action)
$.state.isInTrial = false;
SendDataToCollector("timer", $.state.timer);
// then the next action in the chain:
ProcessAndSaveCollectedData();

The data calculator script (defined on LUIDA-DataCollector's Script Asset) is invoked for every fire of this signal and returns one record:

return {
  stateLog: COLLECTED_DATA["stateLog"],
  cond: CONDITION || {},
  ans: $.getStateCompat("this", "isRed", "boolean") ? "R" : "B",
  time: COLLECTED_DATA["timer"],
};

In Tutorial 1 (Priming), the bridge checkpoints achieve the same thing through the trigger-driven equivalent (Luida Process Data And Save To Collection Gimmick).

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md