-
Notifications
You must be signed in to change notification settings - Fork 20
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
Adds new waveform viewer #1177
base: dev
Are you sure you want to change the base?
Adds new waveform viewer #1177
Conversation
52dc257
to
b727662
Compare
There is a conflict in the requirements for |
8222059
to
edd5e8e
Compare
This now should be rebased with the current |
edd5e8e
to
f45f86b
Compare
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.
The viewer looks good and it works nicely. The only real issue in terms of usability that I could see is that access/permissions need checking:
- currently, anyone (including anonymous users) can view waveforms for active (pre-publication) projects. Only admin and authors should be able to view at this stage. e.g. http://localhost:8000/waveforms/active_4riWnicqZRycqFZb6FUu/ can be viewed by an anonymous viewer
- are restricted/credentialed access restrictions applied, so that only authorised viewers can access the data?
The code could do with a clean up, especially physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py.
I have added comments inline, but I think the main things are:
- try to follow PEP8 (install a linter if you don't have one!)
- add docstrings
- if adding TODOs, make sure that someone new to the code would understand what needs to be done and why
- there are a fair amount of comments that don't really add to readability, so could be removed.
- breaking down the big functions would make the code much easier to follow!
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
# All the project slug directories live here | ||
PROJECT_PATH = os.path.join(PUBLIC_ROOT, PUBLIC_DBPATH) | ||
# Formatting settings | ||
dropdown_width = '500px' |
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.
It would be good to try avoid all of these global variables. Perhaps they could be dropped into a config/settings function?
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
This looks great! Being able to select the signals you want to view is a nice feature. I had a few thoughts around potential improvements, none of which should be required for an initial release of this waveform viewer:
|
physionet-django/waveforms/dash_apps/finished_apps/waveform_vis.py
Outdated
Show resolved
Hide resolved
Here's some initial thoughts in response @briangow :
Looks like I can edit the file name, but maybe not at the final level, only initially (maybe something like
Hmmmm, might not be worth the effort since the x-axis ticks are set to be every 0.2 seconds and by then the downsampling would make it less than desirable... can you think of an application where I would need signals of that time scale?
This has been something on my to-do list for a while now but I can't seem to figure it out in the Python version only the JS version (this motivated me to seriously start considering a WFDB-JS if I have spare time)... It seems like a package specific issue that a lot of people have been complaining about but I think it's in the "we need more funding to get it done" stage unfortunately... Maybe I should just remove one of them for now so it's not confusing
This functionality was in the big commented blob in the annotation generator in
I see now... It looks like the color is set to
This is a can of worms... How would I make it clean on a graph by graph basis if 8 signals are plotted at once? I think this would also make the manual zoom selection be a 2D rectangle with variable width and height instead of just width... Should I just relax the criteria for outliers or plot the whole signal with outliers and hope for the best? |
…font size; increase signal display range; bolder font color
Just a few follow-up thoughts on some of the points @Lucas-Mc. Again, I don't think any of these should be taken as necessary for the initial release of this waveform viewer.
|
Previously, if multiple requests were submitted back to back, then all of them would have to be completed before the plot would render. This prevented users from easily removing a lot of signals or adding a lot of signals as each inter-selection would have to be processed first. This removes that by asking the user to manually plot the desired waveform once they feel satisfied.
Sometimes, the user selects their signals out of order which causes the resulting graph to be based on the order of their selection. This change returns the graph to its desired behavior which is to display the signals in the order of the check-boxes for consistency.
Just as a reminder, latest discussion around this pull request was asking what kind of load it would place on our servers. Needs some investigation! |
This change adds a new waveform viewer which can be used alongside with LightWAVE. This is built using Plotly and Dash which provides flexible and interactive plotting which can easily be modified with just a few lines of code. It also employs the WFDB-Python package for easy interactions with records in Python which can later be extended for more uses within PhysioNet. My proposed way to access this viewer is through a "Demo" link shown at the top of the LightWAVE home page where input records are chosen (http://localhost:8000/lightwave/demobsn/1.0?db=demobsn/1.0 for example). Also, testing for this viewer can be done after #1176 is implemented though
demobsn
should work also but is minimal.I compiled a list of Pros and Cons for this viewer as compared to LightWAVE for those deciding which viewer to use.
Pros:
wfdbcal
)ANNOTATORS
file (displays warning if noANNOTATORS
file)Previous
andNext
buttonCons:
EDF is still a little sketchy (though almost fixed in WFDB-Python)DONE: Improves EDF speed / fixes bugs wfdb-python#274At the end of the day, I know there's probably some undiscovered errors here (it has been tested on all available databases on PhysioNet which is extensive though not comprehensive) which can be amended later though I think this is a strong start and an improvement for PhysioNet.