# jeannamatthews-classes/group-project-data-annotation architecture

> Architecture diagram of the GitHub repository jeannamatthews-classes/group-project-data-annotation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jeannamatthews-classes/group-project-data-annotation
- Repository: https://github.com/jeannamatthews-classes/group-project-data-annotation

## Overview

1. This is a desktop annotation/alignment tool built around a PySide6 GUI. The architecture is centered on a single main window that hosts multiple synchronized panes: video playback, waveform graphing, a timeline, and a comments/annotation panel.

2. The entry point is `main.py`, which likely boots the Qt application and creates `main_window.py`. `main_window.py` is the top-level composition layer: it wires together the widgets, menu actions, and shared state.

3. The UI is split into specialized widgets under `widgets/`:
   - `videoWidget.py` handles video playback, scrubber interaction, trimming, and marking annotation spans.
   - `graph_widget.py` renders waveform data and keeps it aligned to the current playback time.
   - `timelineWidget.py` shows the time-based annotation blocks in a compact vertical timeline.
   - `commentsWidget.py` manages the annotation editor/list on the right side.
   - `highlight_slider.py` is a custom slider/scrubber component used for time navigation and highlights.

4. The core architectural pattern is time synchronization. The video player, waveform display, timeline, and annotations are all locked to a shared notion of current time, so moving the scrubber updates all panes together. This shared time coordination appears to be handled by `timeKeeper.py`.

5. Data ingestion is file-based and intentionally separated by modality:
   - video is loaded from `.mp4` or `.mov`
   - waveform data is loaded from `.h5`
   - comments/annotations are imported and saved as `.json`
   The UI’s File menu is the boundary where user-selected files enter the system.

6. Waveform loading is isolated in `util/hdf5_reader.py`, which acts as the data-access layer for HDF5 files. The presence of `tests/hdf5_reader_tests.py` suggests this reader is a distinct and testable boundary, separate from the GUI.

7. Annotation spans are modeled in `util/span_class.py` and managed in `util/span_keeper.py`. These utilities likely represent selected time ranges, trimming regions, and highlighted annotation intervals, and they serve as the shared data model used by both the video and timeline/annotation UI.

8. The application’s main data flow is:
   user loads files -> readers/parsers create in-memory video/waveform/comment data -> the main window distributes that data to widgets -> user interaction updates the shared time/span state -> widgets refresh to reflect the current position and annotations -> comments can be saved back to JSON.

9. Trimming and alignment are important functional boundaries. Both the video and waveform panes support cutting off the beginning of their respective streams so the two modalities can be aligned manually. That makes alignment a first-class part of the UI rather than a hidden preprocessing step.

10. The annotations panel is not just a note editor; it is time-aware. Annotation blocks are tied to video spans, and jumping to a point in time reveals the relevant annotation context. This means annotation state is coupled to playback time and visible across multiple widgets.

11. The repo includes tests for the waveform graph and HDF5 reader, which implies the maintainers considered those lower-level components stable enough to validate independently from the Qt event loop. The GUI itself appears to be mostly integration-driven.

12. For deployment, the app is packaged as a standalone executable with PyInstaller. That matters architecturally because the target runtime is a desktop binary, not a server or browser-based system.

13. A useful diagram for this repo would show three layers: file I/O at the edges, shared time/span state in the middle, and synchronized Qt widgets on top. The central dependency is the shared playback/annotation state, not direct widget-to-widget communication.

Main entry points: [`main_window.py`](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/main_window.py) (Main Window), [`timeKeeper.py`](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/timeKeeper.py) (Time Keeper), [`util/span_keeper.py`](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/util/span_keeper.py) (Span Keeper), [`widgets/videoWidget.py`](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/videoWidget.py) (Video Pane)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_app["App Shell"]
  node_main_py["Main<br/>qt entrypoint<br/>[main.py]"]
end

subgraph group_group_ui["Synchronized UI"]
  node_main_window_py["Main Window<br/>composition shell<br/>[main_window.py]"]
  node_video_widget_py["Video Pane<br/>playback widget<br/>[videoWidget.py]"]
  node_graph_widget_py["Waveform Pane<br/>graph widget<br/>[graph_widget.py]"]
  node_timeline_widget_py["Timeline<br/>time view<br/>[timelineWidget.py]"]
  node_comments_widget_py["Comments<br/>annotation panel<br/>[commentsWidget.py]"]
  node_slider_py["Scrubber<br/>time control"]
