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

refactor: move column settings to querysettings (#2042) #2050

Conversation

holtgrewe
Copy link
Collaborator

@holtgrewe holtgrewe commented Oct 24, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new model for managing query settings related to columns, enhancing configuration organization.
    • Added new serializers and factories to support the updated query settings structure.
    • Enhanced API schema to include new parameters and structures for query settings and column configurations.
    • Implemented a new "Columns" filter group in the UI for improved column management.
  • Bug Fixes

    • Removed obsolete configurations to streamline the query settings management.
  • Tests

    • Expanded test coverage with new test classes and updated existing tests to reflect the new query settings structure.
  • Documentation

    • Updated references in tests and serializers to align with the new model and field names.

@holtgrewe holtgrewe linked an issue Oct 24, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Oct 24, 2024

Warning

Rate limit exceeded

@holtgrewe has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between 5231641 and 9590870.

Walkthrough

This pull request introduces a new model, SeqvarsQuerySettingsColumns, to manage column settings within the seqvars application. It removes the columnsconfig field from the SeqvarsQuery model and deletes the SeqvarsQueryColumnsConfig model, consolidating configuration management. Changes extend to serializers, factories, and tests, reflecting a restructuring of how query settings and their associated columns are handled across the codebase.

Changes

File Path Change Summary
backend/seqvars/migrations/0012_auto_20241024_0823.py - Added model SeqvarsQuerySettingsColumns with fields sodar_uuid, date_created, date_modified, column_settings, and querysettings.
- Removed columnsconfig from SeqvarsQuery and deleted SeqvarsQueryColumnsConfig.
backend/seqvars/models/base.py - Renamed SeqvarsQueryColumnsConfigManager to SeqvarsQuerySettingsColumnsManager and updated method names.
- Updated SeqvarsQuery to reference querysettings.
- Added columns field to SeqvarsQuerySettings.
- Introduced SeqvarsQuerySettingsColumnsPydantic.
backend/seqvars/serializers.py - Added SeqvarsQuerySettingsColumnsSerializer.
- Updated SeqvarsQuerySettingsSerializer to include a read-only columns field.
- Removed SeqvarsQueryColumnsConfigSerializer.
backend/seqvars/tests/factories.py - Added SeqvarsQuerySettingsColumnsFactory.
- Updated SeqvarsQueryFactory to use columns instead of columnsconfig.
- Removed SeqvarsQueryColumnsConfigFactory.
backend/seqvars/tests/snapshots/snap_test_models.py - Added snapshot for TestSeqvarsQuerySettingsColumns.
- Updated imports to include GenericRepr.
backend/seqvars/tests/test_models.py - Removed TestSeqvarsQueryColumnsConfig and associated factory.
- Added TestSeqvarsQuerySettingsColumns for testing new model.
backend/seqvars/tests/test_permissions_api.py - Updated imports to replace SeqvarsQueryColumnsConfigSerializer and Factory with their new counterparts.
backend/seqvars/tests/test_serializers.py - Removed SeqvarsQueryColumnsConfigSerializer and factory.
- Added TestSeqvarsQuerySettingsColumnsSerializer for testing serialization.
backend/seqvars/tests/test_views_api.py - Updated imports and test methods to incorporate new serializers and factories, replacing references to columnsconfig.

Possibly related issues

🐰 "In the garden where data blooms,
New models sprout, dispelling glooms.
Columns now find their rightful place,
In settings where they can embrace.
With tests and serializers all in line,
Our queries flourish, oh how they shine!" 🐇✨


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.

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.

Copy link

github-actions bot commented Oct 24, 2024

deps-report 🔍

Commit scanned: 9590870
ℹ️ Python version 3.10 is used by your project but the latest version is 3.13.

Vulnerable dependencies

4 dependencies have vulnerabilities 😱
Dependency Advisory Versions impacted
djangorestframework (transitive) Affected versions of the package djangorestframework are vulnerable to Cross-site Scripting (XSS) via the break_long_headers template filter due to improper input sanitization before splitting and joining with
tags.
<3.15.2
jinja2 (transitive) In Jinja2, the from_string function is prone to Server Side Template Injection (SSTI) where it takes the source parameter as a template object, renders it, and then returns it. The attacker can exploit it with INJECTION COMMANDS in a URI. NOTE: The maintainer and multiple third parties believe that this vulnerability isn't valid because users shouldn't use untrusted templates without sandboxing. >=0
setuptools (transitive) Affected versions of Setuptools allow for remote code execution via its download functions. These functions, which are used to download packages from URLs provided by users or retrieved from package index servers, are susceptible to code injection. If these functions are exposed to user-controlled inputs, such as package URLs, they can execute arbitrary commands on the system. <70.0.0
sqlalchemy Sqlalchemy 2.0.0b1 avoids leaking cleartext passwords to the open for careless uses of str(engine.URL()) in logs and prints. sqlalchemy/sqlalchemy#8563 <2.0.0b1

Outdated dependencies

55 outdated dependencies found (including 20 outdated major versions)😢
Dependency Installed version Latest version
alabaster (transitive) 0.7.16 1.0.0
argon2-cffi (transitive) 21.3.0 23.1.0
billiard (transitive) 3.6.4.0 4.2.1
crispy-bootstrap4 (transitive) 2022.1 2024.10
django 3.2.25 5.1.2
django-model-utils (transitive) 4.3.1 5.0.0
django-rest-knox (transitive) 4.2.0 5.0.2
django-sodar-core 0.13.4 1.0.2
jsonschema-specifications (transitive) 2023.12.1 2024.10.1
markupsafe (transitive) 2.1.5 3.0.2
mistune (transitive) 2.0.5 3.0.2
packaging (transitive) 23.2 24.1
pillow (transitive) 10.4.0 11.0.0
protobuf 3.20.3 5.28.3
setuptools (transitive) 67.6.1 75.2.0
sphinx (transitive) 6.2.1 8.1.3
sphinx-rtd-theme (transitive) 1.2.2 3.0.1
sqlalchemy 1.4.54 2.0.36
unidecode (transitive) 0.4.21 1.3.8
xmlschema (transitive) 2.5.1 3.4.2
Dependency Installed version Latest version
anyio (transitive) 4.6.0 4.6.2.post1
botocore (transitive) 1.35.36 1.35.47
celery (transitive) 5.2.7 5.4.0
charset-normalizer (transitive) 3.3.2 3.4.0
clinvar-this 0.18.2 0.18.3
coverage (dev,transitive) 7.6.1 7.6.4
cryptography (transitive) 43.0.1 43.0.3
django-autocomplete-light (transitive) 3.9.4 3.11.0
django-crispy-forms (transitive) 2.0 2.3
django-db-file-storage (transitive) 0.5.5 0.5.6.1
django-debug-toolbar 4.3.0 4.4.6
django-environ (transitive) 0.10.0 0.11.2
django-iconify (transitive) 0.1.1 0.4
django-plugins-bihealth 0.4.0 0.5.2
django-postgres-copy 2.3.7 2.7.6
djangorestframework (transitive) 3.14.0 3.15.2
docutils (transitive) 0.18.1 0.21.2
drf-keyed-list-bihealth 0.1.1 0.2.1
faker 30.6.0 30.8.0
frozenlist (transitive) 1.4.1 1.5.0
markdown (transitive) 3.4.1 3.7
mypy-protobuf (dev) 3.3.0 3.6.0
psutil 6.0.0 6.1.0
psycopg2 (transitive) 2.9.9 2.9.10
psycopg2-binary (transitive) 2.9.9 2.9.10
pydantic-core (transitive) 2.23.4 2.25.0
requests-http-signature 0.2.0 0.7.1
rich 13.9.2 13.9.3
rules (transitive) 3.3 3.5
trio (dev,transitive) 0.26.2 0.27.0
types-psycopg2 (dev,transitive) 2.9.21.20240819 2.9.21.20241019
versioneer (transitive) 0.28 0.29
wheel (transitive) 0.40.0 0.44.0
xmltodict (transitive) 0.13.0 0.14.2
yarl (transitive) 1.15.5 1.16.0

Logs

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)
backend/seqvars/migrations/0012_auto_20241024_0823.py (1)

