-
Notifications
You must be signed in to change notification settings - Fork 11
labeling node backend #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
deee6af
add migration for time_labels table
itang06 d6274c1
added model structs for time labels and EEG data queries
itang06 6ebf112
added DB functions for inserting time labels and querying EEG data by…
itang06 e3daa86
added API handlers and routes for time labels and EEG data endpoints
itang06 633894c
added export
AgastyaRai b831799
cherry picked eeg session_id migration and added filtering by session…
itang06 6a5ea88
used compile time query_as! in get_eeg_data_by_range
itang06 9b0b7bf
cleaned up shared_logic::db imports in main.rs
itang06 6f3033b
added get_time_labels_by_range db function
itang06 5cca58a
added get endpoint for time labels by range and registered route
itang06 8659f7a
fixed timelabel import
itang06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| -- add time_labels table to store event labels attached to EEG timestamps during sessions | ||
|
|
||
| CREATE TABLE IF NOT EXISTS time_labels ( | ||
| id SERIAL PRIMARY KEY, | ||
| session_id INTEGER NOT NULL | ||
| REFERENCES sessions(id) ON DELETE CASCADE, | ||
| timestamp TIMESTAMPTZ NOT NULL, -- timestamp of the EEG data with timezone info | ||
| label TEXT NOT NULL -- label for the EEG data | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| -- note that this assumes that eeg_data has no rows (since as of this migration there should be no real data yet) | ||
| -- to do so just run TRUNCATE TABLE eeg_data before applying this migration | ||
| ALTER TABLE eeg_data | ||
| ADD COLUMN session_id INTEGER NOT NULL, | ||
| ADD CONSTRAINT fk_session FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE; | ||
|
|
||
| -- we can create an index on session_id and time, since the bulk of our queries will be filtering based on these | ||
| CREATE INDEX eeg_data_session_time_idx ON eeg_data (session_id, time DESC); -- using DESC since i'm expecting recent data to be more relevant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add a Get for the time-label as well, and similar to the
get_eeg_data, allow the frontend to pass in a range