# bigtoothdev/sociodata-prep architecture

> Architecture diagram of the GitHub repository bigtoothdev/sociodata-prep, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bigtoothdev/sociodata-prep
- Repository: https://github.com/bigtoothdev/sociodata-prep

## Overview

sociodata-prep is a Google Apps Script tool for preparing Google Forms survey data in Google Sheets. Users invoke operations from a spreadsheet menu; handlers use the active sheet and supporting configuration sheets to transform, recode, sample, or analyze survey data. The graph includes documented menu actions and sampled helper calls. Several feature modules are named in the source tree but were not excerpted, so their internal behavior and connections are left unspecified.

Main entry points: [`src/main.ts`](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/main.ts) (SD-prep menu), [`src/functions/trfCat.ts`](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/trfCat.ts) (Categorical transform), [`src/functions/trfDich.ts`](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/trfDich.ts) (Dichotomous transform), [`src/utils/context.ts`](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/context.ts) (Sheet context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Spreadsheet entry"]
  node_menu["SD-prep menu<br/>[main.ts]"]
end

subgraph group_transform["Survey transformations"]
  node_categorical["Categorical transform<br/>[trfCat.ts]"]
  node_dichotomous["Dichotomous transform<br/>[trfDich.ts]"]
  node_pivot["Wide-to-long pivot<br/>[pivotWideToLong.ts]"]
  node_createform["Form creation<br/>[createForm.ts]"]
end

subgraph group_recode["Numeric recoding"]
  node_recodewide["Wide recoding<br/>[numRecodeWide.ts]"]
  node_recodelong["Long recoding<br/>[numRecodeLong.ts]"]
end

subgraph group_analysis["Sampling and analysis"]
  node_sample["Random sampling<br/>[sampleRandom.ts]"]
  node_responseid["Response IDs<br/>[rId.ts]"]
  node_dynamics["Response dynamics<br/>[dynamics.ts]"]
  node_dimensions["Dimensions<br/>[dimensions.ts]"]
end

subgraph group_shared["Shared utilities"]
  node_context["Sheet context<br/>[context.ts]"]
  node_selected["Selected columns"]
  node_flagparser["Flag parser<br/>[parseFlagsCell.ts]"]
  node_slotparser["Slot header parser<br/>[parseSlotHeader.ts]"]
  node_constants["Shared constants<br/>[constants.ts]"]
end

node_user(("Spreadsheet user"))
node_sheets[("Google Sheets")]

node_user -->|"opens menu"| node_menu
node_menu -->|"launches"| node_sample
node_menu -->|"launches"| node_responseid
node_menu -->|"launches"| node_dynamics
node_menu -->|"launches"| node_dichotomous
node_menu -->|"launches"| node_categorical
node_menu -->|"launches"| node_pivot
node_menu -->|"launches"| node_dimensions
node_menu -->|"launches"| node_recodewide
node_menu -->|"launches"| node_recodelong
node_categorical -->|"gets context"| node_context
node_dichotomous -->|"gets context"| node_context
node_recodewide -->|"gets context"| node_context
node_recodelong -->|"gets context"| node_context
node_dynamics -->|"gets context"| node_context
node_categorical -->|"gets columns"| node_selected
node_dichotomous -->|"gets columns"| node_selected
node_categorical -->|"parses answers"| node_flagparser
node_dichotomous -->|"parses answers"| node_flagparser
node_recodewide -->|"parses headers"| node_slotparser
node_recodelong -->|"parses headers"| node_slotparser
node_categorical -->|"reads and writes"| node_sheets
node_dichotomous -->|"reads and writes"| node_sheets
node_recodewide -->|"reads and writes"| node_sheets
node_recodelong -->|"reads and writes"| node_sheets
node_dynamics -->|"reads and writes"| node_sheets

click node_menu "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/main.ts"
click node_context "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/context.ts"
click node_selected "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/getSelectedColumns.ts"
click node_flagparser "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/parseFlagsCell.ts"
click node_slotparser "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/parseSlotHeader.ts"
click node_constants "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/constants.ts"
click node_categorical "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/trfCat.ts"
click node_dichotomous "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/trfDich.ts"
click node_pivot "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/pivotWideToLong.ts"
click node_createform "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/createForm.ts"
click node_recodewide "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/numRecodeWide.ts"
click node_recodelong "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/numRecodeLong.ts"
click node_sample "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/sampleRandom.ts"
click node_responseid "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/rId.ts"
click node_dynamics "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/dynamics.ts"
click node_dimensions "https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/dimensions.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_menu,node_user toneBlue
class node_categorical,node_dichotomous,node_pivot,node_createform,node_sheets toneAmber
class node_recodewide,node_recodelong toneMint
class node_sample,node_responseid,node_dynamics,node_dimensions toneRose
class node_context,node_selected,node_flagparser,node_slotparser,node_constants toneIndigo
```

## Components

### Spreadsheet entry

- [SD-prep menu](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/main.ts): `src/main.ts`

### Survey transformations

- [Categorical transform](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/trfCat.ts): `src/functions/trfCat.ts`
- [Dichotomous transform](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/trfDich.ts): `src/functions/trfDich.ts`
- [Wide-to-long pivot](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/pivotWideToLong.ts): `src/functions/pivotWideToLong.ts`
- [Form creation](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/createForm.ts): `src/functions/createForm.ts`

### Numeric recoding

- [Wide recoding](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/numRecodeWide.ts): `src/functions/numRecodeWide.ts`
- [Long recoding](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/numRecodeLong.ts): `src/functions/numRecodeLong.ts`

### Sampling and analysis

- [Random sampling](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/sampleRandom.ts): `src/functions/sampleRandom.ts`
- [Response IDs](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/rId.ts): `src/functions/rId.ts`
- [Response dynamics](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/dynamics.ts): `src/functions/dynamics.ts`
- [Dimensions](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/functions/dimensions.ts): `src/functions/dimensions.ts`

### Shared utilities

- [Sheet context](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/context.ts): `src/utils/context.ts`
- [Selected columns](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/getSelectedColumns.ts): `src/utils/getSelectedColumns.ts`
- [Flag parser](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/parseFlagsCell.ts): `src/utils/parseFlagsCell.ts`
- [Slot header parser](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/parseSlotHeader.ts): `src/utils/parseSlotHeader.ts`
- [Shared constants](https://github.com/bigtoothdev/sociodata-prep/blob/main/src/utils/constants.ts): `src/utils/constants.ts`

### Other components

- **Spreadsheet user**
- **Google Sheets**

## Connections

- Spreadsheet user → SD-prep menu: opens menu (evidence: `src/main.ts`)
- SD-prep menu → Random sampling: launches (evidence: `src/main.ts`)
- SD-prep menu → Response IDs: launches (evidence: `src/main.ts`)
- SD-prep menu → Response dynamics: launches (evidence: `src/main.ts`)
- SD-prep menu → Dichotomous transform: launches (evidence: `src/main.ts`)
- SD-prep menu → Categorical transform: launches (evidence: `src/main.ts`)
- SD-prep menu → Wide-to-long pivot: launches (evidence: `src/main.ts`)
- SD-prep menu → Dimensions: launches (evidence: `src/main.ts`)
- SD-prep menu → Wide recoding: launches (evidence: `src/main.ts`)
- SD-prep menu → Long recoding: launches (evidence: `src/main.ts`)
- Categorical transform → Sheet context: gets context (evidence: `src/functions/trfCat.ts`)
- Dichotomous transform → Sheet context: gets context (evidence: `src/functions/trfDich.ts`)
- Wide recoding → Sheet context: gets context (evidence: `src/functions/numRecodeWide.ts`)
- Long recoding → Sheet context: gets context (evidence: `src/functions/numRecodeLong.ts`)
- Response dynamics → Sheet context: gets context (evidence: `src/functions/dynamics.ts`)
- Categorical transform → Selected columns: gets columns (evidence: `src/functions/trfCat.ts`)
- Dichotomous transform → Selected columns: gets columns (evidence: `src/functions/trfDich.ts`)
- Categorical transform → Flag parser: parses answers (evidence: `src/functions/trfCat.ts`)
- Dichotomous transform → Flag parser: parses answers (evidence: `src/functions/trfDich.ts`)
- Wide recoding → Slot header parser: parses headers (evidence: `src/functions/numRecodeWide.ts`)
- Long recoding → Slot header parser: parses headers (evidence: `src/functions/numRecodeLong.ts`)
- Categorical transform → Google Sheets: reads and writes (evidence: `src/functions/trfCat.ts`)
- Dichotomous transform → Google Sheets: reads and writes (evidence: `src/functions/trfDich.ts`)
- Wide recoding → Google Sheets: reads and writes (evidence: `src/functions/numRecodeWide.ts`)
- Long recoding → Google Sheets: reads and writes (evidence: `src/functions/numRecodeLong.ts`)
- Response dynamics → Google Sheets: reads and writes (evidence: `src/functions/dynamics.ts`)