46-52: Consider adding database constraints.

The OneToOne relationship with seqvarsquerysettings could benefit from additional database constraints:

  • db_index=True for better query performance
  • help_text for documentation
backend/seqvars/tests/test_models.py (1)

629-656: Consider enhancing test coverage for TestSeqvarsQuerySettingsColumns.

The test class implementation follows the established pattern and provides basic coverage. However, consider adding:

  1. Edge cases for the from_presets method
  2. Tests for invalid preset configurations
  3. Tests for additional attributes beyond just "column_settings"
backend/seqvars/tests/test_serializers.py (1)

1342-1377: Consider adding more test coverage.

The implementation of TestSeqvarsQuerySettingsColumnsSerializer follows the established pattern and correctly tests the basic serialization. However, consider adding tests for:

  1. Validation scenarios
  2. Object creation
  3. Edge cases (e.g., empty column settings)

This would ensure more robust test coverage for the new serializer.

backend/seqvars/tests/test_views_api.py (1)

1871-1872: Fix indentation for consistency

The indentation in line 1872 should be aligned with the closing parenthesis for better readability and consistency with the surrounding code.

Apply this diff to fix the indentation:

            settings["columns"] = SeqvarsQuerySettingsColumnsSerializer(
-                SeqvarsQuerySettingsColumnsFactory.build(querysettings=None)
+                SeqvarsQuerySettingsColumnsFactory.build(querysettings=None)
            ).data

Also applies to: 1945-1945

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7fea8c7 and dada00c.

📒 Files selected for processing (9)
  • backend/seqvars/migrations/0012_auto_20241024_0823.py (1 hunks)
  • backend/seqvars/models/base.py (6 hunks)
  • backend/seqvars/serializers.py (6 hunks)
  • backend/seqvars/tests/factories.py (3 hunks)
  • backend/seqvars/tests/snapshots/snap_test_models.py (2 hunks)
  • backend/seqvars/tests/test_models.py (8 hunks)
  • backend/seqvars/tests/test_permissions_api.py (4 hunks)
  • backend/seqvars/tests/test_serializers.py (7 hunks)
  • backend/seqvars/tests/test_views_api.py (5 hunks)
🔇 Additional comments (27)
backend/seqvars/migrations/0012_auto_20241024_0823.py (3)

17-19: Consider adding a data migration.

The migration removes the columnsconfig field and its associated model. Consider adding a data migration to preserve existing column configuration data by transferring it to the new SeqvarsQuerySettingsColumns model.


59-65: Verify removal of columnsconfig field and model.

This is a breaking change. Ensure that:

  1. All code references to SeqvarsQueryColumnsConfig have been updated
  2. API endpoints are updated to use the new model
  3. Tests are updated to reflect these changes
#!/bin/bash
# Search for any remaining references to the old model and field
echo "Checking for references to removed model..."
rg "SeqvarsQueryColumnsConfig"

echo "Checking for references to removed field..."
rg "columnsconfig.*SeqvarsQuery"

35-44: Verify default column settings configuration.

The column_settings field uses an empty list as default. Ensure this aligns with the application's requirements and won't cause issues with existing functionality.

✅ Verification successful

Let me gather more information about the default column settings by checking the model and test files.


Let me check one more thing to see how the column settings are used in tests and if there are any default configurations defined.


Based on the gathered information, I can now provide the final response:

Empty list default for column_settings is appropriate

