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 builtin operators for more of the FO interface #4830

Merged
merged 12 commits into from
Sep 24, 2024

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Sep 22, 2024

Change log

Added the following new builtin operators:

  • edit_field_info
  • clone_frame_field
  • rename_frame_field
  • clear_frame_field
  • delete_frame_field
  • create_index
  • drop_index
  • create_summary_field
  • update_summary_field
  • delete_summary_field
  • add_group_slice
  • rename_group_slice
  • delete_group_slice
  • load_saved_view
  • save_view
  • edit_saved_view_info
  • delete_saved_view
  • edit_workspace_info
  • sync_last_modified_at

Enhancements to existing builtin operators

  • Intelligent handling of read-only fields
  • Intelligent handling of default fields
  • Enhanced many fields' descriptions

Other updates

  • Improved the robustness of the v1.0.0 migration (eg handle case where an existing dataset has an incompatible created_at or last_modified_at field)
  • Optimized max(last_modified_at) computations via a new _get_last_modified_at() method
  • Ensured that last_modified_at times are exactly in-sync when creating/updating saved views

Tested by

Manual tests with the quickstart, quickstart-video, and quickstart-groups datasets.

@brimoor brimoor added the feature Work on a feature request label Sep 22, 2024
Copy link
Contributor

coderabbitai bot commented Sep 22, 2024

Walkthrough

The changes introduced in this pull request involve updates to methods in the fiftyone/core/collections.py and fiftyone/core/dataset.py files, enhancing the handling of last modified timestamps and refactoring the creation of summary fields. Additionally, numerous new operators have been added to the fiftyone/operators/builtin.py file, expanding functionality for managing dataset fields, views, and workspaces. The migration script in fiftyone/migrations/revisions/v1_0_0.py has also been updated to improve dataset metadata handling. Lastly, unit tests have been enhanced to ensure consistency in last modified timestamps.

Changes

Files Change Summary
fiftyone/core/collections.py Updated _sync_dataset_last_modified_at and _get_last_modified_at methods for better timestamp handling.
fiftyone/core/dataset.py Refactored create_summary_field method; added _get_default_summary_field_name method.
fiftyone/operators/builtin.py Added multiple new operators for field and view management, including EditFieldInfo, CloneFrameField, CreateSummaryField, etc.; updated list_files method signature.
fiftyone/migrations/revisions/v1_0_0.py Enhanced migration logic for dataset metadata, including last_modified_at and created_at fields.
tests/unittests/dataset_tests.py Added assertions in test_sync_last_modified_at to validate last modified timestamps.

Possibly related PRs

  • Migrating zoo/brain docs to top-level #4818: The changes in this PR involve updates to the documentation for FiftyOne Brain, including hyperlink modifications, which are directly related to the minor formatting adjustment made in the main PR's documentation for FiftyOne Brain.

Suggested labels

documentation

Suggested reviewers

  • mwoodson1
  • benjaminpkane

Poem

In the fields where data plays,
A rabbit hops through code-filled ways.
With summaries now neat and bright,
New operators bring delight!
Let's celebrate this joyful change,
In our dataset's vibrant range! 🐇✨


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cf82768 and 160f7bd.

Files selected for processing (1)
  • fiftyone/migrations/revisions/v1_0_0.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • fiftyone/migrations/revisions/v1_0_0.py

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Outside diff range and nitpick comments (3)
fiftyone/core/dataset.py (2)

Line range hint 4-4: Reminder: Address the TODO comment.

The TODO comment indicates that tests are missing for this function. Please ensure that the additional parameter change is thoroughly tested to confirm that it behaves as expected.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?


Line range hint 12-24: Consider adjusting the fee structure or discount policy.

The implementation of a flat $20 fee on discounted bills could negate the benefit of the discount, especially for smaller purchases or marginal loyalty tiers. This might lead to customer dissatisfaction, as the intent to reward loyalty paradoxically increases the bill.

Consider revising either the discount percentages or the flat fee application to better align with customer incentives.

fiftyone/operators/builtin.py (1)

593-593: Fix typographical error in error message

There's a typo in the error message at line 593: "Frrame field..." should be "Frame field...".

