Skip to main content
Analysis scripts let you attach Python code to a quest that runs against collected datasets. Use them to automate quality checks on EEG recordings, compute summary metrics from experiment trials, or process prompt responses — without downloading data manually.

How It Works

Each analysis script has:

Trigger Types

Scripts can be triggered in different ways:
Currently, only manual execution is available in the UI. Automatic triggers (after_experiment, scheduled, etc.) will be enabled in a future update.

Data Flow

When a script executes:
  1. The server queries all datasets for the quest (filtered by the script’s datasetTypes if set)
  2. For each dataset, the actual file content is downloaded from blob storage
  3. Everything is sent to the Python executor as structured input
  4. The executor runs the script and returns output + stdout
  5. Results are saved as an execution record with status, output, errors, and timing

Writing Scripts

Scripts run in a Python 3.11 environment with numpy, pandas, scipy, and json pre-imported. Your code receives several variables automatically:

Available Variables

Dataset Object

Each item in the datasets list is a dictionary:

Returning Results

Set the output variable to return structured results. Anything printed to stdout is also captured.

Example: EEG Quality Check

Example: Experiment Reaction Times

Using the Dashboard

Analysis scripts are managed from the quest detail page, below the dataset sections.

Creating a Script

  1. Open your quest in the dashboard
  2. Scroll to the Analysis Scripts section
  3. Click New Script
  4. Enter a name, select a trigger type, and write your Python code in the Monaco editor
  5. Click Save Script

Running a Script

  1. Find the script in the list
  2. Click Run
  3. The execution status and output appear in the expandable execution history below the script

Viewing Execution History

Click on a script row to expand it and see recent executions with:
  • Status (completed / failed)
  • Execution time
  • Output (stdout + structured output)
  • Error messages and Python tracebacks (if failed)

Filtering by Dataset Type

If your script only needs certain data types, set the Dataset Types field when creating the script. For example, an EEG quality script should filter to brain_recordings only — this avoids loading irrelevant prompt responses or experiment trials. Supported dataset types:
  • brain_recordings — EEG data from Muse or Neurosity
  • experiment_trials — jsPsych experiment results
  • prompt_responses — Answers to recurring prompts
  • onboarding_responses — Onboarding form answers

Billing

Each script execution costs credits, billed as script_run to the quest’s organization. See the Pricing page for current costs.
Credits are deducted before execution. If the script fails, credits are still consumed. Check your script logic in a small test before running on large datasets.

Permissions

To create, edit, or run analysis scripts, you need the data.run_script permission in the quest’s organization. Organization admins have this by default. See Members & Permissions for details.

Limits

API Reference

Analysis scripts are also available via the REST API:

Execute Request Body

All fields are optional. datasetId restricts execution to a single dataset (useful for event-driven triggers). inputValues maps to the script’s configured input variables.

Explore

Experiments

Learn about the experiments that generate data for your scripts.

Billing

Understand how script execution costs are billed.

Viewing Quest Data

Browse the datasets your scripts analyze.

Members & Permissions

Manage who can run analysis scripts.