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

Merge release/v1.1.0 to develop #5190

Merged
merged 35 commits into from
Dec 2, 2024
Merged

Merge release/v1.1.0 to develop #5190

merged 35 commits into from
Dec 2, 2024

Conversation

voxel51-bot
Copy link
Collaborator

@voxel51-bot voxel51-bot commented Nov 25, 2024

Merge release/v1.1.0 to develop

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced Evaluation component with hover templates for confusion matrices, providing detailed prediction insights.
    • Introduced compute_leaky_splits() method for analyzing dataset splits, improving model evaluation accuracy.
    • Added DiscordLink component, replacing SlackLink across various components for community engagement.
  • Bug Fixes

    • Improved error handling in dataset loading and evaluation processes to ensure robust performance.
  • Documentation

    • Updated documentation to reflect the transition from Slack to Discord for community support and plugin development guidance.

Copy link
Contributor

coderabbitai bot commented Nov 25, 2024

Walkthrough

The changes in this pull request involve modifications to the DatasetSingleton class's __call__ method, the serialize_dataset function within the fiftyone/server/query.py file, and several components related to evaluation metrics. The __call__ method now includes a new force argument in the _update_last_loaded_at() method call. The serialize_dataset function has updated the dataset loading mechanism to ensure datasets are forcibly loaded without creating new instances. Additionally, enhancements have been made to the Evaluation component and confusion matrix plotting functions to improve the user interface and data handling.

Changes

File Path Change Summary
fiftyone/core/singletons.py Updated DatasetSingleton.__call__ method to include force argument in _update_last_loaded_at().
fiftyone/server/query.py Modified serialize_dataset function to change dataset loading mechanism and adjust error handling for saved views.
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx Enhanced hover templates for confusion matrices and updated data slicing logic in Evaluation component.
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/EvaluationPlot.tsx Modified yaxis configuration in EvaluationPlot component to change rendering behavior.
fiftyone/core/plots/plotly.py Added gt_field and pred_field parameters to confusion matrix plotting functions to enhance hover information.
fiftyone/utils/eval/base.py Updated _confusion_matrix method to conditionally manage ids based on tabulate_ids parameter.
fiftyone/operators/types.py Updated docstring for img method in Object class to clarify parameter usage.
docs/source/plugins/developing_plugins.rst Restructured and updated documentation for developing plugins, adding detailed sections and examples.
docs/source/plugins/using_plugins.rst Revised documentation for using plugins, clarifying operator execution and delegation mechanisms.
fiftyone/operators/executor.py Enhanced error handling in execute_or_delegate_operator function to check for None inputs.
fiftyone/operators/builtins/panels/model_evaluation/init.py Modified on_load method in EvaluationPanel to filter evaluations based on results and added has_evaluation_results method.
docs/source/brain.rst Added new section on "Leaky Splits" in FiftyOne Brain documentation, detailing how to compute and analyze leaky splits.
app/packages/looker-3d/src/labels/index.tsx Tightened criteria for rendering cuboid overlays in ThreeDLabels component.
app/packages/looker/src/overlays/detection.ts Refined conditions for drawing 3D rectangles in DetectionOverlay class.
app/packages/looker/src/worker/threed-label-processor.ts Enhanced logic in getInferredParamsForUndefinedProjection function to skip invalid detections.
app/packages/app/src/components/Nav.tsx Replaced SlackLink component with DiscordLink in Nav component.
app/packages/app/src/components/Setup.tsx Changed import from SlackLink to DiscordLink in Setup component.
app/packages/components/src/components/Icons/Icons.tsx Replaced SlackLink with DiscordLink, updating the icon and link details.
app/packages/components/src/components/Icons/index.ts Updated exports to remove SlackLink and add DiscordLink.
docs/source/_templates/layout.html Updated navigation and footer links from "Community Slack" to "Community Discord."
docs/source/conf.py Added a link to the Voxel51 Discord community in the Sphinx configuration.
docs/source/getting_started/troubleshooting.rst Updated troubleshooting guide to reflect the shift from Slack to Discord for support.
docs/source/index.rst Replaced Slack community link with Discord link in the documentation index.
docs/source/teams/overview.rst Updated community support mention from "Slack Community" to "Discord Community."
fiftyone/core/session/session.py Changed welcome message to link to the Discord community instead of Slack.

