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 1 of 2 #850

Merged
merged 14 commits into from
Nov 7, 2024

Conversation

antonymilne
Copy link
Contributor

@antonymilne antonymilne commented Nov 4, 2024

Description

Refactor filter.py to prepare for dynamic filters. This solves several long-standing TODOs in this file.

  • data loading has been isolated to a single place rather than repeated. This improves performance during pre_build (useful but not critical) and when updating filters during dashboard runtime (not yet implemented, but performance here is critical)
  • _set methods all rewritten and simplified (no more loops needed)
  • isolated methods that will be required during runtime - these are now called in __call__ (not yet used anywhere but will be soon)
  • validation is slightly improved to handle some cases we didn't handle before - see the new tests to understand what these are
  • the newly introduced TODOs will be short-term ones and will go once we've finished implementing dynamic filters

@petar-qb I recommend reviewing as follows:

  • look at commits 9449c73 and b37f38f
  • read through the whole filter.py file as it now stands
  • do some manual testing

Still 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.

Copy link
Contributor

github-actions bot commented Nov 4, 2024

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

Updated on: 2024-11-07 11:55:22 UTC
Commit: 69cc36d

Link: vizro-core/examples/dev/

Link: vizro-core/examples/scratch_dev

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

Link: vizro-ai/examples/dashboard_ui/

@antonymilne antonymilne marked this pull request as ready for review November 5, 2024 10:23
@maxschulz-COL
Copy link
Contributor

Do you guys want any further reviews?

@antonymilne
Copy link
Contributor Author

Do you guys want any further reviews?

Let's say @petar-qb is the lead reviewer but a quick second pair of eyes would be good thank you!

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.

This is the ground breaking refactoring that will and optimise and facilitate the implementation of the dynamic filters!!

The targeted_data format is just the master piece 🎨

I left a few minor comments, but other than that, all good! (tests are also okay, so no comments for that part)

vizro-core/hatch.toml 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.

As promised, glanced over it and it looks good to me

vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
@antonymilne antonymilne changed the title [Tidy] Prepare for dynamic filters [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 1 of 2 Nov 7, 2024
@antonymilne antonymilne changed the title [Tidy] Prepare for dynamic filters part 1 of 2 [Tidy] Prepare for dynamic filters, part 1 of 2 Nov 7, 2024
@antonymilne antonymilne enabled auto-merge (squash) November 7, 2024 11:54
@antonymilne antonymilne merged commit ae68bd6 into main Nov 7, 2024
36 checks passed
@antonymilne antonymilne deleted the tidy/dynamic-filter branch November 7, 2024 11:58
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