add variable thresholds paramters across devices

This commit is contained in:
Pritimay Sarkar
2023-11-16 15:26:53 +05:30
parent a7a57c7ff4
commit 6e9850c492
2 changed files with 23 additions and 8 deletions

View File

@@ -92,4 +92,19 @@ object Constants {
listOf(1.0, 0.0) // LED4
),
)
val BUFFER_INTENSITY_THRESHOLDS: Map<String, List<List<Int>>> = mapOf<String, List<List<Int>>>(
"HCV-000-3001" to listOf(
listOf(24000, 24500),
listOf(21000, 24500),
listOf(21000, 24500),
listOf(21000, 24500),
),
"HCV-000-3002" to listOf(
listOf(21000, 24500),
listOf(21000, 24500),
listOf(21000, 24500),
listOf(21000, 24500),
)
)
}

View File

@@ -417,10 +417,10 @@ class HemoCubeFragment : Fragment() {
val led4Average = log10(led4BufferForDevice?.div(led4SampleForDevice!!) ?: 0.0)
val deviceRatio = led3Average / led1Average
if (led1BufferForDevice < Constants.BUFFER_LED_LOWER_BOUND
|| led2BufferForDevice < Constants.BUFFER_LED_LOWER_BOUND
|| led3BufferForDevice < Constants.BUFFER_LED_LOWER_BOUND
|| led4BufferForDevice < Constants.BUFFER_LED_LOWER_BOUND
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)?.get(0)!!
|| led2BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(1)?.get(0)!!
|| led3BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(2)?.get(0)!!
|| led4BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(3)?.get(0)!!
) {
validationError = true
activity?.runOnUiThread {
@@ -429,10 +429,10 @@ class HemoCubeFragment : Fragment() {
}
}
if (led1BufferForDevice > Constants.BUFFER_LED_UPPER_BOUND
|| led2BufferForDevice > Constants.BUFFER_LED_UPPER_BOUND
|| led3BufferForDevice > Constants.BUFFER_LED_UPPER_BOUND
|| led4BufferForDevice > Constants.BUFFER_LED_UPPER_BOUND
if (led1BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)?.get(1)!!
|| led2BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(1)?.get(1)!!
|| led3BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(2)?.get(1)!!
|| led4BufferForDevice > Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(3)?.get(1)!!
) {
validationError = true
activity?.runOnUiThread {