Skip to content

Conversation

@bencap
Copy link
Collaborator

@bencap bencap commented Oct 20, 2025

This pull request introduces a major refactor of how score calibrations and functional ranges are handled in the database and application logic. The changes migrate from storing score ranges directly on ScoreSet objects to a new, dedicated score_calibrations table, update related migration scripts, and improve the logic for variant classification using these calibrations. Additionally, new ACMG classification utilities are introduced.

Database schema migrations and refactoring:

  • Added a new Alembic migration to create the score_calibrations and score_calibration_publication_identifiers tables, and migrated existing score range data from ScoreSet to this new structure. (alembic/versions/002f6f9ec7ac_add_score_calibration_table.py)
  • Removed the score_ranges property from the scoresets table and provided a downgrade path to restore it if needed. (alembic/versions/f5a72192fafd_remove_score_range_property_from_score_.py)
  • Modified the score_calibrations table to remove the name column and add a notes column, updating the schema for future flexibility. (alembic/versions/8886f0453125_remove_name_add_notes_to_calibrations.py)

Application logic and classification improvements:

  • Refactored variant functional and pathogenicity classification logic to use the new score_calibrations structure and its functional_ranges, replacing prior logic that relied on score_ranges on ScoreSet. This includes renaming and updating the main classification functions and ensuring robust error handling when calibrations are missing. (src/mavedb/lib/annotation/classification.py) [1] [2] [3]

New utilities for ACMG classification:

  • Introduced a new module for ACMG criterion and evidence strength enums, as well as a utility function to infer ACMG evidence strength from point values, supporting future clinical classification features. (src/mavedb/lib/acmg.py)

bencap added 4 commits October 6, 2025 13:40
Adds a standalone score calibration model to replace the `score_ranges` property of score sets.
This model better supports generically typed score ranges, publication identifiers directly associated with score ranges and odds paths provided independently of functional classes.
@bencap bencap force-pushed the feature/bencap/518/generic-score-range-entries branch from c67dda6 to 00602eb Compare November 5, 2025 02:24
@bencap
Copy link
Collaborator Author

bencap commented Nov 5, 2025

DB Migration steps for this branch

Checkout the commit 129d7daefb0c18d0f70f20ee633cb17a02a3cc37 and upgrade to the alembic head.

git checkout 129d7daefb0c18d0f70f20ee633cb17a02a3cc37
DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=postgres DB_PASSWORD=XXX poetry run alembic upgrade head

Run the manual migration

DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=postgres DB_PASSWORD=XXX poetry run python3 alembic/manual_migrations/migrate_score_ranges_to_calibrations.py

Checkout the commit 3da28919a6f6173ad0d65c768b172dfffbf730fc and upgrade to the alembic head.

git checkout 3da28919a6f6173ad0d65c768b172dfffbf730fc
DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=postgres DB_PASSWORD=XXX poetry run alembic upgrade head

Checkout the head commit at main and upgrade to the alembic head

git checkout main
DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=postgres DB_PASSWORD=XXX poetry run alembic upgrade head

@bencap bencap linked an issue Nov 8, 2025 that may be closed by this pull request
bencap and others added 9 commits November 10, 2025 09:16
- Refactored score range jsonb in score sets into a separate data model with db tables and publication associations
- Removed tests related to score ranges and replaced them with tests for score calibrations.
- Updated test cases to validate the creation of score sets with investigator-provided calibrations.
- Ensured that score set creation fails when non-investigator provided calibrations are included.
- Adjusted error assertions to reflect changes in validation logic for score calibrations.
bencap and others added 5 commits November 10, 2025 09:16
- Removed the `investigator_provided` field from `ScoreCalibrationBase` and adjusted related validation logic.
- Updated `SavedScoreCalibration` to include `investigator_provided` as a boolean field.
- Modified validation error messages to include specific locations in the request body.
- Changed references from `InvestigatorProvidedScoreCalibrationCreate` to `ScoreCalibrationCreate` in `ScoreSetCreate`.
- Updated test constants and removed unnecessary test cases related to `investigator_provided`.
- Enhanced tests for creating score calibrations to ensure correct behavior for investigator-provided settings.
- Adjusted tests to reflect changes in the model structure and validation logic.
@bencap bencap force-pushed the feature/bencap/518/generic-score-range-entries branch from 31e69c7 to a04ccb0 Compare November 10, 2025 17:16
@bencap bencap merged commit 9acd4a4 into release-2025.5.0 Nov 11, 2025
6 checks passed
@bencap bencap deleted the feature/bencap/518/generic-score-range-entries branch November 11, 2025 18:11
This was referenced Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment