|
| 1 | +# BrainWaves User Flow |
| 2 | + |
| 3 | +This document describes the user flow through the BrainWaves application — an Electron desktop app for conducting EEG neuroscience experiments. |
| 4 | + |
| 5 | +## Flow Diagram |
| 6 | + |
| 7 | +```mermaid |
| 8 | +flowchart TD |
| 9 | + HOME["🏠 HOME"] |
| 10 | + HOME --> MY_EXP["MY EXPERIMENTS\n(saved workspaces)"] |
| 11 | + HOME --> EXP_BANK["EXPERIMENT BANK\n(built-in cards)"] |
| 12 | + HOME --> EXPLORE["EXPLORE EEG DATA\n(raw streaming)"] |
| 13 | +
|
| 14 | + MY_EXP -->|"Open Experiment"| DESIGN |
| 15 | + EXP_BANK -->|"Pick card → Overview → Start"| DESIGN |
| 16 | +
|
| 17 | + EXPLORE --> CONNECT_MODAL_EXP["ConnectModal\n(find & connect device)"] |
| 18 | + CONNECT_MODAL_EXP --> EEG_EXPLORE["Live EEG Viewer\n(signal quality + waveform)"] |
| 19 | +
|
| 20 | + subgraph DESIGN ["📋 DESIGN /design"] |
| 21 | + direction TB |
| 22 | + D_OV["OVERVIEW\n(title, description)"] |
| 23 | + D_BG["BACKGROUND\n(framing questions, resources)"] |
| 24 | + D_PR["PROTOCOL\n(step-by-step, condition images)"] |
| 25 | + D_PV["PREVIEW\n(live experiment iframe)"] |
| 26 | + D_OV --> D_BG --> D_PR --> D_PV |
| 27 | + EEG_TOGGLE["Enable/Disable EEG toggle"] |
| 28 | + end |
| 29 | +
|
| 30 | + DESIGN -->|"Top nav: Collect"| COLLECT |
| 31 | +
|
| 32 | + subgraph COLLECT ["🎧 COLLECT /collect"] |
| 33 | + direction TB |
| 34 | + PRE_TEST["PRE-TEST\n(signal quality + EEG viewer)"] |
| 35 | + CONNECT_MODAL["ConnectModal\n① power on headset\n② plug in USB receiver\n③ select device → connect"] |
| 36 | + PRE_TEST -->|"EEG enabled & not connected"| CONNECT_MODAL |
| 37 | + CONNECT_MODAL -->|"Connected"| PRE_TEST |
| 38 | + PRE_TEST -->|"Run & Record"| RUN |
| 39 | + RUN["RUN\n(subject ID / group / session)"] |
| 40 | + EXP_WINDOW["ExperimentWindow\n(full-screen lab.js iframe\n+ EEG timing markers)"] |
| 41 | + RUN -->|"Run Experiment"| EXP_WINDOW |
| 42 | + EXP_WINDOW -->|"Experiment complete\n(behavioral CSV saved)"| DONE_COLLECT["Recording saved ✓"] |
| 43 | + end |
| 44 | +
|
| 45 | + DONE_COLLECT -->|"EEG enabled\nTop nav: Clean"| CLEAN |
| 46 | + DONE_COLLECT -->|"Behavior only\nTop nav: Analyze"| ANALYZE |
| 47 | +
|
| 48 | + subgraph CLEAN ["🧹 CLEAN /clean\n(EEG only)"] |
| 49 | + direction TB |
| 50 | + CL_SEL["Select subject\n+ select recording(s)"] |
| 51 | + CL_LOAD["Load Dataset\n(Pyodide → epoch stats)"] |
| 52 | + CL_CLEAN["Clean Data\n(artifact rejection in Pyodide)"] |
| 53 | + CL_SEL --> CL_LOAD --> CL_CLEAN |
| 54 | + end |
| 55 | +
|
| 56 | + CLEAN -->|"Analyze Dataset →"| ANALYZE |
| 57 | +
|
| 58 | + subgraph ANALYZE ["📊 ANALYZE /analyze"] |
| 59 | + direction TB |
| 60 | + AN_OV["OVERVIEW\n(topoplot — scalp map)"] |
| 61 | + AN_ERP["ERP\n(waveform by electrode)"] |
| 62 | + AN_BEH["BEHAVIOR\n(RT / Accuracy charts\nbar · box · scatter)"] |
| 63 | + AN_EXP["Export aggregated data"] |
| 64 | + AN_OV --> AN_ERP |
| 65 | + AN_ERP --> AN_BEH |
| 66 | + AN_BEH --> AN_EXP |
| 67 | + end |
| 68 | +
|
| 69 | + DESIGN -->|"Home button"| HOME |
| 70 | + COLLECT -->|"Home button"| HOME |
| 71 | + CLEAN -->|"Home button"| HOME |
| 72 | + ANALYZE -->|"Home button"| HOME |
| 73 | +
|
| 74 | + style HOME fill:#4A90D9,color:#fff |
| 75 | + style DESIGN fill:#7B68EE,color:#fff |
| 76 | + style COLLECT fill:#E8763A,color:#fff |
| 77 | + style CLEAN fill:#3BAF7A,color:#fff |
| 78 | + style ANALYZE fill:#D95B5B,color:#fff |
| 79 | +``` |
| 80 | + |
| 81 | +## Stage Descriptions |
| 82 | + |
| 83 | +### 1. Home (`/` and `/home`) |
| 84 | + |
| 85 | +Entry point with three tabs: |
| 86 | + |
| 87 | +- **My Experiments** — table of previously saved workspaces; each row has Delete, Go to Folder, and Open Experiment actions. |
| 88 | +- **Experiment Bank** — card grid of four built-in EEG paradigms: Faces/Houses (N170), Stroop Task, Multi-tasking, and Visual Search. Clicking a card opens an Overview panel before starting. |
| 89 | +- **Explore EEG Data** — connects directly to a headset and streams live EEG without running a formal experiment. |
| 90 | + |
| 91 | +### 2. Design (`/design`) |
| 92 | + |
| 93 | +Four review tabs walk the researcher through the experiment before data collection: |
| 94 | + |
| 95 | +| Tab | Content | |
| 96 | +|---|---| |
| 97 | +| **Overview** | Title and experiment description | |
| 98 | +| **Background** | Framing questions and external reading resources | |
| 99 | +| **Protocol** | Step-by-step instructions with condition images | |
| 100 | +| **Preview** | Live experiment iframe (lab.js) | |
| 101 | + |
| 102 | +An **Enable EEG** toggle controls whether the Clean step appears downstream. Custom experiments have additional tabs for configuring conditions, trials, timing parameters, and instructions. |
| 103 | + |
| 104 | +### 3. Collect (`/collect`) |
| 105 | + |
| 106 | +Two sub-views: |
| 107 | + |
| 108 | +- **Pre-Test** — walks the user through `ConnectModal` (power on headset → plug in USB receiver → select device → connect), then shows live signal quality and a real-time EEG waveform. |
| 109 | +- **Run** — collects subject ID, group name, and session number, then launches the experiment in a full-screen iframe. EEG timing markers are injected during the task. On completion, the behavioral CSV is saved automatically. |
| 110 | + |
| 111 | +### 4. Clean (`/clean`) — EEG only |
| 112 | + |
| 113 | +Shown only when EEG is enabled. |
| 114 | + |
| 115 | +1. Select a subject and one or more recordings. |
| 116 | +2. **Load Dataset** — loads epochs into Pyodide (Python-in-browser) and returns epoch statistics. |
| 117 | +3. **Clean Data** — runs artifact rejection via Pyodide. Once the drop percentage reaches a threshold, the *Analyze Dataset* button becomes available. |
| 118 | + |
| 119 | +### 5. Analyze (`/analyze`) |
| 120 | + |
| 121 | +- **EEG mode** — three tabs: topoplot (scalp map overview), ERP waveforms per electrode, and behavioral analysis. |
| 122 | +- **Behavior-only mode** — one tab: interactive bar, box, or scatter plots for response time or accuracy, with an outlier-removal option and an export button. |
0 commit comments