Skip to content

Commit e1d46f9

Browse files
committed
Add title field to ScoreRanges
1 parent 521a352 commit e1d46f9

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/mavedb/view_models/score_range.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ScoreRange(SavedScoreRange):
8787

8888

8989
class ScoreRangesBase(BaseModel):
90+
title: str = "Score Ranges"
9091
ranges: Sequence[ScoreRangeBase]
9192
research_use_only: bool = False
9293
source: Optional[Sequence[PublicationIdentifierBase]] = None
@@ -194,6 +195,7 @@ class InvestigatorScoreRange(ScoreRange, SavedInvestigatorScoreRange):
194195

195196

196197
class InvestigatorScoreRangesBase(ScoreRangesBase):
198+
title: str = "Investigator-provided functional classes"
197199
baseline_score: Optional[float] = None
198200
baseline_score_description: Optional[str] = None
199201
ranges: Sequence[InvestigatorScoreRangeBase]
@@ -313,6 +315,7 @@ class ZeibergCalibrationParameterSet(BaseModel):
313315

314316

315317
class ZeibergCalibrationScoreRangesBase(ScoreRangesBase):
318+
title: str = "Zeiberg calibration"
316319
prior_probability_pathogenicity: Optional[float] = None
317320
parameter_sets: list[ZeibergCalibrationParameterSet] = []
318321
ranges: Sequence[ZeibergCalibrationScoreRangeBase]

tests/helpers/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,7 @@
16011601
TEST_SCORE_SET_ABNORMAL_RANGE,
16021602
],
16031603
"research_use_only": False,
1604+
"title": "Test Base Ranges",
16041605
"source": None,
16051606
}
16061607

@@ -1612,6 +1613,7 @@
16121613
TEST_SCORE_SET_ABNORMAL_RANGE,
16131614
],
16141615
"research_use_only": False,
1616+
"title": "Test Base Ranges with Source",
16151617
"source": [{"identifier": TEST_PUBMED_IDENTIFIER, "db_name": "PubMed"}],
16161618
}
16171619

@@ -1663,6 +1665,7 @@
16631665
TEST_INVESTIGATOR_PROVIDED_SCORE_SET_NOT_SPECIFIED_RANGE,
16641666
],
16651667
"research_use_only": False,
1668+
"title": "Test Investigator-provided Functional Ranges",
16661669
"odds_path_source": [{"identifier": TEST_PUBMED_IDENTIFIER, "db_name": "PubMed"}],
16671670
"source": None,
16681671
}
@@ -1677,6 +1680,7 @@
16771680
TEST_SAVED_INVESTIGATOR_PROVIDED_SCORE_SET_NOT_SPECIFIED_RANGE,
16781681
],
16791682
"researchUseOnly": False,
1683+
"title": "Test Investigator-provided Functional Ranges",
16801684
"oddsPathSource": [{"identifier": TEST_PUBMED_IDENTIFIER, "dbName": "PubMed"}],
16811685
"source": None,
16821686
}
@@ -1876,6 +1880,7 @@
18761880
TEST_ZEIBERG_CALIBRATION_SCORE_SET_PS3_VERY_STRONG_RANGE,
18771881
],
18781882
"research_use_only": True,
1883+
"title": "Test Zeiberg Calibration",
18791884
"parameter_sets": TEST_ZEIBERG_CALIBRATION_PARAMETER_SETS,
18801885
"prior_probability_pathogenicity": 0.20,
18811886
"source": None,
@@ -1895,6 +1900,7 @@
18951900
TEST_ZEIBERG_CALIBRATION_SAVED_SCORE_SET_PS3_VERY_STRONG_RANGE,
18961901
],
18971902
"researchUseOnly": True,
1903+
"title": "Test Zeiberg Calibration",
18981904
"parameterSets": TEST_SAVED_ZEIBERG_CALIBRATION_PARAMETER_SETS,
18991905
"priorProbabilityPathogenicity": 0.20,
19001906
}

tests/view_models/test_score_range.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ def test_score_ranges_investigator_valid_range(ScoreRangesModel, score_ranges_da
361361
assert score_ranges.ranges is not None, "Ranges should not be None"
362362
assert score_ranges.baseline_score == TEST_BASELINE_SCORE, "Baseline score should match"
363363
assert score_ranges.research_use_only is False, "Research use only should be False for invesitigator provided"
364+
assert score_ranges.title == score_ranges_data.get("title", None), "Title should match"
364365
assert matched_odds_source == score_ranges_data.get("odds_path_source", None), "Odds path source should match"
365366
assert matched_source == score_ranges_data.get("source", None), "Source should match"
366367

@@ -386,6 +387,7 @@ def test_score_ranges_zeiberg_calibration_valid_range(ScoreRangesModel, score_ra
386387
), "Prior probability pathogenicity should match"
387388
assert score_ranges.parameter_sets is not None, "Parameter sets should not be None"
388389
assert score_ranges.research_use_only is True, "Research use only should be True for zeiberg calibration"
390+
assert score_ranges.title == score_ranges_data.get("title", None), "Title should match"
389391
assert matched_source == score_ranges_data.get("source", None), "Source should match"
390392

391393

0 commit comments

Comments
 (0)