Actin 2295: Replace scoreValue/scoreValuePrefix with scoreLowerBound/scoreUpperBound #1504
Actin 2295: Replace scoreValue/scoreValuePrefix with scoreLowerBound/scoreUpperBound #1504ayaahmedhmf wants to merge 6 commits intomasterfrom
Conversation
…ate test fixtures
…LowerBound/scoreUpperBound in schema and DAO
…s instead of single value
| private fun formatBounds(test: IhcTest) = when { | ||
| test.scoreLowerBound == test.scoreUpperBound -> "${test.scoreLowerBound}" | ||
| test.scoreLowerBound != null && test.scoreUpperBound != null -> "${test.scoreLowerBound}-${test.scoreUpperBound}" | ||
| else -> test.scoreLowerBound?.let { "> $it" } ?: test.scoreUpperBound?.let { "< $it" } |
There was a problem hiding this comment.
Should this be ">=" and "<="? I thought the range was inclusive.
| when (roundedScoreLowerBound == roundedScoreUpperBound && roundedScoreLowerBound == referenceExpressionLevel) { | ||
| true -> EvaluationResult.PASS | ||
| false -> EvaluationResult.FAIL | ||
| } |
There was a problem hiding this comment.
Could use if instead of when.
| private fun ihcTest( | ||
| scoreValue: Double? = null, | ||
| scoreLowerBound: Double? = null, | ||
| scoreUpperBound: Double? = scoreLowerBound, |
There was a problem hiding this comment.
Defaulting this to scoreLowerBound is somewhat surprising. What do you think about adding a score parameter that is the default for both bounds?
| listOf(IhcTest("HER2", scoreLowerBound = 1.0, scoreUpperBound = 1.0, scoreValueUnit = "+")), | ||
| ReceptorType.HER2 |
There was a problem hiding this comment.
Should be ER according to test name?
|
|
||
| private fun createIhcTest( | ||
| item: String, scoreText: String = "Score", scoreValue: Double = 50.0, scoreValueUnit: String = "Unit" | ||
| item: String, scoreText: String = "Score", scoreLowerBound: Double = 50.0, scoreUpperBound: Double = scoreLowerBound, scoreValueUnit: String = "Unit" |
There was a problem hiding this comment.
Again, I think it's a bit surprising to set the upper bound to the lower bound by default.
| item = item, scoreText = scoreText, scoreLowerBound = scoreLowerBound, scoreUpperBound = scoreUpperBound, | ||
| scoreValueUnit = scoreValueUnit, impliesPotentialIndeterminateStatus = false |
There was a problem hiding this comment.
If all arguments can't fit on the same line, then each should have its own line.
|
|
||
| private fun createIhcTest( | ||
| item: String, scoreText: String = "Score", scoreValue: Double = 50.0, scoreValueUnit: String = "Unit" | ||
| item: String, scoreText: String = "Score", scoreLowerBound: Double = 50.0, scoreUpperBound: Double = scoreLowerBound, scoreValueUnit: String = "Unit" |
There was a problem hiding this comment.
I'll stop repeating myself. Maybe we could provide this functionality for all test classes with a shared TestIhcTestFactory?
| formattedLowerValue.isNotEmpty() -> "> $formattedLowerValue" | ||
| formattedUpperValue.isNotEmpty() -> "< $formattedUpperValue" |
There was a problem hiding this comment.
Are the bounds included in the range? If not, then cases where lower == upper imply an empty range.
| val formattedLowerValue = valueTest.scoreLowerBound?.let(Formats::twoDigitNumber).orEmpty() | ||
| val formattedUpperValue = valueTest.scoreUpperBound?.let(Formats::twoDigitNumber).orEmpty() |
There was a problem hiding this comment.
Why orEmpty() here? It seems like it would be easier to just do null checks below since we never use the empty string.
|
|
||
| fun evaluateBoundsVersusMinValue(lowerBound: Double?, upperBound: Double?, minValue: Double): EvaluationResult = | ||
| lowerBound?.takeIf { it >= minValue }?.let { PASS } | ||
| ?: upperBound?.takeIf { it < minValue }?.let { FAIL } |
There was a problem hiding this comment.
This makes sense if the range of included values includes the bounds. If the bounds are excluded, then an upper bound equal to the min value should also lead to FAIL since the true value could not equal the min.
Notes
Summary
scoreValueandscoreValuePrefixwithscoreLowerBoundandscoreUpperBoundin algo evaluation functions, database schema, and report formattingValueComparisonwith new bounds-based helpers (evaluateBoundsVersusMinValue,evaluateBoundsVersusMaxValue)ihcTesttable) andClinicalDAOto read/write new columnsIhcTestInterpreterto format score bounds as ranges in reports