The default empty list for column_settings is appropriate because:

  • The model SeqvarsColumnConfigPydantic is well-defined with required fields (name, label) and optional fields (description, width)
  • Test factories demonstrate the expected structure by providing a sample column configuration
  • The serializer tests show that column settings are properly handled when converting to/from JSON
  • No default columns configuration is enforced at the model level, allowing flexibility in different contexts

The empty list default allows the application to:

  1. Initialize new settings without any columns
  2. Add columns explicitly when needed
  3. Maintain consistency with Django's best practices for mutable defaults
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any default column configurations in the codebase
rg -l "SeqvarsColumnConfigPydantic" | xargs rg "default.*columns"

Length of output: 2470


Script:

#!/bin/bash
# Check model definition and tests
echo "=== Checking model definition ==="
rg -A 10 "class SeqvarsColumnConfigPydantic" 

echo -e "\n=== Checking test factory and usage ==="
rg -A 10 "class SeqvarsQuerySettingsColumnsFactory"

Length of output: 1692


Script:

#!/bin/bash
# Check for column settings usage in tests and any default configurations
echo "=== Checking test usage ==="
rg -B 5 -A 10 "column_settings.*=" backend/seqvars/tests/

echo -e "\n=== Checking for default configurations ==="
rg -B 5 -A 10 "DEFAULT.*COLUMNS" backend/seqvars/

Length of output: 5295

backend/seqvars/tests/snapshots/snap_test_models.py (2)

5-5: LGTM!

The GenericRepr import is correctly added and is necessary for the new column settings snapshot test.


22-26: Consider expanding column settings test coverage.

The snapshot only tests a single column configuration ('chromosome'). Consider adding more test cases to cover:

  • Different column types and their specific attributes
  • Edge cases (e.g., columns with null values, different widths)
  • Common column configurations that will be used in the application

Let's check what other column configurations might exist in the codebase:

backend/seqvars/tests/factories.py (4)

38-38: LGTM!

The import of SeqvarsQuerySettingsColumns is correctly placed and necessary for the new factory class.


408-411: LGTM!

The addition of the columns relationship follows the established pattern and maintains consistency with other settings factories.


506-514: LGTM!

The new SeqvarsQuerySettingsColumnsFactory is well-implemented:

  • Follows the established pattern of other settings factories
  • Properly inherits from base factories
  • Includes clear documentation for null prevention
  • Correctly specifies the model in Meta class

Line range hint 1-624: Verify complete removal of old columns config factory.

Let's verify that all references to the old SeqvarsQueryColumnsConfigFactory have been properly removed from the codebase.

✅ Verification successful

The lack of output from the rg command suggests that there are no references to SeqvarsQueryColumnsConfigFactory in the codebase, but let's verify this more thoroughly by searching for partial matches and related patterns.


Based on the search results, I can now generate a final response regarding the removal of the old columns config factory.

No traces of old SeqvarsQueryColumnsConfigFactory found

The search results confirm that the old SeqvarsQueryColumnsConfigFactory has been completely removed from the codebase. The codebase now uses the following new factories for columns-related functionality:

  • ColumnsSettingsBaseFactory (base factory)
  • SeqvarsQueryPresetsColumnsFactory
  • SeqvarsQuerySettingsColumnsFactory
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to the old factory
rg "SeqvarsQueryColumnsConfigFactory" 

Length of output: 37


Script:

#!/bin/bash
# Search for any references containing "ColumnsConfig" or similar patterns
rg -i "columnsconfig"

# Also check for any factory related to columns configuration
rg -i "columns.*factory"

Length of output: 50828

backend/seqvars/tests/test_models.py (2)

29-29: LGTM: Import statements are correctly organized.

The new imports for SeqvarsQuerySettingsColumns model and factory are properly placed in their respective sections.

Also applies to: 56-56


296-296: LGTM: Test count assertions are consistent.

The assertions for SeqvarsQuerySettingsColumns count follow the established pattern and are correctly placed in relevant test methods.

Also applies to: 311-311, 329-329, 342-342

backend/seqvars/serializers.py (2)

869-881: LGTM! Well-structured serializer implementation.

The new SeqvarsQuerySettingsColumnsSerializer follows the established patterns and properly inherits from both base serializers.


950-951: Verify the column settings migration completeness.

The column settings integration looks correct. Let's verify that all references to the old column configuration have been properly migrated.

Also applies to: 1045-1046

✅ Verification successful

Let me gather more context about the references to columnsconfig to ensure they are only in migration files or test files, and not in actual implementation code.

This will help us verify if the remaining references to columnsconfig in serializers.py are part of the migration process or if they indicate incomplete migration.


Let me check if there are any other references to the new columns field in the codebase to ensure the migration is complete.

This will help us verify if the new columns field is properly integrated across the codebase and if there are any inconsistencies in its usage.


Based on the gathered evidence, I can now provide a final response:

Column settings migration is properly implemented

The verification shows that:

  • The old columnsconfig is being properly removed in migration 0012_auto_20241024_0823.py
  • The new columns field is correctly integrated across the codebase:
    • Properly defined in the model with appropriate ForeignKey relationship
    • Correctly serialized in serializers
    • Well-covered in tests with appropriate factory setup
    • The only remaining references to columnsconfig in serializers.py are in the process of being removed by the migration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that old column config references have been removed and new ones added correctly

# Test 1: Check for any remaining references to old column config
echo "Checking for old column config references..."
rg -l "columnsconfig" --type py

# Test 2: Verify new column settings integration
echo "Verifying new column settings integration..."
rg -l "SeqvarsQuerySettingsColumns" --type py

Length of output: 808


Script:

#!/bin/bash
# Check the actual content of files containing columnsconfig references
echo "Checking columnsconfig references in serializers.py..."
rg "columnsconfig" backend/seqvars/serializers.py -C 2

