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

adding charting function for Sankey diagram #95

Merged
merged 9 commits into from
Oct 3, 2023
Merged

adding charting function for Sankey diagram #95

merged 9 commits into from
Oct 3, 2023

Conversation

agaperste
Copy link
Collaborator

Starting to add functions for more charting capabilities, starting with making a Sankey diagram.

Copy link
Collaborator

@bh2smith bh2smith left a comment

Choose a reason for hiding this comment

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

Looks interesting! Left a few suggestions and notes that might help pass CI. It might also be reasonable to simply add these new dependencies to the dev-dependencies so that users can add them if they decide to use this feature (currently pandas is setup like that).

tests/unit/test_viz_sankey.py Show resolved Hide resolved
dune_client/viz/graphs.py Outdated Show resolved Hide resolved
Comment on lines 12 to 14
predefined_colors: dict,
columns: dict,
viz_config: dict,
Copy link
Collaborator

Choose a reason for hiding this comment

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

the test suggests that these could be

Suggested change
predefined_colors: dict,
columns: dict,
viz_config: dict,
predefined_colors: dict[str, str],
columns: dict[str, str],
viz_config: dict[str, int | float],

Although it also kinda looks like columns could be list[str].

Note that earlier python versions might require Union[int, float] (if you decide to go with this suggestion).

"UNI": "rgb(255, 21, 126)",
}

self.columns = {"source": "source", "target": "target", "value": "value"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are the columns mappings of themselves to themselves? Is there an example where they aren't just the same values mapping to themselves or does this even need to be a dict?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking of giving folks the option to name their columns differently, which ultimately has to be mapped to be source, target, value.

Copy link
Collaborator

@bh2smith bh2smith Sep 30, 2023

Choose a reason for hiding this comment

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

Perhaps this fact can be included somewhere in the doc strings. And also here in the test you could use targets like "renamed_column" to make things extra clear.

The test should serve as simple example that demonstrates all the way the function can be used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

got it makes sense, changed!

@agaperste agaperste requested review from bh2smith and removed request for msf and andrewhong5297 September 29, 2023 23:21
@agaperste
Copy link
Collaborator Author

@bh2smith Thanks for giving me all the pointers! When you get a chance, can you help me with this error from black? I ran stuff in local and the formatting is okay, but on GitHub it's still failing
Screen Shot 2023-09-29 at 7 24 14 PM

Copy link
Collaborator

@bh2smith bh2smith left a comment

Choose a reason for hiding this comment

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

I ran make check and black formatter just found and fixed the issues. Have you tried using the Makefile?

I found some type issues as well and took care of them. These two changes are each in their own commit if you want to see what the relevant changes were for each. You should be good to go now.

Unfortunately its not going to be an easy task to add type annotations to these ignored projects so we will have to live with ignore statements for now.

Everything looks alright to me although I have not explicitly tried the functionality. You have my approval, but it might not hurt to get someone a Dune approval as well.

Thanks for your contribution!

tests/unit/test_viz_sankey.py Outdated Show resolved Hide resolved
dune_client/viz/graphs.py Outdated Show resolved Hide resolved
@agaperste
Copy link
Collaborator Author

@bh2smith Yes I ran make check in local but it was strangely not giving me errors
And thank you so much for helping with this PR! 🙏

@agaperste
Copy link
Collaborator Author

@msf When you get a chance, could you take a look at this PR? First time merging into the repo so wanted to be sure :) Thanks in advance! 🙏

@bh2smith
Copy link
Collaborator

bh2smith commented Oct 1, 2023

I'm excited to see this in action. I might even use it!

@msf msf merged commit 84b3e94 into main Oct 3, 2023
3 checks passed
@RichardKeo RichardKeo deleted the add-sankey branch February 19, 2024 09:30
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.

3 participants