add borderline metric
This commit is contained in:
@@ -738,6 +738,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
|
val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
|
||||||
val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
|
val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
|
||||||
val deviceRatio = led2Average / led1Average
|
val deviceRatio = led2Average / led1Average
|
||||||
|
val borderlineMetric = (led1Average - led2Average) / deviceRatio
|
||||||
|
|
||||||
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
|
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
|
||||||
?.get(0)!!
|
?.get(0)!!
|
||||||
@@ -883,7 +884,11 @@ class HemoCubeFragment : Fragment() {
|
|||||||
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
|
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
|
||||||
this.deviceRatioClass = deviceRatioClassification(deviceRatio)
|
this.deviceRatioClass = deviceRatioClassification(deviceRatio)
|
||||||
this.slopeRatioClass = slopeClass
|
this.slopeRatioClass = slopeClass
|
||||||
this.classificationResult = deviceRatioClass
|
this.classificationResult = findResultWithAdditionalMethods(
|
||||||
|
deviceRatio,
|
||||||
|
deviceRatioClass,
|
||||||
|
borderlineMetric
|
||||||
|
)
|
||||||
hemoCubeViewModel.messages.postValue(
|
hemoCubeViewModel.messages.postValue(
|
||||||
"${this.classificationResult} \n Device Ratio: ${
|
"${this.classificationResult} \n Device Ratio: ${
|
||||||
"%.3f".format(
|
"%.3f".format(
|
||||||
@@ -927,14 +932,22 @@ class HemoCubeFragment : Fragment() {
|
|||||||
fun findResultWithAdditionalMethods(
|
fun findResultWithAdditionalMethods(
|
||||||
deviceRatio: Double?,
|
deviceRatio: Double?,
|
||||||
deviceRatioClass: String?,
|
deviceRatioClass: String?,
|
||||||
slopeRatio: Double?,
|
borderlineMetric: Double?,
|
||||||
): String {
|
): String {
|
||||||
try {
|
try {
|
||||||
// hemoCubeViewModel.messages.postValue("post classification checks")
|
// hemoCubeViewModel.messages.postValue("post classification checks")
|
||||||
if (deviceRatio != null) {
|
if (deviceRatio != null && borderlineMetric != null) {
|
||||||
if (slopeRatio != null) {
|
if (deviceRatioClass == "Negative Borderline") {
|
||||||
if (deviceRatioClass == "Normal" && slopeRatio > 45.0)
|
return if (borderlineMetric >= 2.4)
|
||||||
return "Negative Borderline, Repeat Test"
|
"Borderline. Normal"
|
||||||
|
else
|
||||||
|
"Borderline. Sickle Cell Trait"
|
||||||
|
}
|
||||||
|
if (deviceRatioClass == "Positive for Sickle Cell. HPLC for Confirmation") {
|
||||||
|
return if (borderlineMetric >= 1.34)
|
||||||
|
"Borderline. Sickle Cell Trait"
|
||||||
|
else
|
||||||
|
"Borderline. Sickle Cell Disease"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -953,9 +966,9 @@ class HemoCubeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
if (ratio in 0.22..0.24)
|
if (ratio in 0.22..0.24)
|
||||||
return "Negative Borderline"
|
return "Negative Borderline"
|
||||||
if (ratio in 0.24..0.32)
|
if (ratio in 0.24..0.31)
|
||||||
return "Sickle Cell Trait"
|
return "Sickle Cell Trait"
|
||||||
if (ratio in 0.32..0.37)
|
if (ratio in 0.31..0.37)
|
||||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||||
if (ratio in 0.37..0.56)
|
if (ratio in 0.37..0.56)
|
||||||
return "Sickle Cell Disease"
|
return "Sickle Cell Disease"
|
||||||
|
|||||||
@@ -359,10 +359,31 @@ class HemoCubeFragmentTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun findResultWithAdditionalMethods_ValidInput_ReturnsNegativeBorderlineRepeatTest() {
|
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineNormal() {
|
||||||
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
|
||||||
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.5)
|
||||||
assertEquals("Negative Borderline, Repeat Test", result)
|
assertEquals("Borderline. Normal", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait1() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.2)
|
||||||
|
assertEquals("Borderline. Sickle Cell Trait", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait2() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Positive for Sickle Cell. HPLC for Confirmation", 1.35)
|
||||||
|
assertEquals("Borderline. Sickle Cell Trait", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellDisease() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Positive for Sickle Cell. HPLC for Confirmation", 1.33)
|
||||||
|
assertEquals("Borderline. Sickle Cell Disease", result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -389,8 +410,8 @@ class HemoCubeFragmentTest {
|
|||||||
@Test
|
@Test
|
||||||
fun findResultWithAdditionalMethods_PBL_ReturnsPBL() {
|
fun findResultWithAdditionalMethods_PBL_ReturnsPBL() {
|
||||||
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
|
||||||
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Positive for Sickle Cell. HPLC for Confirmation", 70.0)
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Positive for Sickle Cell. HPLC for Confirmation", 1.35)
|
||||||
assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result)
|
assertEquals("Borderline. Sickle Cell Trait", result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user