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

Lightning UI #3807

Merged
merged 79 commits into from
Nov 20, 2023
Merged

Lightning UI #3807

merged 79 commits into from
Nov 20, 2023

Conversation

benjaminpkane
Copy link
Contributor

@benjaminpkane benjaminpkane commented Nov 15, 2023

Introduces new FIFTYONE_APP_LIGHTNING_THRESHOLD option that is None by default. It accepts a positive integer value. When a dataset's sample count exceeds that value and there is no view present, lightning mode is enabled in the App.

In lightning mode, only indexed fields are filterable until the filtered count falls below the lightning threshold

Indexed filters filter have the following constraints

  • counts do not display for string and boolean fields
  • numeric fields are not displayed when nonfinite values are present
  • id fields do not provide search results

These constraints enable fast queries (IXSCAN and DISTINCT) via #3667

After filtering yields a sample count below the threshold, all other filters are accessible either through see more (for label fields with indexed subfields, or the top-level caret. Counts are also presented

Changes

I've added some hopefully improved organization to the @fiftyone/core and @fiftyone/state packages to introduce new data flow when lightning mode is enabled.

Notable code locations

@fiftyone/core

@fiftyone/state

Considerations I propose we include in separate PRs

  • App action row setting for disabling lightning mode and/or adjusting the threshold
  • UX for see more filters
  • Combine legacy sidebar mode (fast, best, all) and lightning

TODO

  • passing e2e
  • lightning description in field info tooltip
  • errors states for too many results in StringFilter

Testing

Configure

export FIFTYONE_APP_LIGHTNING_THRESHOLD=199

Global wildcard index

import fiftyone.zoo as foz

image = foz.load_zoo_dataset("quickstart")

# wildcard indexes only enable non-numeric filters
image.create_index([("$**", 1)])

Edges cases

import fiftyone as fo

fo.delete_dataset("lightning-demo")
dataset = fo.Dataset("lightning-demo")

dataset.add_sample(
    fo.Sample(
        filepath=f"nonfinites.png",
        inf=float("inf"),
        nan=float("nan"),
        ninf=float("-inf"),
    )
)

for i in range(0, 100):
    dataset.add_sample(
        fo.Sample(filepath=f"{i}.png", inf=i, nan=i, ninf=i, str=str(i))
    )

dataset.add_sample(fo.Sample(filepath="none.png", str=None))
for i in ["inf", "nan", "ninf", "str"]:
    dataset.create_index(i)
Screen.Recording.2023-11-16.at.2.32.59.PM.mov

Base automatically changed from lightning to develop November 16, 2023 17:53
@benjaminpkane benjaminpkane marked this pull request as ready for review November 16, 2023 20:36
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: 5340 lines in your changes are missing coverage. Please review.

Comparison is base (beaf840) 15.63% compared to head (0ebf062) 15.85%.
Report is 5 commits behind head on develop.

Files Patch % Lines
app/packages/looker/src/elements/imavid/index.ts 6.04% 435 Missing ⚠️
...p/packages/looker/src/lookers/imavid/controller.ts 4.89% 233 Missing ⚠️
...src/components/Filters/StringFilter/Checkboxes.tsx 0.00% 208 Missing ⚠️
app/packages/looker/src/lookers/imavid/index.ts 11.35% 164 Missing ⚠️
app/packages/state/src/hooks/useCreateLooker.ts 9.52% 152 Missing ⚠️
...debar/Entries/FilterablePathEntry/useFilterData.ts 0.00% 150 Missing ⚠️
app/packages/state/src/recoil/pathData/counts.ts 25.00% 144 Missing ⚠️
...c/components/Filters/StringFilter/StringFilter.tsx 0.00% 143 Missing ⚠️
...packages/looker/src/elements/imavid/play-button.ts 8.45% 130 Missing ⚠️
app/packages/state/src/recoil/lightning.ts 42.98% 130 Missing ⚠️
... and 123 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3807      +/-   ##
===========================================
+ Coverage    15.63%   15.85%   +0.21%     
===========================================
  Files          672      720      +48     
  Lines        77832    79073    +1241     
  Branches      1041     1063      +22     
===========================================
+ Hits         12168    12534     +366     
- Misses       65664    66539     +875     
Flag Coverage Δ
app 15.85% <19.69%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@manivoxel51 manivoxel51 left a comment

Choose a reason for hiding this comment

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

Great work! 🍨 nice refactor!

besides couple of nits, here is my suggestion

Major issue to investigate

The embeddings don't seem to work on my end. selecting a brain key has no effect.

Screen.Recording.2023-11-19.at.7.17.22.AM.mov

UX feedback - can come later

  • There will be confusion for users who set the threshold, then try to filter using the sidebar and seeing "disabled" with colored downward carot without an indication as to why is it disabled and how can I reset the state so I can filter. One suggestion is to
  1. gray out the carot on the field that is disabled (keeping it colored is fine)
  2. show a button somewhere in the header so they can reset the threshold to none
  3. There are certain element(s) like Tagger that disappear in the lighning mode. could be confusing and raise lot of "Where is the Tagger?". My suggestion is to disable it and add a tooltip "Disabled - in lighning mode" or similar.

Question

@benjaminpkane
Copy link
Contributor Author

gray out the carot on the field that is disabled (keeping it colored is fine)

This is already the case. We can refine post dev cut 👍

@benjaminpkane benjaminpkane merged commit a8a378d into develop Nov 20, 2023
15 checks passed
@benjaminpkane benjaminpkane deleted the lightning-ui branch November 20, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app Issues related to App features enhancement Code enhancement feature Work on a feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants