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

Support Target metric in quality UI #8347

Merged
merged 5 commits into from
Aug 29, 2024
Merged

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Aug 26, 2024

Motivation and context

Added UI support for new settings added in #8321

  • New quality settings: target metric, target metric threshold, job validation count
  • Quality colors on job list now change depending on target metric threshold
  • Mean quality number now displays value depending on target metric
  • Quality settings tooltips now show descriptions from server's schema

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features

    • Introduced a new quality settings interface allowing users to set and visualize target metrics (Accuracy, Precision, Recall) and their thresholds.
    • Enhanced the Quality Settings Modal to accommodate new metrics and thresholds for better quality management.
    • Added utility functions for color coding quality levels and improved sorting and filtering capabilities for quality reports.
  • Bug Fixes

    • Minor version updates to ensure stability and performance improvements across the application.
  • Documentation

    • Updated documentation to reflect new features and changes in quality settings functionality.

@klakhov klakhov added the ui/ux label Aug 26, 2024
Copy link
Contributor

coderabbitai bot commented Aug 26, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduce a new feature for enhancing quality settings in the application, including the addition of a "Target metric" and associated thresholds. Updates were made to various files, including the QualitySettings class and associated UI components, allowing for improved management and visualization of quality metrics. Version updates in package files reflect the integration of these new functionalities.

Changes

Files Change Summary
cvat-core/package.json, cvat-ui/package.json Version numbers updated to indicate new releases: cvat-core from 15.1.2 to 15.1.3 and cvat-ui from 1.65.0 to 1.65.1.
cvat-core/src/quality-settings.ts, cvat-core/src/server-response-types.ts Introduced TargetMetric enum and updated QualitySettings class with new properties for target metrics and thresholds; modified the serialized data interface.
cvat-ui/src/components/.../quality-settings-modal.tsx, .../task-quality/... Updated components to include new properties related to target metrics, enhancing user input and display capabilities.
cvat-ui/src/cvat-core-wrapper.ts, cvat-ui/src/utils/quality.ts Added TargetMetric to imports/exports and introduced new utility functions for quality reporting, including color coding and sorting functionalities.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QualitySettingsModal
    participant QualitySettings
    participant QualityReport

    User->>QualitySettingsModal: Set target metric and threshold
    QualitySettingsModal->>QualitySettings: Update settings
    QualitySettings->>QualityReport: Apply new metrics
    QualityReport-->>User: Display updated quality metrics
Loading

🐰 In the land of code where changes bloom,
New metrics arise, dispelling the gloom.
With colors so bright, and thresholds so clear,
Quality settings now bring us good cheer!
Hopping along, let the data flow free,
A better experience for you and for me! 🌼✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@klakhov klakhov mentioned this pull request Aug 26, 2024
4 tasks
@klakhov klakhov marked this pull request as ready for review August 26, 2024 14:35
@klakhov klakhov removed the request for review from nmanovic August 26, 2024 14:35
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f93d58c and 89820c6.

Files selected for processing (14)
  • changelog.d/20240826_171536_klakhov_update_quality_settings.md (1 hunks)
  • cvat-core/package.json (1 hunks)
  • cvat-core/src/quality-settings.ts (5 hunks)
  • cvat-core/src/server-response-types.ts (1 hunks)
  • cvat-ui/package.json (1 hunks)
  • cvat-ui/src/components/analytics-page/shared/quality-settings-modal.tsx (1 hunks)
  • cvat-ui/src/components/analytics-page/task-quality/gt-conflicts.tsx (1 hunks)
  • cvat-ui/src/components/analytics-page/task-quality/issues.tsx (1 hunks)
  • cvat-ui/src/components/analytics-page/task-quality/job-list.tsx (4 hunks)
  • cvat-ui/src/components/analytics-page/task-quality/mean-quality.tsx (2 hunks)
  • cvat-ui/src/components/analytics-page/task-quality/quality-settings-form.tsx (4 hunks)
  • cvat-ui/src/components/analytics-page/task-quality/task-quality-component.tsx (7 hunks)
  • cvat-ui/src/cvat-core-wrapper.ts (2 hunks)
  • cvat-ui/src/utils/quality.ts (1 hunks)
Files skipped from review due to trivial changes (4)
  • cvat-core/package.json
  • cvat-ui/package.json
  • cvat-ui/src/components/analytics-page/task-quality/gt-conflicts.tsx
  • cvat-ui/src/components/analytics-page/task-quality/issues.tsx
Additional comments not posted (52)
changelog.d/20240826_171536_klakhov_update_quality_settings.md (1)

1-4: LGTM!

The changelog entry is clear and concise, providing necessary information about the new feature.

The code changes are approved.

cvat-ui/src/components/analytics-page/task-quality/mean-quality.tsx (3)

11-12: LGTM!

The new imports are necessary for the added functionality.

The code changes are approved.


18-18: LGTM!

The new property targetMetric is necessary for the added functionality.

The code changes are approved.


23-25: LGTM!

The changes to the MeanQuality function are necessary for the added functionality and improve the flexibility of the component.

The code changes are approved.

Also applies to: 93-93

cvat-ui/src/components/analytics-page/shared/quality-settings-modal.tsx (1)

36-41: LGTM!

The changes to the onOk function are necessary for the added functionality and improve the configurability of the quality settings.

The code changes are approved.

cvat-ui/src/cvat-core-wrapper.ts (2)

24-24: LGTM!

The import statement correctly includes TargetMetric.

The code changes are approved.


94-94: LGTM!

The export statement correctly includes TargetMetric.

The code changes are approved.

cvat-ui/src/utils/quality.ts (7)

9-14: LGTM!

The QualityColors enum is correctly implemented.

The code changes are approved.


16-16: LGTM!

The BASE_TARGET_THRESHOLD constant is correctly defined.

The code changes are approved.


18-22: LGTM!

The ratios object is correctly defined.

The code changes are approved.


24-48: LGTM!

The qualityColorGenerator function is correctly implemented.

The code changes are approved.


50-82: LGTM!

The sorter function is correctly implemented.

The code changes are approved.


85-91: LGTM!

The collectUsers function is correctly implemented.

The code changes are approved.


93-124: LGTM!

The toRepresentation, percent, and clampValue functions are correctly implemented.

The code changes are approved.

cvat-core/src/quality-settings.ts (14)

9-13: LGTM!

The TargetMetric enum is correctly defined.

The code changes are approved.


17-17: LGTM!

The #targetMetric private property is correctly defined and initialized.

The code changes are approved.


18-18: LGTM!

The #targetMetricThreshold private property is correctly defined and initialized.

The code changes are approved.


19-19: LGTM!

The #maxValidationsPerJob private property is correctly defined and initialized.

The code changes are approved.


158-160: LGTM!

The targetMetric getter is correctly implemented.

The code changes are approved.


162-164: LGTM!

The targetMetric setter is correctly implemented.

The code changes are approved.


166-168: LGTM!

The targetMetricThreshold getter is correctly implemented.

The code changes are approved.


170-172: LGTM!

The targetMetricThreshold setter is correctly implemented.

The code changes are approved.


174-176: LGTM!

The maxValidationsPerJob getter is correctly implemented.

The code changes are approved.


178-180: LGTM!

The maxValidationsPerJob setter is correctly implemented.

The code changes are approved.


196-198: LGTM!

The toJSON method is correctly updated to include new properties.

The code changes are approved.


214-217: LGTM!

The save method is correctly updated to include the new properties.

The code changes are approved.


214-217: LGTM!

The implementation function is correctly updated to include the new properties.

The code changes are approved.


214-217: LGTM!

The Object.defineProperties call is correctly updated to include the new properties.

The code changes are approved.

cvat-ui/src/components/analytics-page/task-quality/job-list.tsx (6)

9-16: Import TargetMetric and QualityColors correctly.

The imports are correctly added for TargetMetric and QualityColors.

The code changes are approved.


20-22: Import utility functions correctly.

The imports for collectUsers, QualityColors, sorter, and toRepresentation are correctly added.

The code changes are approved.


28-29: Update Props interface.

The Props interface is updated to include getQualityColor and targetMetric. This allows the component to dynamically handle quality metrics and colors.

The code changes are approved.


36-37: Destructure new props.

The new props getQualityColor and targetMetric are correctly destructured from props.

The code changes are approved.


99-101: Update filters in columns definition.

The filters attribute in the Assignee column is updated to call collectUsers with jobsReportsArray. This change dynamically filters users based on the current job reports.

The code changes are approved.


153-157: Update Quality column to use targetMetric.

The sorter function for the Quality column is updated to use targetMetric. The rendering logic for mean accuracy is also updated to access the summary using targetMetric. This allows the component to display the relevant metric according to the current context.

Consider handling cases where targetMetric might not be present in report.summary to avoid potential runtime errors.

Ensure that targetMetric is always present in report.summary or handle cases where it might be missing.

cvat-ui/src/components/analytics-page/task-quality/task-quality-component.tsx (7)

13-16: Import TargetMetric and QualityColors correctly.

The imports are correctly added for TargetMetric and QualityColors.

The code changes are approved.


40-41: Update State interface.

The State interface is updated to include getQualityColor and targetMetric. This allows the component to dynamically handle quality metrics and colors.

The code changes are approved.


103-104: Update reducer function.

The reducer function is updated to handle getQualityColor and targetMetric in the SET_QUALITY_SETTINGS action. This ensures that the state is correctly updated with the new properties.

The code changes are approved.


144-145: Initialize getQualityColor and targetMetric.

The component's initial state is updated to set getQualityColor with a default threshold and initializes targetMetric to TargetMetric.ACCURACY. This ensures that the component starts with default values for these properties.

The code changes are approved.


190-190: Destructure new state properties.

The new state properties getQualityColor and targetMetric are correctly destructured from the state.

The code changes are approved.


216-216: Pass new props to MeanQuality.

The new props getQualityColor and targetMetric are correctly passed to the MeanQuality component.

The code changes are approved.


239-244: Pass new props to JobList.

The new props getQualityColor and targetMetric are correctly passed to the JobList component.

The code changes are approved.

cvat-core/src/server-response-types.ts (1)

244-246: Update SerializedQualitySettingsData interface.

The SerializedQualitySettingsData interface is updated to include target_metric, target_metric_threshold, and max_validations_per_job. This allows for more detailed configuration options related to quality settings.

The code changes are approved.

cvat-ui/src/components/analytics-page/task-quality/quality-settings-form.tsx (10)

13-13: Import statement is correct.

The import of Select from antd/lib/select is necessary for the new dropdown menu.

The code changes are approved.


15-15: Import statement is correct.

The import of QualitySettings and TargetMetric from cvat-core-wrapper is necessary for the new quality settings.

The code changes are approved.


26-26: Addition to initialValues is correct.

The addition of targetMetric to initialValues is necessary for the new quality settings.

The code changes are approved.


27-27: Addition to initialValues is correct.

The addition of targetMetricThreshold to initialValues is necessary for the new quality settings. Multiplying by 100 ensures the value is in percentage format.

The code changes are approved.


29-29: Addition to initialValues is correct.

The addition of maxValidationsPerJob to initialValues is necessary for the new quality settings.

The code changes are approved.


50-61: Tooltip addition is correct.

The tooltip provides useful information about the new quality settings, enhancing user experience.

The code changes are approved.


63-72: Tooltip addition is correct.

The tooltip provides useful information about the job validation settings, enhancing user experience.

The code changes are approved.


170-187: Form item addition is correct.

The form item for targetMetric is correctly implemented, allowing users to select a target metric from the dropdown menu.

The code changes are approved.


192-193: Form item addition is correct.

The form item for targetMetricThreshold is correctly implemented, allowing users to set the target metric threshold.

The code changes are approved.


200-225: Form item addition is correct.

The form item for maxValidationsPerJob is correctly implemented, allowing users to set the maximum validations per job.

The code changes are approved.

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 55.88235% with 45 lines in your changes missing coverage. Please review.

Project coverage is 83.52%. Comparing base (f93d58c) to head (f91c4d7).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8347      +/-   ##
===========================================
- Coverage    83.59%   83.52%   -0.08%     
===========================================
  Files          393      393              
  Lines        41640    41707      +67     
  Branches      3841     3858      +17     
===========================================
+ Hits         34810    34836      +26     
- Misses        6830     6871      +41     
Components Coverage Δ
cvat-ui 79.49% <55.88%> (-0.15%) ⬇️
cvat-server 87.09% <ø> (+<0.01%) ⬆️

@bsekachev
Copy link
Member

Mean quality number now displays value depending on target metric

Please, add a changelog entry Changed

Copy link

sonarcloud bot commented Aug 27, 2024

@bsekachev bsekachev merged commit 05dfc73 into develop Aug 29, 2024
33 checks passed
@bsekachev bsekachev deleted the kl/update-quality-settings branch August 29, 2024 08:02
This was referenced Sep 9, 2024
bschultz96 pushed a commit to bschultz96/cvat that referenced this pull request Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants