End-to-end behavioral data pipeline for SLB fMRI studies.
This pipeline converts raw PsychoPy outputs into structured, analysis-ready datasets with deterministic preprocessing, task-aware quality control, and automated export.
This pipeline implements a fully reproducible behavioral data workflow, starting from raw ZIP ingestion and ending with:
- Clean per-run datasets
- Task-level merged datasets
- Behavioral QC reports
- Synced outputs for downstream fMRI analysis
The pipeline enforces strict separation between:
- Raw data (immutable)
- Preprocessed data (derived)
- QC artifacts
- Exported deliverables
| Stage | Script | Responsibility |
|---|---|---|
| 0 | cookiecutter (template) | Directory templating |
| 1 | extract_and_structure.py | Raw ingestion + structuring |
| 2 | preprocess_individual.py | Cleaning + feature engineering |
| 3 | merge_group_level.py | Dataset aggregation |
| 4 | qc_missed_keys_report.py | Behavioral QC |
| 5 | export_to_box.py | Data delivery |
Each stage:
- Has clearly defined inputs/outputs
- Does exactly one thing
- Can be rerun independently
- Enforces participant directory structure before any data is processed
- Prevents ad-hoc folder creation
- Ensures downstream scripts never guess paths
Generated structure:
data/SLB_XXX/
th/
tm/
ol/
socialRA/
<task>/
raw/
preprocessed/
- Unzips participant data
- Detects task + run
- Populates Cookiecutter structure
Output:
data/SLB_XXX/<task>/raw/<run>/
- Cleans CSVs using task dictionaries
- Preserves all required variables
- Handles missing data safely
Output:
data/SLB_XXX/<task>/preprocessed/*_preprocessed.csv
- Aggregates across participants
- Normalizes metadata
Output:
group_level/*.csv
- Detects missed responses only when expected
- Task-aware logic (no false positives)
Output:
qc/missed_keys_master.csv
qc/missed_keys_report.pdf
- Syncs outputs to Box
Full pipeline:
The entire behavioral pipeline is orchestrated via DVC as a single DAG from raw ZIPs → final export.
dvc reproRun from a specific stage:
dvc repro stage_name
Force full rerun:
dvc repro -f
Manual:
python extract_and_structure.py
python preprocess_individual.py
python merge_group_level.py
python qc_missed_keys_report.py
python export_to_box.py