echo -e "\nChecking columnsconfig references in migrations..."
rg "columnsconfig" backend/seqvars/migrations/0012_auto_20241024_0823.py -C 2

Length of output: 934


Script:

#!/bin/bash
# Check references to the new columns field
echo "Checking references to new columns field..."
rg "columns = " backend/seqvars/ -C 2 --type py

echo -e "\nChecking model definition..."
ast-grep --pattern 'class SeqvarsQuery($$$):
    $$$
    columns = $_
    $$$'

Length of output: 5783

backend/seqvars/tests/test_serializers.py (2)

27-27: LGTM: Import statements are properly organized.

The new imports for SeqvarsQuerySettingsColumnsSerializer and SeqvarsQuerySettingsColumnsFactory are correctly placed in alphabetical order within their respective import blocks.

Also applies to: 55-55


971-971: LGTM: QuerySettings serializer tests properly updated.

The columns field is correctly added to both TestSeqvarsQuerySettingsSerializer and TestSeqvarsQuerySettingsDetailsSerializer, following the established pattern for other settings fields. The implementation is consistent with the PR's objective of moving column settings to query settings.

Also applies to: 988-988, 1034-1034, 1066-1066

backend/seqvars/tests/test_permissions_api.py (4)

23-23: LGTM!

The import of SeqvarsQuerySettingsColumnsSerializer is correctly placed and follows the project's naming conventions.


47-47: LGTM!

The import of SeqvarsQuerySettingsColumnsFactory is correctly placed and follows the project's naming conventions.


1798-1800: LGTM!

The addition of columns configuration to the test data follows the established pattern and maintains consistent structure with other settings.


2001-2003: LGTM!

The addition of columns configuration to the query test data follows the established pattern and maintains consistency with the rest of the test suite.

backend/seqvars/tests/test_views_api.py (2)

48-48: LGTM: Import changes for column settings integration

The new imports for SeqvarsQuerySettingsColumnsSerializer and SeqvarsQuerySettingsColumnsFactory are correctly placed and follow the existing import pattern.

Also applies to: 76-76


1692-1694: LGTM: Column settings integration in query settings creation test

The addition of the columns field using SeqvarsQuerySettingsColumnsSerializer and SeqvarsQuerySettingsColumnsFactory follows the established pattern for other settings fields in the test.

backend/seqvars/models/base.py (6)

888-890: LGTM: Consistent addition of SeqvarsQuerySettingsColumns.objects.from_presets

The method from_presets is called with appropriate arguments, aligning with the pattern used for other related records. This ensures that column settings are properly initialized from the presets.


909-909: Added "columns" to _clone_o2o_fields to ensure proper cloning

Including "columns" in the _clone_o2o_fields list guarantees that the columns one-to-one relationship is cloned when cloning SeqvarsQuerySettings. This update maintains consistency with other related fields.


1608-1620: Correct implementation of SeqvarsQuerySettingsColumnsManager and from_presets method

The SeqvarsQuerySettingsColumnsManager class introduces a custom manager with a from_presets method, which appropriately initializes SeqvarsQuerySettingsColumns instances from presets. The method correctly passes querysettings and columnspresets.column_settings to super().create(), consistent with other manager classes.


1623-1635: Proper definition of SeqvarsQuerySettingsColumns model

The SeqvarsQuerySettingsColumns class correctly inherits from model_clone.CloneMixin, SeqvarsColumnsSettingsBase, and BaseModel. The custom manager is assigned to objects, and the querysettings field establishes a one-to-one relationship with SeqvarsQuerySettings using related_name="columns". This setup is consistent with the existing models.


1909-1914: Accurate representation in SeqvarsQuerySettingsColumnsPydantic

The SeqvarsQuerySettingsColumnsPydantic class appropriately models the SeqvarsQuerySettingsColumns data structure. The column_settings field is defined as a list of SeqvarsColumnConfigPydantic, ensuring correct serialization and deserialization of column settings.


1931-1932: Inclusion of columns in SeqvarsCaseQueryPydantic

Adding the optional columns field to SeqvarsCaseQueryPydantic integrates column settings into the case query representation. This change maintains consistency with other query settings and allows for comprehensive query configurations.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91%. Comparing base (5c2cc7f) to head (9590870).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2050   +/-   ##
=====================================
  Coverage     91%     91%           
=====================================
  Files        675     676    +1     
  Lines      38433   38463   +30     
=====================================
+ Hits       35086   35118   +32     
+ Misses      3347    3345    -2     
Files with missing lines Coverage Δ
backend/seqvars/factory_defaults.py 86% <ø> (ø)
...kend/seqvars/migrations/0012_auto_20241024_0823.py 100% <100%> (ø)
backend/seqvars/models/base.py 96% <100%> (+<1%) ⬆️
backend/seqvars/serializers.py 97% <100%> (+<1%) ⬆️
backend/seqvars/tests/factories.py 99% <100%> (+<1%) ⬆️
...vars/tests/snapshots/snap_test_factory_defaults.py 100% <ø> (ø)
...ackend/seqvars/tests/snapshots/snap_test_models.py 100% <100%> (ø)
...end/seqvars/tests/snapshots/snap_test_views_api.py 100% <ø> (ø)
backend/seqvars/tests/test_models.py 100% <100%> (ø)
backend/seqvars/tests/test_permissions_api.py 99% <ø> (ø)
... and 2 more

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 (1)
frontend/src/seqvars/components/QueryResults/QueryResultsTable.vue (1)

Line range hint 432-446: Consider memoizing repeated formatFixedFloat calls.

The template repeatedly calls formatFixedFloat with the same parameters for similar data types (e.g., gnomad frequencies). Consider creating computed properties for these formatted values to improve performance and reduce template complexity.

Example implementation:

+ const formatGnomadFrequency = computed(() => (value: number | null | undefined) => 
+   formatFixedFloat((value ?? 0) * 100.0, { decimal: 2, precision: 2 })
+ )

+ const formatGnomadCount = computed(() => (value: number | null | undefined) => 
+   formatFixedFloat(value ?? 0, { precision: 0, decimal: 4 })
+ )

Then in the template:

- formatFixedFloat(
-   (item.payload?.variant_annotation?.variant?.frequency?.gnomad_exomes?.af ?? 0) * 100.0,
-   { decimal: 2, precision: 2 },
- )
+ formatGnomadFrequency.value(item.payload?.variant_annotation?.variant?.frequency?.gnomad_exomes?.af)

Also applies to: 447-461, 462-476

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between dada00c and 1b69c91.

📒 Files selected for processing (8)
  • backend/varfish/tests/drf_openapi_schema/varfish_api_schema.yaml (7 hunks)
  • frontend/ext/varfish-api/src/lib/schemas.gen.ts (8 hunks)
  • frontend/ext/varfish-api/src/lib/types.gen.ts (7 hunks)
  • frontend/src/seqvars/components/QueryEditor/ColumnsControls.vue (2 hunks)
  • frontend/src/seqvars/components/QueryEditor/QueryEditor.vue (1 hunks)
  • frontend/src/seqvars/components/QueryEditor/groups.ts (2 hunks)
  • frontend/src/seqvars/components/QueryResults/QueryResultsTable.vue (1 hunks)
  • frontend/src/seqvars/queries/seqvarQuery.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
frontend/src/seqvars/components/QueryEditor/QueryEditor.vue (1)
Learnt from: holtgrewe
PR: varfish-org/varfish-server#2046
File: frontend/src/seqvars/components/QueryEditor/QueryEditor.vue:481-496
Timestamp: 2024-10-22T09:14:05.541Z
Learning: In `frontend/src/seqvars/components/QueryEditor/QueryEditor.vue`, when comparing column settings in the `columnsMatchPreset` function, the order of columns is significant and should not be altered. Do not sort the column arrays before comparison because the order matters.
🔇 Additional comments (22)
frontend/src/seqvars/components/QueryEditor/ColumnsControls.vue (2)

68-68: LGTM! Template changes correctly reflect the new data structure.

The v-for directive properly handles the new path to column settings with appropriate null safety.


36-49: Verify consistent usage of the new settings structure across components.

Let's ensure all components have been updated to use the new settings.columns structure instead of columnsconfig.

Also applies to: 68-68

✅ Verification successful

Let me gather more information about the structure and its usage by examining the TypeScript types and related components.


Let me try a different approach to examine the types and usage:


Based on the gathered information, I can now provide a final response:

The changes to settings.columns structure are consistently used across the codebase

The verification shows that:

  • The structure is consistently used in all relevant components (ColumnsControls.vue, QueryResultsTable.vue)
  • The query handling in seqvarQuery.ts properly manages the structure, including proper cloning of column settings
  • There are no references to the old columnsconfig structure, indicating a complete migration
  • The changes are properly integrated with the existing type system as evidenced by the TypeScript files present

The code changes appear to be part of a well-coordinated update to the column settings structure, with all dependent components properly aligned.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to columnsconfig
echo "Checking for potential missed columnsconfig references:"
rg "columnsconfig" frontend/src/seqvars

# Search for components using settings.columns
echo -e "\nVerifying components using the new structure:"
rg "settings\.columns" frontend/src/seqvars

Length of output: 1158


Script:

#!/bin/bash
# Check TypeScript interfaces and types related to this structure
echo "Checking TypeScript interfaces and types:"
rg -t typescript "interface.*Settings|type.*Settings" frontend/src/seqvars

# Look for any potential column configuration in store or state management
echo -e "\nChecking store/state management for column configurations:"
rg "columns.*=|columns:" frontend/src/seqvars/store

# Check for any tests that might reveal expected structure
echo -e "\nChecking tests for column structure usage:"
rg -g "*.spec.*" "columns" frontend/src/seqvars

Length of output: 607


Script:

#!/bin/bash
# Look for type definitions with .ts or .d.ts extensions
echo "Checking for type definitions:"
fd -e ts -e d.ts . frontend/src/seqvars --exec rg -l "interface|type.*Settings"

# Check all usages of settings.columns to understand the structure
echo -e "\nExamining settings.columns usage with context:"
rg -A 5 "settings\.columns" frontend/src/seqvars

# Look for any imports or exports related to these settings
echo -e "\nChecking related imports/exports:"
rg "import.*Settings|export.*Settings" frontend/src/seqvars

Length of output: 3978

frontend/src/seqvars/components/QueryEditor/groups.ts (2)

21-21: LGTM!

The import statement follows the established pattern and is correctly grouped with other control component imports.


180-185: 🛠️ Refactor suggestion

Consider enhancing the column settings comparison.

While the implementation follows the established pattern, consider the following suggestions:

  1. The getCompareFields implementation might need to handle nested properties within column_settings more explicitly, similar to how other groups handle complex fields (e.g., using new Set() for arrays or destructuring specific properties).

  2. Consider if the placement at the end of the GROUPS array is optimal for user experience. The position of this control in the UI might be worth discussing with the UX team.

Let's check if column_settings has nested properties that should be handled explicitly:

Example of a more explicit comparison if nested properties exist:

-    getCompareFields: (v) => [v.column_settings],
+    getCompareFields: (v) => [
+      // Extract specific properties if they exist
+      v.column_settings?.visibility,
+      new Set(v.column_settings?.order ?? []),
+      // Add other relevant properties
+    ],
frontend/src/seqvars/queries/seqvarQuery.ts (2)

Line range hint 229-262: LGTM! Robust implementation of optimistic updates.

The mutation implementation follows best practices:

  • Properly cancels outgoing queries
  • Handles rollback with snapshots
  • Uses appropriate deep merge strategy
  • Includes proper cleanup