end

subgraph group_group_state["Shared State"]
  node_timekeeper_py(("Time Keeper<br/>sync coordinator<br/>[timeKeeper.py]"))
  node_span_class_py["Span Model<br/>time range model<br/>[span_class.py]"]
  node_span_keeper_py(("Span Keeper<br/>span manager<br/>[span_keeper.py]"))
end

subgraph group_group_data["Data I/O"]
  node_hdf5_reader_py[("HDF5 Reader<br/>waveform loader<br/>[hdf5_reader.py]")]
  node_comments_json["Comments JSON<br/>annotation file"]
  node_media_files[("Media Files<br/>video input")]
  node_hdf5_files[("Waveform Data<br/>hdf5 input")]
end

subgraph group_group_tests["Tests"]
  node_graph_tests_py["Graph Test<br/>widget test<br/>[graph_test.py]"]
  node_hdf5_reader_tests_py["Reader Tests"]
end

node_main_py -->|"launches"| node_main_window_py
node_main_window_py -->|"composes"| node_video_widget_py
node_main_window_py -->|"composes"| node_graph_widget_py
node_main_window_py -->|"composes"| node_timeline_widget_py
node_main_window_py -->|"composes"| node_comments_widget_py
node_main_window_py -->|"wires"| node_slider_py
node_main_window_py -->|"shares time"| node_timekeeper_py
node_main_window_py -->|"shares spans"| node_span_keeper_py
node_main_window_py -->|"loads waveform"| node_hdf5_reader_py
node_main_window_py -->|"loads/saves"| node_comments_json
node_main_window_py -->|"loads video"| node_media_files
node_main_window_py -->|"loads waveform"| node_hdf5_files
node_video_widget_py -->|"reads/writes"| node_timekeeper_py
node_video_widget_py -->|"marks spans"| node_span_keeper_py
node_graph_widget_py -->|"syncs to"| node_timekeeper_py
node_timeline_widget_py -->|"syncs to"| node_timekeeper_py
node_comments_widget_py -->|"jumps by time"| node_timekeeper_py
node_comments_widget_py -->|"edits spans"| node_span_keeper_py
node_slider_py -->|"seeks"| node_timekeeper_py
node_hdf5_reader_py -->|"reads"| node_hdf5_files
node_graph_tests_py -.->|"validates"| node_graph_widget_py
node_hdf5_reader_tests_py -.->|"validates"| node_hdf5_reader_py
node_span_keeper_py -->|"stores"| node_span_class_py