Possibly related PRs

  • TableView enhancements #4809: This PR introduces significant updates to the TableView component, including the ability to configure the maximum number of inline actions displayed. This could be related to the main PR, as it involves changes to the TableView functionality.
  • Add python panel timeline support #4834: This PR adds a new FrameLoaderView component, which is designed to manage frame loading and rendering within a timeline context. This could be relevant to the main PR, as it involves timeline-related functionality.
  • Merge main to develop #4874: This PR merges changes from the release/v1.1.0 branch into the develop branch, which could include updates related to the main PR's changes.
  • Update plugin components #4927: This PR updates plugin components and adds new Views in SchemaIO to support ML panels, which could be relevant to the main PR's focus on panel-related functionality.

Suggested reviewers

  • benjaminpkane

🐰 In the meadow, changes sprout,
A forceful load, without a doubt.
Datasets dance, views align,
In code's embrace, all will be fine.
Hops of joy, in every line! 🌼


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: 0

🧹 Outside diff range and nitpick comments (1)
fiftyone/server/query.py (1)

588-588: Minor suggestion: Evaluate the necessity of dataset.reload() after forcing dataset load.

Since the dataset is forcibly loaded using fo.Dataset(dataset_name, _create=False, _force_load=True), calling dataset.reload() immediately afterward may be redundant. Consider removing the dataset.reload() call if it's not necessary.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 48c52c4 and 5834afc.

📒 Files selected for processing (2)
  • fiftyone/core/singletons.py (2 hunks)
  • fiftyone/server/query.py (1 hunks)
🔇 Additional comments (1)
fiftyone/core/singletons.py (1)

41-43: Implementation looks good, verify related changes

The implementation correctly handles the force loading parameter with proper default value handling. However, we should verify the implementation of the _update_last_loaded_at() method to ensure it properly handles the new force parameter.

Let's verify the implementation of the _update_last_loaded_at() method:

✅ Verification successful

Implementation verified and properly integrated

The implementation is correctly designed and integrated across the codebase:

  • The _update_last_loaded_at(force=False) method is properly implemented in fiftyone/core/dataset.py with the force parameter
  • The method correctly handles the force parameter by checking if os.environ.get("FIFTYONE_SERVER", False) and not force
  • The feature is used appropriately in the server query handling (fiftyone/server/query.py) with _force_load=True
  • The change maintains backward compatibility through default values
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the implementation and usage of _update_last_loaded_at
ast-grep --pattern 'def _update_last_loaded_at($$$)'

# Search for any tests related to force loading
rg -l "force.*load|load.*force" "tests/"

Length of output: 95


Script:

#!/bin/bash
# Let's try a broader search for the method implementation
rg -A 5 "_update_last_loaded_at" 

# Also search for force loading related code
rg -A 5 "_force_load"

# Search for any class that might contain this method
ast-grep --pattern 'class $_ {
  $$$
  _update_last_loaded_at($$$) {
    $$$
  }
  $$$
}'

Length of output: 3649

Jacob Sela and others added 4 commits November 25, 2024 14:25
* fix confusion matrix in model evaluation panel

* improve confusion matrix legends

* reverse y-axis range

* update hovertemplate

---------

Co-authored-by: brimoor <brimoor@umich.edu>
Co-authored-by: Lanny W <lanzhenwang9@gmail.com>
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 (3)
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/EvaluationPlot.tsx (1)

33-35: Consider adding documentation about the reversed y-axis behavior.

The y-axis reversal is an important visual characteristic that should be documented. Consider adding a comment explaining why the y-axis is reversed and its relationship to confusion matrix visualization.

      yaxis: {
        showgrid: true,
        zeroline: true,
        visible: true,
        zerolinecolor: theme.text.tertiary,
        color: theme.text.secondary,
        gridcolor: theme.primary.softBorder,
        automargin: true, // Enable automatic margin adjustment
+       // Reversed y-axis for proper confusion matrix visualization
        autorange: "reversed",
      },
fiftyone/utils/eval/base.py (1)

362-365: Consider improving readability of the numpy delete operations

While the logic is correct, the nested np.delete operations could be made more readable.

Consider this alternative structure:

-            ids = np.delete(
-                np.delete(ids, rm_inds, axis=0), rm_inds, axis=1
-            )
+            # Remove rows and columns for unused labels
+            ids = np.delete(ids, rm_inds, axis=0)  # Remove rows
+            ids = np.delete(ids, rm_inds, axis=1)  # Remove columns
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (1)

1158-1168: Consider extracting hover template to avoid code duplication.

The hover template configuration is duplicated between the two confusion matrix plots. Consider extracting it into a reusable constant or function to improve maintainability.

+const getHoverTemplate = (evaluation) => [
+  "<b>count: %{z:d}</b>",
+  `${evaluation?.info?.config?.gt_field || "truth"}: %{y}`,
+  `${evaluation?.info?.config?.pred_field || "predicted"}: %{x}`,
+].join(" <br>") + "<extra></extra>";

 // Then use it in both places:
-hovertemplate: [
-  "<b>count: %{z:d}</b>",
-  `${evaluation?.info?.config?.gt_field || "truth"}: %{y}`,
-  `${evaluation?.info?.config?.pred_field || "predicted"}: %{x}`,
-].join(" <br>") + "<extra></extra>",
+hovertemplate: getHoverTemplate(evaluation),

 // And in the compare section:
-hovertemplate: [
-  "<b>count: %{z:d}</b>",
-  `${evaluation?.info?.config?.gt_field || "truth"}: %{y}`,
-  `${evaluation?.info?.config?.pred_field || "predicted"}: %{x}`,
-].join(" <br>") + "<extra></extra>",
+hovertemplate: getHoverTemplate(compareEvaluation),

Also applies to: 1197-1207

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5834afc and 8a72af6.

📒 Files selected for processing (4)
  • app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (3 hunks)
  • app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/EvaluationPlot.tsx (1 hunks)
  • fiftyone/core/plots/plotly.py (7 hunks)
  • fiftyone/utils/eval/base.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/EvaluationPlot.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (7)
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/EvaluationPlot.tsx (1)

34-34: Verify the impact of y-axis reversal on existing visualizations.

The change from scaleanchor: "x" to autorange: "reversed" improves confusion matrix visualization but may affect other plots using this component.

fiftyone/utils/eval/base.py (2)

336-337: LGTM: Proper conditional handling of ids array

The code correctly guards the ids array modification with the tabulate_ids check, preventing potential errors when ID tabulation is disabled.


344-346: LGTM: Consistent handling of edge cases

The code maintains consistency in handling the ids array for the intersection of "other" and "missing" labels, with proper conditional checks.

app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (1)

1557-1558: LGTM! Consistent slicing implementation.

The matrix slicing implementation correctly handles the limit parameter by applying it consistently to both the classes and matrix arrays.

fiftyone/core/plots/plotly.py (3)

106-107: LGTM: Parameters added to improve hover information.

The addition of gt_field and pred_field parameters enhances the customization of hover tooltips in confusion matrix plots.


130-131: LGTM: Clean implementation of hover template customization.

The changes effectively:

  1. Add optional parameters with proper defaults
  2. Use the field names to customize the hover template
  3. Maintain backward compatibility

Also applies to: 137-138, 211-212


1972-1975: LGTM: Clean addition of field name customization to InteractiveHeatmap.

The changes properly integrate field name customization into the InteractiveHeatmap class, following existing patterns and maintaining clean code organization.

Also applies to: 2010-2011

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

🧹 Outside diff range and nitpick comments (5)
docs/source/plugins/using_plugins.rst (2)

597-598: Consider enhancing the metadata computation example

While the example is correct, it would be more helpful to add a brief comment explaining what metadata is being computed and why one might want to overwrite it.

 # (Re)compute the dataset's metadata
+# This computes basic metadata like image dimensions, file sizes, etc.
+# Use overwrite=True to force recomputation of existing metadata
 compute_metadata(dataset, overwrite=True)

656-695: Enhance the delegation documentation with more context

The section effectively explains the mechanics but could benefit from explaining the practical benefits of delegation.

 Requesting delegation
 ~~~~~~~~~~~~~~~~~~~~~
+
+Delegation allows you to offload computationally intensive tasks to a separate process,
+preventing the main application from becoming unresponsive during long-running operations.
+
 Operators that support :ref:`delegated execution <delegated-operations>` can
fiftyone/operators/executor.py (1)

264-270: LGTM! Consider enhancing error logging.

The added null check and error handling for inputs schema serialization is a good improvement. It prevents potential null pointer exceptions and gracefully handles serialization errors.

Consider including the error type in the warning message for better debugging:

-                        f"Failed to resolve inputs schema for the operation: {str(e)}"
+                        f"Failed to resolve inputs schema for the operation: {type(e).__name__}: {str(e)}"
docs/source/plugins/developing_plugins.rst (2)

Line range hint 401-1144: Comprehensive examples with room for enhancement

The examples section provides good coverage of different plugin types with clear code samples. However, consider adding more inline comments within the code examples to explain specific implementation choices.