Apply this diff to correct the typo:

    view=types.Error(
        label="Frame field already exists",
    -   description=f"Frrame field '{new_field_name}' already exists",
    +   description=f"Frame field '{new_field_name}' already exists",
    ),
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 12aec6e and 930344e.

Files selected for processing (2)
  • fiftyone/core/dataset.py (3 hunks)
  • fiftyone/operators/builtin.py (9 hunks)
Additional context used
Ruff
fiftyone/operators/builtin.py

115-115: Do not use bare except

(E722)


1915-1915: Do not use bare except

(E722)


2173-2173: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


2191-2191: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

fiftyone/operators/builtin.py Outdated Show resolved Hide resolved
fiftyone/operators/builtin.py Show resolved Hide resolved
fiftyone/operators/builtin.py Show resolved Hide resolved
fiftyone/operators/builtin.py Show resolved Hide resolved
fiftyone/operators/builtin.py Show resolved Hide resolved
),
)

# @todo infer this automatically from current App spaces
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@imanjra @ritch can do we have a way to get the current session.spaces layout during operator execution?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, not at the moment. It should be fairly trivial to add it in.

Copy link
Contributor

@ritch ritch Sep 22, 2024

Choose a reason for hiding this comment

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

If this could also include the opened panel names and ids that would be super useful