233-239: 🛠️ Refactor suggestion

Verify property access path change and add null checks.

The property path change from columnsconfig.column_settings to settings.columns.column_settings is correct. However, consider adding null checks for the intermediate objects to prevent potential runtime errors.

Consider adding null checks:

-if (
-  newValue !== undefined &&
-  data.body.settings.columns.column_settings !== undefined
-) {
+if (
+  newValue !== undefined &&
+  data.body.settings?.columns?.column_settings !== undefined
+) {
   newValue.settings.columns.column_settings = structuredClone(
     toRaw(data.body.settings.columns.column_settings),
   )

Let's verify the property path changes across the codebase:

✅ Verification successful

Let me try a different approach with the shell scripts to verify the property path changes.


Let me try one more time with the correct file type flag.


Property path migration is complete and safe

The search results confirm that:

  1. There are no remaining references to the old .columnsconfig property in the TypeScript files
  2. The new settings.columns structure is only used in seqvarQuery.ts, and it's properly implemented with the deep clone functionality

The original review comment suggesting additional null checks can be considered optional since:

  1. The migration is complete with no legacy references
  2. The current check for data.body.settings.columns.column_settings !== undefined is sufficient as it will throw early if any intermediate object is null/undefined, which is desirable for debugging
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining references to the old columnsconfig property
# to ensure complete migration to the new settings.columns structure

echo "Searching for old 'columnsconfig' references..."
rg -l 'columnsconfig' --type ts --type vue

echo "Searching for new 'settings.columns' structure usage..."
rg -l 'settings\.columns' --type ts --type vue

Length of output: 385


Script:

#!/bin/bash
# Search for old 'columnsconfig' references in TypeScript files
echo "Searching for old 'columnsconfig' references..."
rg -l '\.columnsconfig' --type typescript

# Search for new 'settings.columns' structure usage in TypeScript files
echo "Searching for new 'settings.columns' structure usage..."
rg -l 'settings\.columns' --type typescript

# Get more context around the usage of both patterns
echo -e "\nContext for 'columnsconfig' usage:"
rg '\.columnsconfig' --type typescript -C 2

echo -e "\nContext for 'settings.columns' usage:"
rg 'settings\.columns' --type typescript -C 2

Length of output: 749


Script:

#!/bin/bash
# Search for old 'columnsconfig' references in TypeScript files
echo "Searching for old 'columnsconfig' references..."
rg -l '\.columnsconfig' -t ts

# Search for new 'settings.columns' structure usage in TypeScript files
echo "Searching for new 'settings.columns' structure usage..."
rg -l 'settings\.columns' -t ts

# Get more context around the usage of both patterns
echo -e "\nContext for 'columnsconfig' usage:"
rg '\.columnsconfig' -t ts -C 2

echo -e "\nContext for 'settings.columns' usage:"
rg 'settings\.columns' -t ts -C 2

Length of output: 1439

frontend/src/seqvars/components/QueryResults/QueryResultsTable.vue (2)

Line range hint 824-927: LGTM: Well-organized styling with proper use of SCSS features.

The styling implementation makes good use of SCSS mixins for code reuse and maintains consistency in handling monospaced fonts and text overflow.


Line range hint 157-167: LGTM: Column settings migration looks correct.

The change from columnsconfig to settings.columns.column_settings is implemented correctly with proper null safety checks.

Let's verify that all references to the old columnsconfig have been removed:

✅ Verification successful

Let me gather more information to understand if these remaining references to columnsconfig are related to our changes or if they are part of the API/backend that should remain unchanged.


Let me try different commands to better understand the context of these changes.


Based on the gathered information, I can now provide a final response. The search results show that:

  1. The columnsconfig references in the backend code (backend/) are part of the API/model definitions and are still needed.
  2. The frontend has been properly migrated to use settings.columns.column_settings as shown in:
    • The file under review (QueryResultsTable.vue)
    • Other frontend files like seqvarQuery.ts and ColumnsControls.vue

LGTM: The migration from columnsconfig to settings.columns.column_settings is correctly implemented

The remaining columnsconfig references are in the backend API and model definitions, which is expected as they need to maintain the database schema and API compatibility. The frontend has been properly updated to use the new path settings.columns.column_settings consistently across all relevant components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to columnsconfig
# Expect: No occurrences of columnsconfig in the codebase

rg "columnsconfig" -g '!*.{md,txt}'

Length of output: 1864


Script:

#!/bin/bash
# Check the actual model definition to understand the relationship
ast-grep --pattern 'class SeqvarsQuery'

Length of output: 41


Script:

#!/bin/bash
# Check for any recent changes related to columnsconfig
git log -p --grep="columnsconfig"

Length of output: 33


Script:

#!/bin/bash
# Check the specific file we're reviewing for any other columnsconfig references
rg "columnsconfig" frontend/src/seqvars/components/QueryResults/QueryResultsTable.vue

Length of output: 85


Script:

#!/bin/bash
# Check the model definition in Python files
rg "class SeqvarsQuery" -A 10 backend/seqvars/

# Check for any recent changes in the specific component
git log -p frontend/src/seqvars/components/QueryResults/QueryResultsTable.vue

# Look for any other frontend files that might be using the new settings.columns structure
rg "settings\.columns\.column_settings" frontend/

Length of output: 113784

frontend/ext/varfish-api/src/lib/types.gen.ts (4)

1966-1974: LGTM: Well-structured column configuration type definition

The new SeqvarsColumnConfigPydantic type is well-defined with clear and descriptive fields:

  • name and label as required string fields
  • Optional description, width, and visible fields with appropriate types

2728-2751: LGTM: Comprehensive column settings integration

The SeqvarsQuerySettingsColumns type and its related types are properly integrated into the query settings structure:

  • Includes proper readonly fields for tracking (sodar_uuid, date_created, date_modified)
  • Maintains relationship with query settings via querysettings field
  • Provides both full and request versions of the type

1459-1459: LGTM: Column settings properly added to query settings

The columns field is correctly added to PatchedSeqvarsQuerySettingsDetailsRequest, maintaining consistency with the refactoring goal of moving column settings into query settings.


Line range hint 1-3500: Verify removal of old column configuration types

Let's confirm that the old column configuration types have been completely removed.

✅ Verification successful

Let me analyze the output more carefully to verify the changes to column configuration types.

The search results show:

  1. The only remaining references to columnsconfig are in the generated types and schemas:

    • types.gen.ts: Two occurrences as a readonly string field
    • schemas.gen.ts: Two occurrences in schema definitions
  2. No occurrences of SeqvarsQueryColumnsConfig were found

  3. No other *ColumnsConfig types were found in the codebase

Let me verify if these remaining columnsconfig references are part of the new design or leftovers.


Based on the context, I can now provide a final assessment.

The old column configuration types have been properly removed and replaced

The remaining columnsconfig references are part of the new design where:

  1. It appears as a readonly string field (UUID reference) in the base types:

    • SeqvarsQuery.columnsconfig
    • SeqvarsQueryDetails.columnsconfig
  2. The actual column configuration functionality has been moved to the new types:

    • SeqvarsColumnConfigPydantic
    • SeqvarsQuerySettingsColumns
    • SeqvarsQueryPresetsColumns

The old SeqvarsQueryColumnsConfig type has been completely removed and replaced with the new column configuration system. The remaining columnsconfig string fields are just UUID references in the API types, which is the expected pattern for the new design.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining references to old column configuration types
# Test: Expect no matches for old types that should have been removed

echo "Searching for old columnsconfig references..."
rg "columnsconfig|SeqvarsQueryColumnsConfig" --type ts

echo "Searching for any potentially missed column configuration types..."
rg "ColumnsConfig" --type ts

Length of output: 957


Script:

#!/bin/bash
# Check the context of columnsconfig usage to understand if it's part of new design
echo "Checking columnsconfig context in types.gen.ts..."
rg -A 10 -B 10 "columnsconfig" frontend/ext/varfish-api/src/lib/types.gen.ts

echo -e "\nChecking columnsconfig context in schemas.gen.ts..."
rg -A 10 -B 10 "columnsconfig" frontend/ext/varfish-api/src/lib/schemas.gen.ts

Length of output: 2915

backend/varfish/tests/drf_openapi_schema/varfish_api_schema.yaml (3)

8792-8793: LGTM: Column settings field added to query settings request

The addition of the columns field to PatchedSeqvarsQuerySettingsDetailsRequest aligns with the refactoring goal of moving column settings into query settings.


11985-11988: LGTM: Column settings field added to query settings model

The addition of the columns field to SeqvarsQuerySettings completes the integration of column configuration into the query settings model.


12078-12121: LGTM: Column settings schema definitions

The new schema definitions for SeqvarsQuerySettingsColumns and related models provide a clean structure for column configuration with:

  • Column settings list
  • Individual column config with name, label, description
  • Proper UUID and timestamp tracking
frontend/ext/varfish-api/src/lib/schemas.gen.ts (7)

5900-5937: Well-structured definition of $SeqvarsColumnConfigPydantic

The new schema $SeqvarsColumnConfigPydantic is well-defined with appropriate property types and default values. The use of required fields for name and label ensures essential information is provided.


8750-8779: Well-defined schema for $SeqvarsQuerySettingsColumns

The new schema $SeqvarsQuerySettingsColumns appropriately encapsulates the column settings, and the properties are correctly referenced. The inclusion of sodar_uuid, date_created, and date_modified ensures consistency with other models.


8781-8796: Accurate Pydantic model for $SeqvarsQuerySettingsColumnsPydantic

The Pydantic representation $SeqvarsQuerySettingsColumnsPydantic is correctly structured, matching the corresponding schema, and will facilitate accurate data validation and serialization.


8797-8805: Consistent request schema for $SeqvarsQuerySettingsColumnsRequest

The request schema $SeqvarsQuerySettingsColumnsRequest properly references the SeqvarsColumnConfigPydanticList and aligns with the overall design. This ensures that request payloads are validated against the expected structure.


9143-9144: Include 'columns' property in the request schema

The columns property is added to the $SeqvarsQuerySettingsDetailsRequest schema. Ensure that this addition aligns with the backend expectations for handling this property in the request payload.

Confirm that the backend is prepared to handle the columns property in request payloads. If necessary, update the backend implementation to support this property.


9039-9040: ⚠️ Potential issue

Add 'columns' to the 'required' array

In the $SeqvarsQuerySettingsDetails schema, the columns property has been added. If columns is a required field, please include it in the required array to ensure proper validation.

Apply this diff to include columns in the required array:

     },
     required: ['clinvar', 'columns', 'consequence', 'date_created', 'date_modified', 'frequency', 'genotype', 'locus', 'phenotypeprio', 'predefinedquery', 'presetssetversion', 'quality', 'session', 'sodar_uuid', 'variantprio']
+    , 'columns'
 } as const;

Likely invalid or redundant comment.


6682-6684: ⚠️ Potential issue

Remove deprecated columnsconfig property

The columnsconfig property is included in the $SeqvarsQueryDetails schema. According to the PR objectives and AI summary, the columnsconfig field has been removed from the SeqvarsQuery model. This property should be removed from the schema to reflect the updated model.

Apply this diff to remove the columnsconfig property:

     },
     settings: {
         '$ref': '#/components/schemas/SeqvarsQuerySettingsDetails'
     },
-    columnsconfig: {
-        type: 'string',
-        readOnly: true
-    }
 } as const;

Likely invalid or redundant comment.

Comment on lines +36 to +49
settings: {
...props.modelValue.settings,
columns: {
...props.modelValue.settings.columns,
column_settings: (
props.modelValue.settings.columns.column_settings || []
).map((column) => {
const res = {
...column,
visible: data.name === column.name ? data.visible : column.visible,
}
return res
}),
},
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

Consider enhancing type safety and code organization.

The mutation logic correctly implements the new structure, but could benefit from:

  1. Explicit TypeScript types for the nested settings structure
  2. Extracting the column settings update logic into a separate function for better maintainability

Consider applying this refactor:

interface ColumnSetting {
  name: string
  label: string
  visible: boolean
}

interface QuerySettings {
  columns: {
    column_settings: ColumnSetting[]
  }
}

const updateColumnVisibility = (
  settings: QuerySettings,
  name: string,
  visible: boolean
): QuerySettings => ({
  ...settings,
  columns: {
    ...settings.columns,
    column_settings: (settings.columns.column_settings || []).map((column) => ({
      ...column,
      visible: name === column.name ? visible : column.visible,
    })),
  },
})

// Usage in applyMutation
const newData = {
  ...props.modelValue,
  settings: updateColumnVisibility(
    props.modelValue.settings,
    data.name,
    data.visible
  ),
}

Comment on lines +4459 to +4461
},
columns: {
'$ref': '#/components/schemas/SeqvarsQuerySettingsColumnsRequest'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add 'columns' to the 'required' array

You have added the columns property to the $PatchedSeqvarsQuerySettingsDetailsRequest schema. If columns is intended to be a required field, please include it in the required array to ensure proper validation.

Apply this diff to include columns in the required array:

     },
     required: ['genotype', 'quality', 'consequence', 'locus', 'frequency', 'phenotypeprio', 'variantprio']
+    , 'columns'
 } as const;

Committable suggestion was skipped due to low confidence.

Comment on lines +8658 to +8661
columns: {
type: 'string',
format: 'uuid',
readOnly: true
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Include 'columns' in the 'required' array

The columns property has been added to the $SeqvarsQuerySettings schema. If this property is required, please add it to the required array to ensure it is validated correctly.

Apply this diff to include columns in the required array:

     },
     required: ['clinvar', 'clinvarpresets', 'consequence', 'consequencepresets', 'date_created', 'date_modified', 'frequency', 'frequencypresets', 'genotype', 'locus', 'locuspresets', 'phenotypeprio', 'phenotypepriopresets', 'quality', 'qualitypresets', 'session', 'sodar_uuid', 'variantprio', 'variantpriopresets']
+    , 'columns'
 } as const;

Committable suggestion was skipped due to low confidence.

@holtgrewe holtgrewe enabled auto-merge (squash) October 24, 2024 12:48
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 UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4718d8e and c3d71ca.

📒 Files selected for processing (1)
  • frontend/src/seqvars/components/QueryEditor/QueryEditor.vue (2 hunks)
🧰 Additional context used
📓 Learnings (1)
frontend/src/seqvars/components/QueryEditor/QueryEditor.vue (1)
Learnt from: holtgrewe
PR: varfish-org/varfish-server#2046
File: frontend/src/seqvars/components/QueryEditor/QueryEditor.vue:481-496
Timestamp: 2024-10-22T09:14:05.541Z
Learning: In `frontend/src/seqvars/components/QueryEditor/QueryEditor.vue`, when comparing column settings in the `columnsMatchPreset` function, the order of columns is significant and should not be altered. Do not sort the column arrays before comparison because the order matters.
🔇 Additional comments (1)
frontend/src/seqvars/components/QueryEditor/QueryEditor.vue (1)

Line range hint 1-24: Verify complete removal of column management code.

Let's verify that all column-related code has been properly cleaned up across the codebase.

✅ Verification successful

Let me analyze the results and generate a final response.

The search results show that:

  1. No references to the removed column management methods (columnsMatchPreset, revertColumnsToPresets, collapsibleGroupOpenColumns) were found in the codebase.

  2. The column-related code that still exists is primarily in:

    • Backend API types and schemas (frontend/ext/varfish-api/src/lib/types.gen.ts)
    • Backend models and serializers (backend/seqvars/)
    • A single frontend component CategoryPresetsColumnsEditor.vue

These findings indicate that the column management code has been properly cleaned up in the QueryEditor.vue component and its related files. The remaining column-related code is part of the API contract and the presets management system, which is expected and correct.

Column management code has been properly removed

The refactoring appears to have been done correctly. The remaining column-related code is part of the core API types and presets management system, which is separate from the removed column management functionality in the query editor.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to removed column management functionality

# Test 1: Search for references to removed column methods
echo "Searching for references to removed column methods..."
rg -i "columnsMatchPreset|revertColumnsToPresets|collapsibleGroupOpenColumns"

# Test 2: Search for any remaining column-related components
echo "Searching for column-related components..."
rg -i "columns?(config|settings|preset)"

# Test 3: Search for column-related imports
echo "Searching for column-related imports..."
ast-grep --pattern 'import { $_ } from $path' | rg -i "columns?"

Length of output: 19906

@@ -553,6 +495,7 @@ const collapsibleGroupOpenGeneric = ref<Record<QueryKey, boolean>>({
phenotypeprio: true,
variantprio: true,
clinvar: true,
columns: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove unused column-related UI state.

The columns: true entry in collapsibleGroupOpenGeneric appears to be a remnant of the old column management functionality. Since column settings have been moved to query settings, this UI state is no longer needed.

Apply this diff to remove the unused state:

-  columns: true,
📝 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
columns: true,

@holtgrewe holtgrewe merged commit 06ada76 into main Oct 24, 2024
16 checks passed
@holtgrewe holtgrewe deleted the 2042-move-column-settings-from-seqvarsquery-to-seqvarsquerysettings branch October 24, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move column settings from SeqvarsQuery to SeqvarsQuerySettings
1 participant