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

[Tidy] Prepare for dynamic filters, part 2 of 2 #857

Merged
merged 23 commits into from
Nov 11, 2024

Conversation

antonymilne
Copy link
Contributor

@antonymilne antonymilne commented Nov 7, 2024

Description

The thrilling sequel to #850 and probably the final part before @petar-qb does the actual implementation of this 🙌

Again I nominate @petar-qb as lead reviewer and @maxschulz-COL and second pair of eyes 🙏

Most changes here are to _action_utils.py, which was ready for a good refactoring.

  • data loading during runtime is much more efficient now. Before if you had 10 graphs on a page all using the same data then we'd load the data 10 times. Now we only load it once. Still need to write some tests for this to make sure it's working as intended, but that's the idea anyway. This is done by _multi_load in data_manager. For some cases this could actually make a big difference to performance when caching is off (as is the default)
  • Filter.pre_build now also uses this _multi_load functionality
  • untangled a few helper functions in action_utils.py. There is a clearer separation of responsibilities between different functions now.
  • the newly introduced TODO NEXT are short-term ones and will go once we've finished implementing dynamic filters

@petar-qb I recommend reviewing as follows:

  • look at commits in order: 13f022e f2bd362 1dbacb0 4d0fb0e (sorry I had very clear commit history until the base branch got merged into main and then I screwed it up 🤦)
  • read through the whole actions_utils.py and filter.py file as it now stands
  • do some manual testing

TODO:

  • Write tests

Screenshot

Notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

    • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
    • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
    • I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.
    • I have not referenced individuals, products or companies in any commits, directly or indirectly.
    • I have not added data or restricted code in any commits, directly or indirectly.

@antonymilne antonymilne changed the title Tidy/dynamic filter 2 [Tidy] Prepare for dynamic filters part 1 Nov 7, 2024
@antonymilne antonymilne changed the title [Tidy] Prepare for dynamic filters part 1 [Tidy] Prepare for dynamic filters part 2 Nov 7, 2024
@antonymilne antonymilne changed the title [Tidy] Prepare for dynamic filters part 2 [Tidy] Prepare for dynamic filters, part 2 of 2 Nov 7, 2024
@antonymilne antonymilne marked this pull request as ready for review November 7, 2024 11:33
Base automatically changed from tidy/dynamic-filter to main November 7, 2024 11:58
# Conflicts:
#	vizro-core/src/vizro/models/_controls/filter.py
Copy link
Contributor

github-actions bot commented Nov 7, 2024

View the example dashboards of the current commit live on PyCafe ☕ 🚀

Updated on: 2024-11-11 12:27:23 UTC
Commit: 25d33e4

Link: vizro-core/examples/dev/

Link: vizro-core/examples/scratch_dev

Link: vizro-core/examples/visual-vocabulary/

Link: vizro-ai/examples/dashboard_ui/

Copy link
Contributor

@petar-qb petar-qb left a comment

Choose a reason for hiding this comment

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

Awesome refactoring and performance optimising. 🥇🥇 (I left just a few minor comments.)

vizro-core/src/vizro/actions/_actions_utils.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/actions/_actions_utils.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@maxschulz-COL maxschulz-COL left a comment

Choose a reason for hiding this comment

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

Skimmed through it, really like it! Thanks a lot!

vizro-core/src/vizro/actions/_actions_utils.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
@antonymilne antonymilne merged commit c442686 into main Nov 11, 2024
36 checks passed
@antonymilne antonymilne deleted the tidy/dynamic-filter-2 branch November 11, 2024 14:17
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