# @todo default to current workspace name, if one is currently open
inputs.enum(
"name",
workspace_selector.values(),
Copy link
Contributor Author

@brimoor brimoor Sep 22, 2024

Choose a reason for hiding this comment

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

@imanjra @ritch here I'm wanting to add a default parameter that specifies the name of the current workspace, if a saved workspace is currently loaded.

IE looking for the equivalent of default=ctx.view.name for saved views

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the current workspace is not available to operator context. This should also be fairly trivial to add.

@ritch
Copy link
Contributor

ritch commented Sep 22, 2024

This is awesome!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Outside diff range and nitpick comments (2)
tests/unittests/dataset_tests.py (1)

5637-5648: LGTM! Consider adding a comment for clarity.

The new assertions effectively test the _get_last_modified_at() method for both samples and frames. This is a good addition to ensure the method accurately reflects the last modified time of the dataset.

Consider adding a brief comment explaining the purpose of these new assertions for better code readability. For example:

# Verify that _get_last_modified_at() returns correct timestamps
last_modified_at6b = dataset._get_last_modified_at()
last_modified_at6c = dataset._get_last_modified_at(frames=True)

self.assertEqual(last_modified_at6b, last_modified_at5b)
self.assertEqual(last_modified_at6c, last_modified_at5c)

# Verify that _get_last_modified_at() works correctly for dataset views
last_modified_at7b = dataset.view()._get_last_modified_at()
last_modified_at7c = dataset.view()._get_last_modified_at(frames=True)

self.assertEqual(last_modified_at7b, last_modified_at5b)
self.assertEqual(last_modified_at7c, last_modified_at5c)
fiftyone/operators/builtin.py (1)

1921-1933: Implement Automatic Retrieval of Current Workspace Layout

At line 1921, there's a TODO comment indicating the intention to automatically infer the spaces parameter from the current App spaces. Implementing this feature would enhance user experience by eliminating the need for manual input of the workspace definition when saving a workspace.

I can help implement this feature by retrieving the current session.spaces during operator execution. Would you like me to generate the necessary code or open a new GitHub issue to track this task?

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c07b462 and d403143.

Files selected for processing (3)
  • fiftyone/core/collections.py (1 hunks)
  • fiftyone/operators/builtin.py (7 hunks)
  • tests/unittests/dataset_tests.py (1 hunks)
Additional context used
Ruff
fiftyone/core/collections.py

660-663: Use ternary operator coll = dataset._frame_collection if frames else dataset._sample_collection instead of if-else-block

Replace if-else-block with coll = dataset._frame_collection if frames else dataset._sample_collection

(SIM108)


696-696: Do not use bare except

(E722)

fiftyone/operators/builtin.py

115-115: Do not use bare except

(E722)


1938-1938: Do not use bare except

(E722)


2199-2199: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


2217-2217: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

Additional comments not posted (1)
fiftyone/core/collections.py (1)

646-652: Code logic is clear and effective

The method _sync_dataset_last_modified_at correctly updates the dataset's last_modified_at property when necessary.

label="Error",
view=types.Error(
label="Frame field already exists",
description=f"Frrame field '{new_field_name}' already exists",
Copy link
Contributor

Choose a reason for hiding this comment

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

Typographical Error in Error Message

There's a typo in the error message at line 593. The word "Frrame" should be corrected to "Frame" to accurately reflect the field name.

Apply this diff to fix the typo:

-                    description=f"Frrame field '{new_field_name}' already exists",
+                    description=f"Frame field '{new_field_name}' already exists",
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
description=f"Frrame field '{new_field_name}' already exists",
description=f"Frame field '{new_field_name}' already exists",

fiftyone/core/collections.py Show resolved Hide resolved
fiftyone/core/collections.py Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
fiftyone/operators/builtin.py (1)

1921-1941: Automate the inference of current App spaces

There is a TODO comment at line 1921 indicating the desire to automatically infer the current App spaces. Implementing this feature would enhance user experience by eliminating the need for users to manually input the workspace JSON when saving a workspace.

As a follow-up, I can help implement this functionality. Would you like me to open a new GitHub issue to track this enhancement?

Tools
Ruff

1938-1938: Do not use bare except

(E722)

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d403143 and bd7042a.

Files selected for processing (1)
  • fiftyone/operators/builtin.py (7 hunks)
Additional context used
Ruff
fiftyone/operators/builtin.py

115-115: Do not use bare except

(E722)


1938-1938: Do not use bare except

(E722)


2245-2245: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


2263-2263: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bd7042a and 2191c86.

Files selected for processing (1)
  • fiftyone/operators/builtin.py (7 hunks)
Additional context used
Ruff
fiftyone/operators/builtin.py

115-115: Do not use bare except

(E722)


1938-1938: Do not use bare except

(E722)


2245-2245: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


2263-2263: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

Additional comments not posted (30)
fiftyone/operators/builtin.py (30)

9-13: LGTM: New imports added

The new imports for json and os are appropriate for the added functionality in this file.


19-53: LGTM: New EditFieldInfo operator added

The EditFieldInfo operator is well-implemented with proper configuration, input resolution, and execution methods. It handles different field properties (description, info, read_only) appropriately.


181-197: LGTM: CloneSampleField operator updated

The changes to the CloneSampleField operator's resolve_input and execute methods are appropriate. They add support for targeting specific views or samples, enhancing the operator's flexibility.


199-288: LGTM: _clone_sample_field_inputs function added

The new _clone_sample_field_inputs function is well-implemented. It properly handles input generation for the CloneSampleField operator, including target selection, field selection, and validation of the new field name.


289-314: LGTM: New CloneFrameField operator added

The CloneFrameField operator is well-implemented with proper configuration, input resolution, and execution methods. It extends the functionality to clone frame fields, which is a useful addition to the system.


318-414: LGTM: _clone_frame_field_inputs function added

The new _clone_frame_field_inputs function is well-implemented. It properly handles input generation for the CloneFrameField operator, including checks for datasets with frame fields, target selection, field selection, and validation of the new field name.


429-441: LGTM: RenameSampleField operator updated

The changes to the RenameSampleField operator's resolve_input and execute methods are appropriate. They update the operator to use the new input generation function and correctly execute the renaming operation.


443-501: LGTM: _rename_sample_field_inputs function added

The new _rename_sample_field_inputs function is well-implemented. It properly handles input generation for the RenameSampleField operator, including checks for non-default fields, read-only fields, and validation of the new field name to prevent conflicts with existing fields.


503-526: LGTM: New RenameFrameField operator added

The RenameFrameField operator is well-implemented with proper configuration, input resolution, and execution methods. It extends the functionality to rename frame fields, which is a useful addition to the system.


529-596: LGTM: _rename_frame_field_inputs function added

The new _rename_frame_field_inputs function is well-implemented. It properly handles input generation for the RenameFrameField operator, including checks for datasets with frame fields, non-default fields, read-only fields, and validation of the new field name to prevent conflicts with existing fields.


609-621: LGTM: ClearSampleField operator updated

The changes to the ClearSampleField operator's resolve_input and execute methods are appropriate. They update the operator to use the new input generation function and correctly execute the clearing operation for sample fields.


623-687: LGTM: _clear_sample_field_inputs function added

The new _clear_sample_field_inputs function is well-implemented. It properly handles input generation for the ClearSampleField operator, including target selection (dataset, current view, selected samples), field selection, and checks for read-only fields.


689-711: LGTM: New ClearFrameField operator added

The ClearFrameField operator is well-implemented with proper configuration, input resolution, and execution methods. It extends the functionality to clear frame fields, which is a useful addition to the system.


714-787: LGTM: _clear_frame_field_inputs function added

The new _clear_frame_field_inputs function is well-implemented. It properly handles input generation for the ClearFrameField operator, including checks for datasets with frame fields, target selection (dataset, current view, selected samples), field selection, and checks for read-only fields.


883-893: LGTM: DeleteSampleField operator updated

The changes to the DeleteSampleField operator's resolve_input and execute methods are appropriate. They update the operator to use the new input generation function and correctly execute the deletion operation for sample fields.


896-929: LGTM: _delete_sample_field_inputs function added

The new _delete_sample_field_inputs function is well-implemented. It properly handles input generation for the DeleteSampleField operator, including checks for non-default fields and read-only fields. The function provides appropriate warnings and error messages when necessary.


931-953: LGTM: New DeleteFrameField operator added

The DeleteFrameField operator is well-implemented with proper configuration, input resolution, and execution methods. It extends the functionality to delete frame fields, which is a useful addition to the system.


956-998: LGTM: _delete_frame_field_inputs function added

The new _delete_frame_field_inputs function is well-implemented. It properly handles input generation for the DeleteFrameField operator, including checks for datasets with frame fields, non-default fields, and read-only fields. The function provides appropriate warnings and error messages when necessary.


1000-1053: LGTM: New CreateIndex operator added

The CreateIndex operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to create indexes on fields, which can be useful for improving query performance in the dataset.


1055-1104: LGTM: New DropIndex operator added

The DropIndex operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to drop indexes from fields, which complements the CreateIndex operator and allows for index management in the dataset.


1106-1147: LGTM: New CreateSummaryField operator added

The CreateSummaryField operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to create summary fields in the dataset, which can be useful for data analysis and visualization.


1149-1275: LGTM: _create_summary_field_inputs function added

The new _create_summary_field_inputs function is well-implemented. It properly handles input generation for the CreateSummaryField operator, including field selection, naming, sidebar grouping, and various options specific to different field types (categorical or numeric). The function provides appropriate input controls and validation for creating summary fields.


1277-1300: LGTM: New UpdateSummaryField operator added

The UpdateSummaryField operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to update existing summary fields in the dataset, which is important for maintaining up-to-date summary information.


1302-1340: LGTM: _update_summary_field_inputs function added

The new _update_summary_field_inputs function is well-implemented. It properly handles input generation for the UpdateSummaryField operator, including checks for existing summary fields and whether they need updating. The function provides appropriate warnings when no summary fields exist or when a selected field is already up-to-date.


1341-1384: LGTM: New DeleteSummaryField operator added

The DeleteSummaryField operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to delete summary fields from the dataset, which completes the set of operations for managing summary fields (create, update, delete).


1387-1445: LGTM: New AddGroupSlice operator added

The AddGroupSlice operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to add group slices to the dataset, which is useful for managing and organizing data in datasets containing groups.


1447-1507: LGTM: New RenameGroupSlice operator added

The RenameGroupSlice operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to rename existing group slices in the dataset, which is useful for maintaining organized and meaningful group structures.


1509-1553: LGTM: New DeleteGroupSlice operator added

The DeleteGroupSlice operator is well-implemented with proper configuration, input resolution, and execution methods. It provides functionality to delete group slices from the dataset, which completes the set of operations for managing group slices (add, rename, delete).


2277-2308: LGTM: BUILTIN_OPERATORS list updated

The BUILTIN_OPERATORS list has been appropriately updated to include all the new operators added in this file. This ensures that the new functionality is properly registered and available for use within the framework.


Line range hint 1-2308: Overall assessment: Well-implemented enhancements to the builtin operators

This update to the fiftyone/operators/builtin.py file introduces a significant number of new operators and utility functions that greatly enhance the capabilities of the FiftyOne framework. The additions include:

  1. Field management operators (Edit, Clone, Rename, Clear, Delete) for both sample and frame fields.
  2. Index management operators (Create, Drop).
  3. Summary field operators (Create, Update, Delete).
  4. Group slice operators (Add, Rename, Delete).
  5. Workspace management operators.

All new additions are well-structured, following consistent patterns in their implementation. They provide a comprehensive set of tools for dataset manipulation, improving the overall functionality and flexibility of the system.

One minor issue with a bare except clause was identified and addressed.

These changes will significantly improve the user's ability to manage and manipulate datasets within the FiftyOne framework.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2191c86 and 6bc08c0.

Files selected for processing (5)
  • docs/source/brain.rst (1 hunks)
  • fiftyone/core/collections.py (1 hunks)
  • fiftyone/core/dataset.py (4 hunks)
  • fiftyone/operators/builtin.py (7 hunks)
  • tests/unittests/dataset_tests.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • docs/source/brain.rst
Files skipped from review as they are similar to previous changes (2)
  • fiftyone/core/dataset.py
  • tests/unittests/dataset_tests.py
Additional context used
Ruff
fiftyone/core/collections.py

660-663: Use ternary operator coll = dataset._frame_collection if frames else dataset._sample_collection instead of if-else-block

Replace if-else-block with coll = dataset._frame_collection if frames else dataset._sample_collection

(SIM108)


696-696: Do not use bare except

(E722)

fiftyone/operators/builtin.py

115-115: Do not use bare except

(E722)


1938-1938: Do not use bare except

(E722)


2245-2245: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


2263-2263: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

Additional comments not posted (30)
fiftyone/operators/builtin.py (30)

19-53: LGTM: Well-implemented EditFieldInfo class

The EditFieldInfo class is well-structured and correctly implements the necessary methods for a FiftyOne operator. The execute method properly handles field editing operations, including description, info, and read-only status updates.


289-315: LGTM: Well-implemented CloneFrameField class

The CloneFrameField class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles frame field cloning operations.


318-414: LGTM: Well-implemented _clone_frame_field_inputs function

The _clone_frame_field_inputs function is well-structured and handles various input scenarios comprehensively. It includes proper checks for the existence of frame fields and provides appropriate user feedback.


503-526: LGTM: Well-implemented RenameFrameField class

The RenameFrameField class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles frame field renaming operations.


529-595: LGTM: Well-implemented _rename_frame_field_inputs function

The _rename_frame_field_inputs function is well-structured and handles various input scenarios comprehensively. It includes proper checks for the existence of frame fields, read-only status, and provides appropriate user feedback.


689-711: LGTM: Well-implemented ClearFrameField class

The ClearFrameField class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles frame field clearing operations.


714-786: LGTM: Well-implemented _clear_frame_field_inputs function

The _clear_frame_field_inputs function is well-structured and handles various input scenarios comprehensively. It includes proper checks for the existence of frame fields, read-only status, and provides appropriate user feedback for different targets (dataset, current view, or selected samples).


931-953: LGTM: Well-implemented DeleteFrameField class

The DeleteFrameField class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles frame field deletion operations.


956-997: LGTM: Well-implemented _delete_frame_field_inputs function

The _delete_frame_field_inputs function is well-structured and handles various input scenarios comprehensively. It includes proper checks for the existence of frame fields, non-default fields, read-only status, and provides appropriate user feedback.


1000-1053: LGTM: Well-implemented CreateIndex class

The CreateIndex class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides a comprehensive input resolution, and the execute method properly handles index creation with optional uniqueness constraint.


1055-1103: LGTM: Well-implemented DropIndex class

The DropIndex class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides a comprehensive input resolution, excluding default indexes, and the execute method properly handles index dropping.


1106-1147: LGTM: Well-implemented CreateSummaryField class

The CreateSummaryField class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles summary field creation with various options such as sidebar group, include counts, group by, read-only status, and index creation.


1149-1274: LGTM: Well-implemented _create_summary_field_inputs function

The _create_summary_field_inputs function is well-structured and provides comprehensive input resolution for creating summary fields. It handles different field types (categorical and numeric) appropriately and includes various options such as sidebar group, include counts, group by, read-only status, and index creation.


1277-1299: LGTM: Well-implemented UpdateSummaryField class

The UpdateSummaryField class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles updating the specified summary field.


1302-1339: LGTM: Well-implemented _update_summary_field_inputs function

The _update_summary_field_inputs function is well-structured and provides comprehensive input resolution for updating summary fields. It includes proper checks for the existence of summary fields and their update status, providing appropriate user feedback.


1341-1384: LGTM: Well-implemented DeleteSummaryField class

The DeleteSummaryField class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, and the execute method properly handles summary field deletion.


1387-1445: LGTM: Well-implemented AddGroupSlice class

The AddGroupSlice class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including checks for group dataset type and existing slices. The execute method properly handles group slice addition.


1447-1506: LGTM: Well-implemented RenameGroupSlice class

The RenameGroupSlice class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including checks for group dataset type and existing slices. The execute method properly handles group slice renaming.


1509-1552: LGTM: Well-implemented DeleteGroupSlice class

The DeleteGroupSlice class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including checks for group dataset type and existing slices. The execute method properly handles group slice deletion.


1555-1565: LGTM: Well-implemented ListSavedViews class

The ListSavedViews class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles listing saved views with their information.


1568-1610: LGTM: Well-implemented LoadSavedView class

The LoadSavedView class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including checks for existing saved views. The execute method properly handles loading the specified saved view.


1612-1679: LGTM: Well-implemented SaveView class

The SaveView class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including options for name, description, and color. The execute method properly handles saving the view with the specified parameters.


1681-1707: LGTM: Well-implemented EditSavedViewInfo class

The EditSavedViewInfo class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method uses a helper function for input resolution, and the execute method properly handles updating the saved view information.


1709-1772: LGTM: Well-implemented _edit_saved_view_info_inputs function

The _edit_saved_view_info_inputs function is well-structured and provides comprehensive input resolution for editing saved view information. It includes proper checks for existing saved views, handles name conflicts, and provides options for updating description and color.


1775-1818: LGTM: Well-implemented DeleteSavedView class

The DeleteSavedView class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including checks for existing saved views. The execute method properly handles deleting the specified saved view.


Line range hint 1821-1833: LGTM: Well-implemented ListWorkspaces class

The ListWorkspaces class is correctly structured and implements the necessary methods for a FiftyOne operator. The execute method properly handles listing workspaces with their information.


1836-1876: LGTM: Well-implemented LoadWorkspace class

The LoadWorkspace class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including checks for existing workspaces. The execute method properly handles loading the specified workspace.


1974-1999: LGTM: Well-implemented EditWorkspaceInfo class

The EditWorkspaceInfo class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method uses a helper function for input resolution, and the execute method properly handles updating the workspace information.


2002-2065: LGTM: Well-implemented _edit_workspace_info_inputs function

The _edit_workspace_info_inputs function is well-structured and provides comprehensive input resolution for editing workspace information. It includes proper checks for existing workspaces, handles name conflicts, and provides options for updating description and color.


2068-2111: LGTM: Well-implemented DeleteWorkspace class

The DeleteWorkspace class is correctly structured and implements the necessary methods for a FiftyOne operator. The resolve_input method provides comprehensive input resolution, including checks for existing workspaces. The execute method properly handles deleting the specified workspace.

fiftyone/operators/builtin.py Show resolved Hide resolved
fiftyone/operators/builtin.py Show resolved Hide resolved
fiftyone/core/collections.py Show resolved Hide resolved
fiftyone/core/collections.py Show resolved Hide resolved
@imanjra
Copy link
Contributor

imanjra commented Sep 24, 2024

+1 this is awesome! 🚀

@imanjra
Copy link
Contributor

imanjra commented Sep 24, 2024

Issues from testing locally:

  • reloading app after renaming group slice still loads by the old name. We might need to add an operator to change the slice - puts app in infinite gql request loop

Copy link
Contributor

@imanjra imanjra left a comment

Choose a reason for hiding this comment

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

Rest LGTM. Tested locally 🚀

@brimoor brimoor merged commit 77de164 into develop Sep 24, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Work on a feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants