Skip to content
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

Add graph components for plotting pipeline completion status counts of dataset #27

Merged
merged 8 commits into from
Apr 17, 2023

Conversation

alyssadai
Copy link
Collaborator

@alyssadai alyssadai commented Apr 7, 2023

The main changes are:

  • Implemented graph components to display
    1. counts of participants with each pipeline_complete status, per session (only updates if new dataset (bagel.csv) is loaded)
    2. counts of records (i.e., unique participant-session combos) aggregated by pipeline_complete status for sessions selected using dropdown filters (by default, shows all)
  • Implemented component for a legend explaining possible pipeline_complete statuses
  • Switched to a dash-bootstrap-components stylesheet for app to make use of offered layout components

Closes #17
Closes #26

…rouped by pipeline

- Plotting utils refactored into separate module
- Created constant for returning an empty `figure` property
- Added dbc GRID stylesheet to organize graphs
- primary stylesheet for app changed to dbc theme to use card and layout components
@alyssadai alyssadai marked this pull request as ready for review April 8, 2023 05:10
@surchs surchs self-requested a review April 11, 2023 20:46
Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @alyssadai. Nice changes! All seems to be working correctly. I think you should take another look at the exception handling in utility.py and how you handle parsing the .csv.

Other than that, I left some suggestions for structuring the code / refactoring things. Take a look and see if you agree.

proc_dash/plotting.py Show resolved Hide resolved
proc_dash/plotting.py Show resolved Hide resolved
proc_dash/utility.py Outdated Show resolved Hide resolved
proc_dash/utility.py Show resolved Hide resolved
proc_dash/app.py Outdated Show resolved Hide resolved
proc_dash/app.py Show resolved Hide resolved
proc_dash/app.py Outdated
data, total_subjects, sessions, upload_error = util.parse_csv_contents(
contents=contents, filename=filename
)
if upload_error is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't comment on the section in utility.py now (or easily) because it wasn't edited in this PR, but I don't think this is a good way of handling errors here. 1) You're handling exceptions with try-except deep inside the codebase - in effect treating them like flow control. That's not a great idea. If something requires an exception to be raised, then just raise it. If a very specific exception should be caught, you can still catch it here with a try-except. But you shouldn't use a catch-all because you will catch even unintended exceptions that you may not be yet aware of. 2) Your specific errors here are user errors - or at least they contain relevant information for the user. Your users won't read the traceback or terminal logs. So you should probably handle an error visually via the UI. https://dash-bootstrap-components.opensource.faculty.ai/docs/components/toast/ is a nice UI element you could have pop up somewhere to alert the user of something that went wrong but was caught.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the very helpful feedback @surchs ! I've done some refactoring as suggested, but am leaving the migration from error message displaying via a text component to via a dedicated alert element (i.e., a toast) to a separate issue (#30) .

proc_dash/app.py Outdated Show resolved Hide resolved
@alyssadai
Copy link
Collaborator Author

alyssadai commented Apr 14, 2023

Thanks again for the very thorough comments @surchs ! Your suggestions were well taken.

One thing I have left unchanged in app.py from our refactoring discussions is the reset_selections() (previously named reset_table()) function, which you'll notice is still triggered by data upload events separate from the new process_bagel() function I have added. I think it still makes sense to keep these two functions separate as they (necessarily) update different components, and specifically reset_selections() updates certain components regardless of whether the selected input file has problems (that is, it doesn't care about file contents). So if I were to merge it with process_bagel() which has several conditionals in it, I would need to add some repetition of returned elements. At the same time, with this current functionality separation, any errors in input file contents processing should never break anything in reset_selections().

Let me know if you have strong feelings against this :)

@alyssadai alyssadai requested a review from surchs April 14, 2023 21:25
Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @alyssadai! 🧑‍🍳

@alyssadai alyssadai merged commit 89cd6de into main Apr 17, 2023
@alyssadai alyssadai deleted the feat-17/add-pipe-status-graph branch April 17, 2023 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add legend for pipeline status Add component for pipeline completion bar plot
2 participants