Consider adding more inline comments in code examples like this:

def execute(self, ctx):
    # Get the brain key from the current panel state
    brain_key = ctx.panel.state.menu.actions.brain_key
    if brain_key is None:
        return

    # Load and process the brain results
    results = ctx.dataset.load_brain_results(brain_key)
    
    # Format the data for the plot
    data = {"points": results.points, ...}
    
    # Store as panel data for efficient reuse
    ctx.panel.set_data("embeddings", data)

Line range hint 1244-2500: Comprehensive panel development guide with excellent patterns

The panel development section is thorough and well-organized. The common patterns section is particularly valuable, providing clear examples of state management, callbacks, and interactive components.

Consider adding a troubleshooting section that addresses common issues developers might encounter when building panels, such as:

  • State management pitfalls
  • Common callback mistakes
  • Performance optimization tips
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 87bf17c and a992ac4.

📒 Files selected for processing (3)
  • docs/source/plugins/developing_plugins.rst (3 hunks)
  • docs/source/plugins/using_plugins.rst (5 hunks)
  • fiftyone/operators/executor.py (1 hunks)
🔇 Additional comments (4)
docs/source/plugins/using_plugins.rst (1)

929-929: LGTM: Environment configuration note

The addition of the environment configuration note is clear and helpful.

docs/source/plugins/developing_plugins.rst (3)

Line range hint 1-145: Well-structured introduction to plugin development concepts

The introduction and overview sections provide a clear and comprehensive explanation of plugin types and components. The documentation effectively explains the distinction between Python and JS plugins, and clearly outlines the roles of panels, operators, and components.


Line range hint 146-400: Clear setup instructions and configuration documentation

The development setup and plugin anatomy sections are well-documented with precise instructions. The fiftyone.yml configuration section is particularly thorough, with a clear table of available fields and good examples.


Line range hint 1145-1243: Clear explanation of execution options and delegation

The operator execution section effectively explains immediate vs delegated execution options. The progress reporting examples are particularly helpful.

Comment on lines +800 to +857
.. _delegating-function-calls:

Delegating function calls
-------------------------

The
`@voxel51/utils/delegate <https://github.com/voxel51/fiftyone-plugins/tree/main/plugins/utils>`_
operator provides a general purpose utility for
:ref:`delegating execution <delegated-operations>` of an arbitrary function
call that can be expressed in any of the following forms:

- Execute an arbitrary function: `fcn(*args, **kwargs)`
- Apply a function to a dataset or view:
`fcn(dataset_or_view, *args, **kwargs)`
- Call an instance method of a dataset or view:
`dataset_or_view.fcn(*args, **kwargs)`

Here's some examples of delegating common tasks that can be expressed in the
above forms:

.. code-block:: python
:linenos:

import fiftyone as fo
import fiftyone.operators as foo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")
delegate = foo.get_operator("@voxel51/utils/delegate")

# Compute metadata
delegate("compute_metadata", dataset=dataset)

# Compute visualization
delegate(
"fiftyone.brain.compute_visualization",
dataset=dataset,
brain_key="img_viz",
)

# Export a view
delegate(
"export",
view=dataset.to_patches("ground_truth"),
export_dir="/tmp/patches",
dataset_type="fiftyone.types.ImageClassificationDirectoryTree",
label_field="ground_truth",
)