click node_main_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/main.py"
click node_main_window_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/main_window.py"
click node_video_widget_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/videoWidget.py"
click node_graph_widget_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/graph_widget.py"
click node_timeline_widget_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/timelineWidget.py"
click node_comments_widget_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/commentsWidget.py"
click node_slider_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/highlight_slider.py"
click node_timekeeper_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/timeKeeper.py"
click node_span_class_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/util/span_class.py"
click node_span_keeper_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/util/span_keeper.py"
click node_hdf5_reader_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/util/hdf5_reader.py"
click node_graph_tests_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/tests/graph_test.py"
click node_hdf5_reader_tests_py "https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/tests/hdf5_reader_tests.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_main_py toneBlue
class node_main_window_py,node_video_widget_py,node_graph_widget_py,node_timeline_widget_py,node_comments_widget_py,node_slider_py toneAmber
class node_timekeeper_py,node_span_class_py,node_span_keeper_py toneMint
class node_hdf5_reader_py,node_comments_json,node_media_files,node_hdf5_files toneRose
class node_graph_tests_py,node_hdf5_reader_tests_py toneIndigo
```

## Components

### App Shell

Qt startup and top-level composition.

- [Main](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/main.py): qt entrypoint · Bootstraps the Qt application and opens the main window. · `main.py`

### Synchronized UI

Main window and coordinated panes.

- [Main Window](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/main_window.py): composition shell · Top-level UI composition and wiring for panes, actions, and shared state. · `main_window.py`
- [Video Pane](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/videoWidget.py): playback widget · Handles video playback, scrubbing, trimming, and annotation span marking. · `widgets/videoWidget.py`
- [Waveform Pane](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/graph_widget.py): graph widget · Renders waveform data and stays aligned to the current playback time. · `widgets/graph_widget.py`
- [Timeline](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/timelineWidget.py): time view · Shows annotation blocks in a compact time-based timeline. · `widgets/timelineWidget.py`
- [Comments](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/commentsWidget.py): annotation panel · Manages the annotation editor and list view for time-aware notes. · `widgets/commentsWidget.py`
- [Scrubber](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/widgets/highlight_slider.py): time control · Custom slider for navigation and highlighted regions. · `widgets/highlight_slider.py`

### Shared State

Time and span coordination across widgets.

- [Time Keeper](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/timeKeeper.py): sync coordinator · Maintains the shared current time used to synchronize all panes. · `timeKeeper.py`
- [Span Model](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/util/span_class.py): time range model · Represents selected or annotated time ranges. · `util/span_class.py`
- [Span Keeper](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/util/span_keeper.py): span manager · Stores and updates annotation and trimming spans shared by the UI. · `util/span_keeper.py`

### Data I/O

File-based readers and annotation persistence.

- [HDF5 Reader](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/util/hdf5_reader.py): waveform loader · Loads waveform data from HDF5 files as a distinct data-access boundary. · `util/hdf5_reader.py`
- **Comments JSON**: annotation file · Imported and saved annotation data in JSON form.
- **Media Files**: video input · Loaded video sources such as MP4 or MOV files.
- **Waveform Data**: hdf5 input · Waveform source files used by the graph and synchronization logic.

### Tests

Focused validation for lower-level boundaries.

- [Graph Test](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/tests/graph_test.py): widget test · Validates waveform graph behavior outside the GUI loop. · `tests/graph_test.py`
- [Reader Tests](https://github.com/jeannamatthews-classes/group-project-data-annotation/blob/main/tests/hdf5_reader_tests.py): reader test · Checks the HDF5 reader as a testable data boundary. · `tests/hdf5_reader_tests.py`

## Connections

- Main → Main Window: launches · Starts the Qt app and creates the main window.
- Main Window → Video Pane: composes · Places the video pane into the shared layout.
- Main Window → Waveform Pane: composes · Places the waveform pane into the shared layout.
- Main Window → Timeline: composes · Places the timeline pane into the shared layout.
- Main Window → Comments: composes · Places the annotation panel into the shared layout.
- Main Window → Scrubber: wires · Connects navigation controls and highlight scrubber behavior.
- Main Window → Time Keeper: shares time · Coordinates playback time across all synchronized widgets.
- Main Window → Span Keeper: shares spans · Distributes and updates annotation and trim spans.
- Main Window → HDF5 Reader: loads waveform · Uses the reader to ingest waveform data into the UI.
- Main Window → Comments JSON: loads/saves · Imports and persists annotation data.
- Main Window → Media Files: loads video · Accepts user-selected media files through the application boundary.
- Main Window → Waveform Data: loads waveform · Accepts waveform sources through the file boundary.
- Video Pane → Time Keeper: reads/writes · Updates shared playback position and reacts to time changes.
- Video Pane → Span Keeper: marks spans · Creates and edits trim or annotation ranges.
- Waveform Pane → Time Keeper: syncs to · Stays aligned to the current playback time.
- Timeline → Time Keeper: syncs to · Moves and highlights blocks based on shared time.
- Comments → Time Keeper: jumps by time · Shows the annotation context for the current position.
- Comments → Span Keeper: edits spans · Binds notes to time ranges and manages annotation intervals.
- Scrubber → Time Keeper: seeks · Scrubbing changes the shared playback time.
- HDF5 Reader → Waveform Data: reads · Loads waveform data from HDF5 files.
- Graph Test → Waveform Pane: validates · Exercises waveform display behavior.
- Reader Tests → HDF5 Reader: validates · Exercises the HDF5 reader boundary.
- Span Keeper → Span Model: stores · Uses span objects as the shared time-range model.
