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

Update plotly dash overview dashboards (combined old dashboards) #1288

Merged
merged 54 commits into from
Aug 4, 2022

Conversation

joshuayhwu
Copy link
Contributor

@joshuayhwu joshuayhwu commented Jul 22, 2022

Fixes #1197 (Pt2 - Overview combined dashboards)

  • Up to date with dev branch
  • Check if Dashboard is visible is alternative Device
  • All PR Status checks are successful
  • Peer reviewed and approved

Any questions? See the getting started guide

@joshuayhwu joshuayhwu requested a review from nichhk July 22, 2022 15:45
@joshuayhwu joshuayhwu linked an issue Jul 22, 2022 that may be closed by this pull request
6 tasks
@nichhk
Copy link
Member

nichhk commented Jul 22, 2022

Please update the first comment to say "Fixes #1197". GitHub doesn't link the issue if the issue ID is in curly braces.

How does this relate to #1249? I see that both of these PRs are upgrading Dash. Also, is it possible to break this PR up into smaller chunks?

@joshuayhwu
Copy link
Contributor Author

#1249 is about the older plotly dashboards not doing so well locally due to gunicorn / dash interaction issues, thus flask was needed. The newest dashboards no longer have that issue thus the fix that was reverted. I can break the pr down further.

@nichhk
Copy link
Member

nichhk commented Jul 22, 2022

Thanks for clarifying! We can revert the old PR then.

We can break this PR into two PRs:

  1. All the changes minus ncSumComp.py
  2. Add ncSumComp.py.

@joshuayhwu
Copy link
Contributor Author

Thanks for the suggestion. Updated this current PR and the ncSumComp dashboard PR is here

@joshuayhwu joshuayhwu closed this Jul 24, 2022
@joshuayhwu joshuayhwu reopened this Jul 24, 2022
@joshuayhwu joshuayhwu changed the title Update plotly dash summary dashboards Update plotly dash overview combined dashboards (updated old dashboards) Jul 24, 2022
@joshuayhwu joshuayhwu changed the title Update plotly dash overview combined dashboards (updated old dashboards) Update plotly dash overview dashboards (combined old dashboards) Jul 24, 2022
Copy link
Member

@nichhk nichhk left a comment

Choose a reason for hiding this comment

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

Thanks for the work here Josh! I took a first look at your PR. A few high level comments:

  • use snake_case for filenames, and spell things out a little more so the names aren't ambiguous. So this file can be called overview_combined.py
  • That file is a bit difficult to read. I think it would be more readable if we had helper functions for each type of graph or stat that we are collecting.

server/dash/app.py Outdated Show resolved Hide resolved
server/dash/app.py Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
server/dash/dashboards/overviewComb.py Outdated Show resolved Hide resolved
@joshuayhwu
Copy link
Contributor Author

Thanks for the work here Josh! I took a first look at your PR. A few high level comments:

  • use snake_case for filenames, and spell things out a little more so the names aren't ambiguous. So this file can be called overview_combined.py
  • That file is a bit difficult to read. I think it would be more readable if we had helper functions for each type of graph or stat that we are collecting.

Thanks for the review. Updated the filename using snake_case and other comments. Regarding the helper functions, I'm not entirely sure if it will enhance readability as there are many customizations for each graph (and the variety of graphs in our dashboard), so a function won't really reduce the lines of code, e.g. calling go.Figure vs. px.bar. Let me know if there are other ways to help with readability (perhaps more documentation?)

Copy link
Member

@nichhk nichhk left a comment

Choose a reason for hiding this comment

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

Looking good!

I would still suggest to encapsulate code into functions. Readability is not always about reducing line count; sometimes, code is more readable if we actually make it longer.

E.g., I think it would be helpful to encapsulate all the code to get various counts into a single function get_counts_dict that returns a dict, mapping a count string name to the value.

Ditto for the graphs: I think encapsulating the logic to make each graph also makes the code more readable. This helps us know exactly what purpose a line of code is serving (i.e., if it's within a function, then it serves the purpose of that function).

At the moment, the code is difficult to read because the lines are almost all unindented, in a script style. I see that you're trying to break up the code parts by adding comments, e.g., # Day of Week Bar Chart.. But again, I think putting that code into a function is more readable.

server/dash/dashboards/overview_combined.py Outdated Show resolved Hide resolved
server/dash/dashboards/overview_combined.py Show resolved Hide resolved
@nichhk
Copy link
Member

nichhk commented Aug 1, 2022

This is a short blog post talking more about functions and code readability: https://dev.to/glocore/tip-create-functions-to-improve-code-readability-2kme. It makes a great point about hiding implementation details: if a teammate is trying to read this file for the first time, it's overwhelming to understand every single line at once. But if we put more code into functions, then they can treat that function as a black box to more easily get an overall idea of what this file is doing. Let me know if that makes sense!

@joshuayhwu
Copy link
Contributor Author

Thanks for the review and clarifiaction on the code readability. I have added functions for the graphs and a function for the count. Let me know if there's anything else I could do to enhance readabilty.

Copy link
Member

@nichhk nichhk left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for your patience working on this Josh! Just a few small comments. I'm approving it, so feel free to merge after handling the comments.

server/dash/dashboards/overview_combined.py Show resolved Hide resolved
server/dash/dashboards/overview_combined.py Outdated Show resolved Hide resolved
server/dash/dashboards/overview_combined.py Outdated Show resolved Hide resolved
server/dash/dashboards/overview_combined.py Outdated Show resolved Hide resolved
server/dash/dashboards/overview_combined.py Outdated Show resolved Hide resolved
@joshuayhwu
Copy link
Contributor Author

Thanks for the comprehensive review Nich!

@joshuayhwu joshuayhwu merged commit ecf4ce4 into dev Aug 4, 2022
@joshuayhwu joshuayhwu deleted the combDashboards2 branch August 4, 2022 03:09
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.

v2 Reports Dashboard (First Draft)
2 participants