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

Dynamic groups #2934

Merged
merged 22 commits into from
May 8, 2023
Merged

Dynamic groups #2934

merged 22 commits into from
May 8, 2023

Conversation

sashankaryal
Copy link
Contributor

@sashankaryal sashankaryal commented Apr 26, 2023

What changes are proposed in this pull request?

  • Dynamic groups app support (backend tracked by Dynamic groups #2475)
  • Group code modularization and some cleanup

dynamic_groups-small

Notes to the reviewer:

  • Pay special attention to files in the app/packages/core/src/components/Modal/Group/DynamicGroup directory

How is this patch tested? If it is not, please explain why.

Dataset for testing was generated using the following snippet. Every th samples are folded into a group (here, 25).

import fiftyone as fo
import fiftyone.zoo as foz
from fiftyone import ViewField as F

dynamic_groups = foz.load_zoo_dataset("quickstart-groups").clone()

every_th_sample = 25
# for each slice, for every th samples, assign an arbitrary "scene_id"
for slice in dynamic_groups.group_slices:
    dynamic_groups.group_slice = slice
    scene_id_counter = 0
    order_by_counter = 0
    for sample in dynamic_groups:
        sample.set_field("scene_id", scene_id_counter // every_th_sample)
        sample.set_field("timestamp", order_by_counter % every_th_sample)
        sample.save()
        scene_id_counter = scene_id_counter + 1
        order_by_counter = order_by_counter + 1
dynamic_groups.save()

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

@sashankaryal sashankaryal requested a review from a team April 26, 2023 21:59
@sashankaryal sashankaryal changed the base branch from develop to feature/dynamic-groups April 26, 2023 22:00
@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 78.83% and project coverage change: -36.77 ⚠️

Comparison is base (70e5b77) 99.44% compared to head (4b20a9e) 62.67%.

❗ Current head 4b20a9e differs from pull request most recent head a0f20c8. Consider uploading reports for the commit a0f20c8 to get more accurate results

Additional details and impacted files
@@                     Coverage Diff                     @@
##           feature/dynamic-groups    #2934       +/-   ##
===========================================================
- Coverage                   99.44%   62.67%   -36.77%     
===========================================================
  Files                          22      263      +241     
  Lines                       11843    45289    +33446     
  Branches                        0      353      +353     
===========================================================
+ Hits                        11777    28385    +16608     
- Misses                         66    16904    +16838     
Flag Coverage Δ
app 49.65% <78.17%> (?)
python 99.44% <100.00%> (ø)

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

Impacted Files Coverage Δ
.../components/src/components/TabOption/TabOption.tsx 46.22% <23.07%> (ø)
app/packages/state/src/recoil/utils.ts 22.72% <25.00%> (ø)
app/packages/state/src/recoil/view.ts 55.73% <26.80%> (ø)
app/packages/state/src/recoil/atoms.ts 83.72% <28.76%> (ø)
app/packages/state/src/recoil/aggregations.ts 34.18% <35.48%> (ø)
app/packages/state/src/hooks/useStateUpdate.ts 27.84% <44.44%> (ø)
app/packages/state/src/recoil/groups.ts 49.52% <47.64%> (ø)
app/packages/state/src/recoil/modal.ts 58.33% <50.00%> (ø)
.../paginateDynamicGroupSampleIdsPageQuery.graphql.ts 100.00% <100.00%> (ø)
...ed__/paginateDynamicGroupSampleIdsQuery.graphql.ts 100.00% <100.00%> (ø)
... and 8 more

... and 225 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sashankaryal sashankaryal changed the title [WIP] Dynamic groups Dynamic groups May 5, 2023
@sashankaryal sashankaryal self-assigned this May 5, 2023
@sashankaryal sashankaryal requested a review from a team May 8, 2023 18:26
Copy link
Contributor

@benjaminpkane benjaminpkane left a comment

Choose a reason for hiding this comment

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

LGTM!


{!shouldSplitVertically && is3DVisible && <GroupSample3d />}
</div>
{subBar ?? subBar}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't use nullish coalescing very often, so I may be missing something, but this seems like it has no effect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Meant to do &&

this.element.classList.add(flashlight);
this.state = this.getEmptyState(config);

document.addEventListener("visibilitychange", () => this.render());

if (config.enableKeyNavigation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I may update this in my current grid work, looks good for the feature. But it looks horizontal mode specific, and I think document keyboard event listeners can cause regressions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add a guard for horizontal nav

if (e.key === config.enableKeyNavigation.previousKey) {
e.preventDefault();
config.enableKeyNavigation.navigationCallback(true);
this.container.scrollLeft -= 316;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this arbitrary? A comment may help

paths,
root = false,
mixed = false,
customView = undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be added to the variables type with a union

({ get }) => {
const aggregations = get(
aggregationQuery({
customView: get(viewAtoms.dynamicGroupViewQuery(groupByValue)),
Copy link
Contributor

Choose a reason for hiding this comment

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

type error from above

app/packages/state/src/recoil/groups.ts Show resolved Hide resolved
const groupStats = useRecoilValue(groupStatistics(false));

const shouldShowSliceSelector = useMemo(
() => isGroup && groupSlices.length > 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be wrong, but should it be > 1?

Copy link
Contributor

@benjaminpkane benjaminpkane left a comment

Choose a reason for hiding this comment

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

LGTM!

@sashankaryal
Copy link
Contributor Author

LGTM!

Thanks for leaving the comments. Will address comments in another PR.

@sashankaryal sashankaryal merged commit 5349f0f into feature/dynamic-groups May 8, 2023
@sashankaryal sashankaryal deleted the feat/dynamic-groups-app branch May 8, 2023 20:57
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.

2 participants