# Load the exported patches into a new dataset
delegate(
"fiftyone.Dataset.from_dir",
dataset_dir="/tmp/patches",
dataset_type="fiftyone.types.ImageClassificationDirectoryTree",
label_field="ground_truth",
name="patches",
persistent=True,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling guidance to function delegation examples

The function delegation examples are comprehensive but should include guidance on error handling.

 # Load the exported patches into a new dataset
 delegate(
     "fiftyone.Dataset.from_dir",
     dataset_dir="/tmp/patches",
     dataset_type="fiftyone.types.ImageClassificationDirectoryTree",
     label_field="ground_truth",
     name="patches",
     persistent=True,
+    # Note: Errors in delegated operations can be monitored using:
+    # fiftyone delegated list --state FAILED
 )

Committable suggestion skipped: line range outside the PR's diff.

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 (2)
fiftyone/operators/builtins/panels/model_evaluation/__init__.py (2)

83-88: LGTM! Consider adding a list comprehension for better readability

The filtering logic to include only evaluations with results is correct and improves the user experience. However, the code could be more concise.

Consider using a list comprehension for better readability:

-            if self.has_evaluation_results(ctx.dataset, key):
-                evaluation = {
-                    "key": key,
-                    "id": self.get_evaluation_id(ctx.dataset, key),
-                }
-                evaluations.append(evaluation)
+            evaluations = [
+                {"key": key, "id": self.get_evaluation_id(ctx.dataset, key)}
+                for key in ctx.dataset.list_evaluations()
+                if self.has_evaluation_results(ctx.dataset, key)
+            ]

Line range hint 359-363: Add docstring to improve code documentation

The method implementation is correct, but adding a docstring would improve maintainability.

Consider adding documentation:

 def has_evaluation_results(self, dataset, eval_key):
+    """Check if an evaluation has results.
+
+    Args:
+        dataset: The FiftyOne dataset containing the evaluation
+        eval_key: The key identifying the evaluation
+
+    Returns:
+        bool: Whether the evaluation has results
+    """
     try:
         return bool(dataset._doc.evaluations[eval_key].results)
     except Exception:
         return False
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a82749d and 5e32142.

📒 Files selected for processing (1)
  • fiftyone/operators/builtins/panels/model_evaluation/__init__.py (1 hunks)

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 (5)
docs/source/brain.rst (5)

1775-1780: Consider enhancing the introduction with a clear definition of data leaks.

While the introduction effectively explains why leaks are problematic, it would be helpful to explicitly define what constitutes a "leak" (e.g., exact duplicates, near-duplicates, or semantically equivalent samples) to help users better understand what the tool will identify.


1792-1811: Enhance code examples with more descriptive comments and type hints.

The code examples would be more educational with:

  1. Type hints for the return values
  2. Example values for the split field
  3. More descriptive comments explaining each approach's use case

Consider updating the examples like this:

 import fiftyone as fo
 import fiftyone.brain as fob

 dataset = fo.load_dataset(...)
 
-# splits via tags
+# Method 1: Define splits using dataset tags
+# Useful when samples can belong to multiple splits
 split_tags = ['train', 'test']
 index, leaks = fob.compute_leaky_splits(dataset, split_tags=split_tags)

-# splits via field
-split_field = ['split'] # holds split values e.g. 'train' or 'test'
+# Method 2: Define splits using a field
+# Useful when each sample belongs to exactly one split
+split_field = 'split'  # field containing values like 'train', 'test', 'validation'
 index, leaks = fob.compute_leaky_splits(dataset, split_field=split_field)

-# splits via views
+# Method 3: Define splits using dataset views
+# Useful when splits are defined by complex criteria
 split_views = {
     'train' : some_view
     'test' : some_other_view
 }
 index, leaks = fob.compute_leaky_splits(dataset, split_views=split_views)

1833-1840: Add guidance on interpreting leak analysis results.

The example would be more helpful if it included:

  1. What patterns to look for when reviewing leaks
  2. Common types of leaks found in real datasets
  3. Example output showing what leaks look like

1897-1905: Enhance threshold selection guidance.

The documentation would benefit from:

  1. Typical threshold ranges that work well in practice
  2. Examples of how different thresholds affect results
  3. A methodology for finding the optimal threshold for a given dataset

1861-1862: Fix typographical errors.

There are a few minor typos in this section:

  • "Performance on the clean test set will can be closer" should be "Performance on the clean test set can be closer"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5e32142 and 835ccec.

⛔ Files ignored due to path filters (1)
  • docs/source/images/brain/brain-leaky-splits.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (1)
  • docs/source/brain.rst (2 hunks)

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 (4)
app/packages/looker-3d/src/labels/index.tsx (2)

138-142: LGTM! Consider enhancing type safety.

The additional safety checks for dimensions and location properties are good. However, consider using TypeScript type guards to improve type safety and maintainability.

Consider this type-safe approach:

-if (
-  overlay._cls === "Detection" &&
-  overlay.dimensions &&
-  overlay.location
-) {
+interface Detection {
+  _cls: "Detection";
+  dimensions: { width: number; height: number; depth: number };
+  location: { x: number; y: number; z: number };
+}
+
+function isValidDetection(overlay: OverlayLabel): overlay is Detection {
+  return (
+    overlay._cls === "Detection" &&
+    !!overlay.dimensions &&
+    !!overlay.location
+  );
+}
+
+if (isValidDetection(overlay)) {

138-142: Consider memoizing the type check for better performance.

Since this check is performed within a loop processing raw overlays, consider extracting the validation logic to a memoized function to optimize performance when dealing with large datasets.

Here's a suggested optimization:

const isValidOverlay = useCallback((overlay: OverlayLabel) => {
  if (overlay._cls === "Detection") {
    return !!overlay.dimensions && !!overlay.location;
  }
  if (overlay._cls === "Polyline") {
    return !!(overlay as unknown as PolyLineProps).points3d;
  }
  return false;
}, []);

// Then in the loop:
if (overlay._cls === "Detection" && isValidOverlay(overlay)) {
  // ... rest of the code
}
app/packages/looker/src/worker/threed-label-processor.ts (2)

62-62: LGTM! Consistent validation across code paths.

The null check aligns with the validation added for the Detections type above.

Consider extracting the validation logic into a helper function to maintain DRY principles:

+const isValidDetection = (detection: DetectionLabel): boolean => {
+  return Boolean(detection.location && detection.dimensions);
+};

-if (cls === "Detection" && label.location && label.dimensions) {
+if (cls === "Detection" && isValidDetection(label)) {

Line range hint 19-22: Consider implementing cache management.

The inferredParamsCache is implemented as a global object without any cache invalidation strategy. This could lead to memory leaks in long-running applications as the cache grows unbounded with sample IDs.

Consider:

  1. Implementing a cache size limit
  2. Adding cache invalidation for old entries
  3. Using a proper caching library with built-in LRU functionality
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 835ccec and 3ae877c.

📒 Files selected for processing (3)
  • app/packages/looker-3d/src/labels/index.tsx (1 hunks)
  • app/packages/looker/src/overlays/detection.ts (1 hunks)
  • app/packages/looker/src/worker/threed-label-processor.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
app/packages/looker-3d/src/labels/index.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker/src/overlays/detection.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker/src/worker/threed-label-processor.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (2)
app/packages/looker/src/worker/threed-label-processor.ts (1)

50-52: LGTM! Robust null-safety check added.

The added validation prevents runtime errors by skipping detections with missing location or dimensions.

Let's verify that all detection processing code paths have similar null checks:

✅ Verification successful

Let me gather more context about the detection processing to ensure we have a complete view.


Null checks are properly implemented throughout the codebase

After reviewing the complete file, the null checks for detection.location and detection.dimensions are consistently implemented in both code paths where these properties are accessed:

  • Lines 50-52: In the parameters inference loop for Detections type
  • Line 62: In the single Detection type processing with an identical check

The validation is thorough and prevents any potential runtime errors from accessing undefined properties. No additional checks are needed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for detection processing code that might need similar null checks
ast-grep --pattern 'detection.$_' app/packages/looker/src

Length of output: 389


Script:

#!/bin/bash
# Get the full context of the threed-label-processor.ts file
cat app/packages/looker/src/worker/threed-label-processor.ts

Length of output: 6636

app/packages/looker/src/overlays/detection.ts (1)

91-94: LGTM! Improved robustness of 3D rendering condition.

The enhanced condition properly validates the existence of required 3D properties before attempting to render, preventing potential runtime errors. This defensive approach aligns well with the TypeScript interface definition where these properties are optional.

minhtuev and others added 2 commits November 27, 2024 13:05
* Updated from Slack to Discord
* Updated doc and logo data
* Added discord png logo to doc

Co-authored-by: Sashank Aryal <sashank2012@gmail.com>
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: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae877c and 4867bd5.

⛔ Files ignored due to path filters (1)
  • docs/source/_static/images/icons/discord-logo-256px.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (10)
  • app/packages/app/src/components/Nav.tsx (2 hunks)
  • app/packages/app/src/components/Setup.tsx (2 hunks)
  • app/packages/components/src/components/Icons/Icons.tsx (1 hunks)
  • app/packages/components/src/components/Icons/index.ts (1 hunks)
  • docs/source/_templates/layout.html (2 hunks)
  • docs/source/conf.py (1 hunks)
  • docs/source/getting_started/troubleshooting.rst (1 hunks)
  • docs/source/index.rst (2 hunks)
  • docs/source/teams/overview.rst (1 hunks)
  • fiftyone/core/session/session.py (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • app/packages/app/src/components/Nav.tsx
  • app/packages/components/src/components/Icons/index.ts
  • docs/source/conf.py
  • docs/source/teams/overview.rst
  • fiftyone/core/session/session.py
🧰 Additional context used
📓 Path-based instructions (2)
app/packages/app/src/components/Setup.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/components/src/components/Icons/Icons.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (7)
app/packages/components/src/components/Icons/Icons.tsx (2)

11-25: LGTM! The DiscordLink component implementation follows best practices.

The component is well-structured and consistent with other link components in the file. It properly uses the MUI SvgIcon component and maintains consistent styling through the theme system.


14-15: Verify the Discord community URL.

The URL points to a generic community subdomain. Let's verify this is the correct and permanent Discord community URL.

✅ Verification successful

The Discord community URL is correct and consistently used across the codebase

The URL https://community.voxel51.com/ is the official Discord community URL for Voxel51, as evidenced by its consistent usage across multiple critical locations in the codebase:

  • Documentation configuration and templates
  • Core session files
  • Multiple UI components
  • Navigation and setup components
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of Discord-related URLs to ensure consistency
rg -i "discord|community\.voxel51\.com" --type ts --type tsx

Length of output: 90


Script:

#!/bin/bash
# Search for Discord-related URLs with proper file extensions
rg -i "discord|community\.voxel51\.com" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts'

# Also check for any configuration files that might contain URLs
rg -i "discord|community\.voxel51\.com" --type json --type yaml

Length of output: 1739

app/packages/app/src/components/Setup.tsx (2)

5-5: LGTM! Import statement updated correctly.

The import statement has been properly updated to use DiscordLink from the shared components package.


193-193: LGTM! Component usage updated correctly.

The DiscordLink component is properly integrated within the header's icon container, maintaining consistency with other social links.

Let's verify the DiscordLink component implementation:

✅ Verification successful

Let me analyze the output to verify the DiscordLink component implementation.

The previous search didn't return the DiscordLink implementation. Let me try another pattern:


Let me try one more search to find the actual DiscordLink component implementation:


Let me check the @fiftyone/components package where the DiscordLink component is imported from:


Component verified - correctly implemented and integrated

The DiscordLink component is properly implemented in the @fiftyone/components package and correctly integrated in both Setup.tsx and Nav.tsx components. The component is a simple external link to the Discord community that renders with an icon, maintaining consistency with other social links in the header.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the DiscordLink component implementation and its usage across the codebase

# Check the DiscordLink component implementation
ast-grep --pattern 'export const DiscordLink = () => {
  $$$
}'

# Check for any remaining SlackLink references that might have been missed
rg -i 'slack(link)?'

Length of output: 131437


Script:

#!/bin/bash
# Let's check for the DiscordLink component implementation and any remaining Slack references
ast-grep --pattern 'export const DiscordLink = ({$$$}) => {
  $$$
}'

# Search for any remaining Slack references in components
rg -i "slack" app/packages/app/src/components/

Length of output: 117


Script:

# Try another pattern to find DiscordLink component
ast-grep --pattern 'const DiscordLink = {$$$}'

# Also check for any files containing DiscordLink
rg "DiscordLink" app/packages/app/src/components/

Length of output: 344


Script:

#!/bin/bash
# Search for the DiscordLink component implementation with a broader pattern
ast-grep --pattern 'DiscordLink = $$$'

# Also check the full content of files that reference DiscordLink
rg -A 10 -B 10 "DiscordLink" app/packages/app/src/components/

Length of output: 5172


Script:

#!/bin/bash
# Search for DiscordLink in the components package
rg -A 10 -B 10 "DiscordLink" app/packages/components/src/

# Also check for any exports of DiscordLink
rg "export.*DiscordLink" app/packages/components/src/

Length of output: 2763

docs/source/_templates/layout.html (1)

57-57: LGTM: Learn menu Discord link update

Clean replacement of Slack with Discord in the Learn dropdown menu.

docs/source/index.rst (2)

17-19: LGTM: Social links updated correctly for Discord migration

The changes appropriately update the community platform links from Slack to Discord, maintaining consistency in both the URL and visual elements.


475-475: LGTM: Support section updated for Discord migration

The support section has been correctly updated to reference the new Discord community platform, maintaining consistency with the social links section.

@@ -9,7 +9,7 @@ This page lists common issues encountered when installing FiftyOne and possible
solutions. If you encounter an issue that this page doesn't help you resolve,
feel free to
`open an issue on GitHub <https://github.com/voxel51/fiftyone/issues/new?labels=bug&template=installation_issue_template.md&title=%5BSETUP-BUG%5D>`_
or `contact us on Slack <https://slack.voxel51.com>`_.
or `contact us on Discord <https://community.voxel51.com>`_.
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Discord link needs to be updated to the direct Discord invite URL

The community.voxel51.com URL redirects to https://discord.gg/fiftyone-community. For better user experience and to avoid an unnecessary redirect, the documentation should use the direct Discord invite URL.

  • Update line 12 in docs/source/getting_started/troubleshooting.rst to use https://discord.gg/fiftyone-community instead of https://community.voxel51.com
🔗 Analysis chain

LGTM! Let's verify the Discord link.

The change from Slack to Discord is consistent with the platform transition mentioned in the PR summary.

Let's verify the Discord community link is accessible:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Discord community link is accessible
# Expected: HTTP 200 OK response

curl -I https://community.voxel51.com

Length of output: 571

@@ -140,7 +140,7 @@
<a href="{{link_voxel51_blog}}">Blog</a>
<a href="{{link_docs_fiftyone}}">Docs</a>
<a href="{{link_voxel51_github}}">GitHub</a>
<a href="{{link_voxel51_slack}}">Slack</a>
<a href="{{link_voxel51_discord}}">Discord</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Additional updates needed for complete Slack to Discord migration

While the footer link has been updated to Discord, there are still remaining Slack references in other files that need to be addressed:

  • docs/source/conf.py: Contains an unused Slack link variable
  • docs/source/release-notes.rst: Contains a reference to an expired Slack link

Please update these remaining references to maintain consistency with the Discord migration.

🔗 Analysis chain

LGTM: Footer Discord link update

Clean replacement of Slack with Discord in the footer links section.

Let's verify the Discord link configuration:


Let me analyze the output to verify the Discord link configuration.


Let me check the content of the remaining files that contain Slack references.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Discord link configuration in conf.py and its usage

# Check if link_voxel51_discord is defined in conf.py
rg "link_voxel51_discord" docs/source/conf.py

# Check for any remaining Slack references that might need updating
rg -i "slack" docs/source/

Length of output: 131388


Script:

#!/bin/bash
# Check for any remaining Slack references in the layout template
rg "slack" docs/source/_templates/layout.html

# Check for any remaining Slack references in other files that might need updating
rg -l "slack" docs/source/

Length of output: 122


Script:

#!/bin/bash
# Check the content of conf.py and release-notes.rst for Slack references
rg -A 2 -B 2 "slack" docs/source/conf.py docs/source/release-notes.rst

Length of output: 728

CamronStaley and others added 2 commits November 27, 2024 15:48
* make icon in panel table have circle background on hover

* cleanup

* fix icon
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 (2)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (1)

98-121: Consider consolidating styles and improving type safety

The conditional rendering logic is well-implemented, but there are opportunities for improvement:

  1. The sx prop spreads could be consolidated to reduce repetition
  2. The size prop could benefit from stricter typing with the SizeType

Consider refactoring to:

+ const commonSx = {
+   color: resolvedColor,
+ };
+
+ const buttonSx = {
+   ...commonSx,
+   padding: size === "small" ? 0 : undefined,
+   minWidth: size === "small" ? 40 : undefined,
+ };

  label ? (
    <Button
      variant={variant}
      startIcon={Icon}
      onClick={handleClick}
-     sx={{
-       color: resolvedColor,
-       padding: size === "small" ? 0 : undefined,
-       minWidth: size === "small" ? 40 : undefined,
-     }}
+     sx={buttonSx}
    >
      {label}
    </Button>
  ) : (
    <IconButton
      onClick={handleClick}
      size={size}
-     sx={{
-       color: resolvedColor,
-     }}
+     sx={commonSx}
    >
      {Icon}
    </IconButton>
  )
app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)

232-232: Consider extracting the minHeight value as a constant.

While the Box component effectively maintains consistent row heights, the "32px" value would be better managed as a named constant at the component level or in a theme configuration.

+ const ACTION_CELL_MIN_HEIGHT = '32px';
  // ... rest of the component code
- <Box sx={{ minHeight: "32px" }} />
+ <Box sx={{ minHeight: ACTION_CELL_MIN_HEIGHT }} />
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4867bd5 and a16fb12.

📒 Files selected for processing (2)
  • app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (2 hunks)
  • app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (2)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (1)

81-86: LGTM! Props formatting improves readability

The multi-line formatting of the MuiIconFont component's props enhances code readability while maintaining proper TypeScript typing.

app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)

225-231: LGTM! Clean conditional rendering implementation.

The ternary operator provides a clear and concise way to handle the conditional rendering of the ActionsMenu component.

@benjaminpkane benjaminpkane merged commit a6b5481 into develop Dec 2, 2024
14 checks passed
@benjaminpkane benjaminpkane deleted the merge/release/v1.1.0 branch December 2, 2024 17:37
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.

9 participants