# osudsl/pydre architecture

> Architecture diagram of the GitHub repository osudsl/pydre, 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/osudsl/pydre
- Repository: https://github.com/osudsl/pydre

## Overview

Pydre processes tabular driving-simulation study data into filtered, ROI-segmented data and calculated metrics. The main workflow starts at the CLI, which runs a configured project; project orchestration discovers inputs, applies configured processing, and produces analysis results. The repository also documents study-specific filters and metrics, physiological-data integration, and DuckLake connectivity. Edges reflect README statements, excerpted code, and SOURCE INDEX references; some detailed processing and output links are omitted because their implementation was not shown.

Main entry points: [`src/pydre/core.py`](https://github.com/osudsl/pydre/blob/master/src/pydre/core.py) (Drive data model), [`src/pydre/project.py`](https://github.com/osudsl/pydre/blob/master/src/pydre/project.py) (Project processing), [`src/pydre/run.py`](https://github.com/osudsl/pydre/blob/master/src/pydre/run.py) (CLI entry point), [`src/pydre/rois.py`](https://github.com/osudsl/pydre/blob/master/src/pydre/rois.py) (ROI segmentation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Project workflow"]
  node_cli["CLI entry point<br/>[run.py]"]
  node_project["Project processing<br/>[project.py]"]
end

subgraph group_data["Data handling"]
  node_drive_data["Drive data model<br/>[core.py]"]
end

subgraph group_filters["Filtering"]
  node_common_filters["Common filters<br/>[common.py]"]
  node_study_filters["R2D filters<br/>[R2DFilters.py]"]
  node_eye_filters["Eye-tracking filters<br/>[eyetracking.py]"]
  node_gaze_filters["Gaze filters<br/>[gazeangle.py]"]
  node_empatica["Empatica integration<br/>[empatica.py]"]
end

subgraph group_analysis["Analysis and storage"]
  node_roi["ROI segmentation<br/>[rois.py]"]
  node_common_metrics["Common metrics<br/>[common.py]"]
  node_study_metrics["R2D metrics<br/>[R2DMetrics.py]"]
  node_distraction_metrics["Distraction metrics"]
  node_ducklake["DuckLake connector"]
end

node_researcher(("Researcher"))
node_input_files["Study data files"]
node_ducklake_store[("DuckLake database")]
node_results["Analysis results"]

node_researcher -->|"invokes"| node_cli
node_cli -->|"runs project"| node_project
node_project -->|"uses data model"| node_drive_data
node_project -->|"discovers files"| node_input_files
node_project -->|"creates ROI"| node_roi
node_project -->|"uses connector"| node_ducklake
node_common_filters -->|"transforms"| node_drive_data
node_study_filters -->|"transforms"| node_drive_data
node_eye_filters -->|"transforms"| node_drive_data
node_gaze_filters -->|"transforms"| node_drive_data
node_empatica -->|"merges signals"| node_drive_data
node_roi -->|"splits data"| node_drive_data
node_common_metrics -->|"calculates from"| node_drive_data
node_study_metrics -->|"calculates from"| node_drive_data
node_distraction_metrics -->|"calculates from"| node_drive_data
node_ducklake -->|"connects to"| node_ducklake_store
node_project -.->|"produces"| node_results

click node_cli "https://github.com/osudsl/pydre/blob/master/src/pydre/run.py"
click node_project "https://github.com/osudsl/pydre/blob/master/src/pydre/project.py"
click node_drive_data "https://github.com/osudsl/pydre/blob/master/src/pydre/core.py"
click node_common_filters "https://github.com/osudsl/pydre/blob/master/src/pydre/filters/common.py"
click node_study_filters "https://github.com/osudsl/pydre/blob/master/src/pydre/filters/R2DFilters.py"
click node_eye_filters "https://github.com/osudsl/pydre/blob/master/src/pydre/filters/eyetracking.py"
click node_gaze_filters "https://github.com/osudsl/pydre/blob/master/src/pydre/filters/gazeangle.py"
click node_empatica "https://github.com/osudsl/pydre/blob/master/src/pydre/filters/empatica.py"
click node_roi "https://github.com/osudsl/pydre/blob/master/src/pydre/rois.py"
click node_common_metrics "https://github.com/osudsl/pydre/blob/master/src/pydre/metrics/common.py"
click node_study_metrics "https://github.com/osudsl/pydre/blob/master/src/pydre/metrics/R2DMetrics.py"
click node_distraction_metrics "https://github.com/osudsl/pydre/blob/master/src/pydre/metrics/driverdistraction.py"
click node_ducklake "https://github.com/osudsl/pydre/blob/master/src/pydre/ducklake_connector.py"

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_cli,node_project toneBlue
class node_drive_data,node_ducklake_store toneAmber
class node_common_filters,node_study_filters,node_eye_filters,node_gaze_filters,node_empatica toneMint
class node_roi,node_common_metrics,node_study_metrics,node_distraction_metrics,node_ducklake toneRose
class node_researcher,node_input_files,node_results toneIndigo
```

## Components

### Project workflow

- [CLI entry point](https://github.com/osudsl/pydre/blob/master/src/pydre/run.py): `src/pydre/run.py`
- [Project processing](https://github.com/osudsl/pydre/blob/master/src/pydre/project.py): `src/pydre/project.py`

### Data handling

- [Drive data model](https://github.com/osudsl/pydre/blob/master/src/pydre/core.py): `src/pydre/core.py`

### Filtering

- [Common filters](https://github.com/osudsl/pydre/blob/master/src/pydre/filters/common.py): `src/pydre/filters/common.py`
- [R2D filters](https://github.com/osudsl/pydre/blob/master/src/pydre/filters/R2DFilters.py): `src/pydre/filters/R2DFilters.py`
- [Eye-tracking filters](https://github.com/osudsl/pydre/blob/master/src/pydre/filters/eyetracking.py): `src/pydre/filters/eyetracking.py`
- [Gaze filters](https://github.com/osudsl/pydre/blob/master/src/pydre/filters/gazeangle.py): `src/pydre/filters/gazeangle.py`
- [Empatica integration](https://github.com/osudsl/pydre/blob/master/src/pydre/filters/empatica.py): `src/pydre/filters/empatica.py`

### Analysis and storage

- [ROI segmentation](https://github.com/osudsl/pydre/blob/master/src/pydre/rois.py): `src/pydre/rois.py`
- [Common metrics](https://github.com/osudsl/pydre/blob/master/src/pydre/metrics/common.py): `src/pydre/metrics/common.py`
- [R2D metrics](https://github.com/osudsl/pydre/blob/master/src/pydre/metrics/R2DMetrics.py): `src/pydre/metrics/R2DMetrics.py`
- [Distraction metrics](https://github.com/osudsl/pydre/blob/master/src/pydre/metrics/driverdistraction.py): `src/pydre/metrics/driverdistraction.py`
- [DuckLake connector](https://github.com/osudsl/pydre/blob/master/src/pydre/ducklake_connector.py): `src/pydre/ducklake_connector.py`

### Other components

- **Researcher**
- **Study data files**
- **DuckLake database**
- **Analysis results**

## Connections

- Researcher → CLI entry point: invokes (evidence: `src/pydre/run.py`)
- CLI entry point → Project processing: runs project (evidence: `src/pydre/run.py`)
- Project processing → Drive data model: uses data model (evidence: `src/pydre/project.py`)
- Project processing → Study data files: discovers files (evidence: `src/pydre/project.py`)
- Project processing → ROI segmentation: creates ROI (evidence: `src/pydre/project.py`)
- Project processing → DuckLake connector: uses connector (evidence: `src/pydre/project.py`)
- Common filters → Drive data model: transforms (evidence: `src/pydre/filters/common.py`)
- R2D filters → Drive data model: transforms (evidence: `src/pydre/filters/R2DFilters.py`)
- Eye-tracking filters → Drive data model: transforms (evidence: `src/pydre/filters/eyetracking.py`)
- Gaze filters → Drive data model: transforms (evidence: `src/pydre/filters/gazeangle.py`)
- Empatica integration → Drive data model: merges signals (evidence: `src/pydre/filters/empatica.py`)
- ROI segmentation → Drive data model: splits data (evidence: `src/pydre/rois.py`)
- Common metrics → Drive data model: calculates from (evidence: `src/pydre/metrics/common.py`)
- R2D metrics → Drive data model: calculates from (evidence: `src/pydre/metrics/R2DMetrics.py`)
- Distraction metrics → Drive data model: calculates from (evidence: `src/pydre/metrics/driverdistraction.py`)
- DuckLake connector → DuckLake database: connects to (evidence: `src/pydre/ducklake_connector.py`)
- Project processing → Analysis results: produces
