From 6e9850c4923919e3df8bc40e8b3c1f89d92857a9 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Thu, 16 Nov 2023 15:26:53 +0530 Subject: [PATCH] add variable thresholds paramters across devices --- .../hpostesting/data/constant/Constants.kt | 15 +++++++++++++++ .../presentation/hemocube/HemoCubeFragment.kt | 16 ++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt index 0de92e7..df6acee 100644 --- a/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt +++ b/app/src/main/java/com/example/hpostesting/data/constant/Constants.kt @@ -92,4 +92,19 @@ object Constants { listOf(1.0, 0.0) // LED4 ), ) + + val BUFFER_INTENSITY_THRESHOLDS: Map>> = mapOf>>( + "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), + ) + ) } \ No newline at end of file diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt index bf6e7bf..a673e16 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeFragment.kt @@ -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 {