How jeannamatthews-classes/group-project-data-annotation works
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 Main Window · timeKeeper.py Time Keeper · span_keeper.py Span Keeper · videoWidget.py Video Pane
Components 16
App Shell
Qt startup and top-level composition.
- Main · Bootstraps the Qt application and opens the main window.
main.py
Synchronized UI
Main window and coordinated panes.
- Main Window · Top-level UI composition and wiring for panes, actions, and shared state.
main_window.py - Video Pane · Handles video playback, scrubbing, trimming, and annotation span marking.
widgets/videoWidget.py - Waveform Pane · Renders waveform data and stays aligned to the current playback time.
widgets/graph_widget.py - Timeline · Shows annotation blocks in a compact time-based timeline.
widgets/timelineWidget.py - Comments · Manages the annotation editor and list view for time-aware notes.
widgets/commentsWidget.py - Scrubber · Custom slider for navigation and highlighted regions.
widgets/highlight_slider.py
Shared State
Time and span coordination across widgets.
- Time Keeper · Maintains the shared current time used to synchronize all panes.
timeKeeper.py - Span Model · Represents selected or annotated time ranges.
util/span_class.py - Span Keeper · 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 · Loads waveform data from HDF5 files as a distinct data-access boundary.
util/hdf5_reader.py - Comments JSON · Imported and saved annotation data in JSON form.
- Media Files · Loaded video sources such as MP4 or MOV files.
- Waveform Data · Waveform source files used by the graph and synchronization logic.
Tests
Focused validation for lower-level boundaries.
- Graph Test · Validates waveform graph behavior outside the GUI loop.
tests/graph_test.py - Reader Tests · Checks the HDF5 reader as a testable data boundary.
tests/hdf5_reader_tests.py
Connections 23
- 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.