show device ratio class with new thresholds

This commit is contained in:
Pritimay Sarkar
2024-01-14 14:02:33 +05:30
parent 3e4ee64ef3
commit 9d00e04680
5 changed files with 36 additions and 41 deletions

View File

@@ -631,7 +631,7 @@ class HemoCubeFragment : Fragment() {
val led2Average = log10(led2BufferForDevice.div(led2SampleForDevice))
val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
val deviceRatio = led3Average / led1Average
val deviceRatio = led4Average / led1Average
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
?.get(0)!!
@@ -674,8 +674,6 @@ class HemoCubeFragment : Fragment() {
}
}
var gradient = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(0)?.get(0)
var constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(0)?.get(1)
fittedAbs1 = gradient?.times(led1Average)?.plus(constant!!)!!
@@ -767,12 +765,12 @@ class HemoCubeFragment : Fragment() {
this.slopeRatio = _slopeRatio
this.coefficients = currentDeviceData?.coefficients?.get(0)
.toString() + ", " + currentDeviceData?.coefficients?.get(1).toString()
this.classificationResult = findResult(calculatedRatio)
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
hemoCubeViewModel.messages.postValue("Hb3: $_hb3,\n Hb4: $_hb4")
this.deviceRatioClass = deviceRatioClassification(deviceRatio)
this.slopeRatioClass = slopeClass
hemoCubeViewModel.messages.postValue("Slope Ratio: ${round(slopeRatio!!)},\n Slope Class: ${this.slopeRatioClass}\n")
this.classificationResult = deviceRatioClass //findResult(calculatedRatio)
hemoCubeViewModel.messages.postValue("${this.deviceRatioClass} ${if (led4Average < 0.17) " - Low Hb" else ""}\n")
this.errorMessages = allErrorMessages
this.resultData = deviceLog
this.batteryLevel = hemoCubeViewModel.getBatteryLevel().toString()
@@ -794,15 +792,6 @@ class HemoCubeFragment : Fragment() {
apply()
}
}
// if (!validationError) {
// activity?.runOnUiThread {
// binding.btnSubmit.visibility = View.VISIBLE
// binding.btnSubmit.isEnabled = true
// binding.btnSubmit.isClickable = true
// binding.clParent.setBackgroundColor(Color.parseColor("#edfffd"))
// }
// }
} catch (e: Exception) {
Toast.makeText(
requireContext(),
@@ -820,14 +809,6 @@ class HemoCubeFragment : Fragment() {
if (calculatedRatio < 0.05)
return getString(R.string.error_repeat_test_higher_volume)
if (calculatedRatio in 0.05..0.155) {
activity?.runOnUiThread {
binding.tvSubtitle4.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.brightGreen
)
)
}
return getString(R.string.normal)
}
if (calculatedRatio in 0.155..0.175)
@@ -855,15 +836,24 @@ class HemoCubeFragment : Fragment() {
try {
hemoCubeViewModel.messages.postValue("result classification")
if (ratio != null) {
if (ratio in 0.0..0.4)
if (ratio in 0.2..0.29) {
activity?.runOnUiThread {
binding.tvSubtitle4.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.green_2
)
)
}
return getString(R.string.normal)
if (ratio in 0.4..0.45)
}
if (ratio in 0.29..0.32)
return getString(R.string.negative_borderline)
if (ratio in 0.45..0.55)
if (ratio in 0.32..0.35)
return getString(R.string.sickle_cell_trait)
if (ratio in 0.55..0.575)
if (ratio in 0.35..0.38)
return getString(R.string.positive_for_sickle_cell)
if (ratio in 0.09..1.0)
if (ratio in 0.38..0.5)
return getString(R.string.sickle_cell_disease)
} else {
return getString(R.string.invalid)
@@ -906,14 +896,14 @@ class HemoCubeFragment : Fragment() {
hemoCubeViewModel.messages.postValue("result classification")
if (predictedDenovixRatio != null) {
if (predictedDenovixRatio in 0.0..0.16) {
activity?.runOnUiThread {
binding.tvSubtitle4.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.brightGreen
)
)
}
// activity?.runOnUiThread {
// binding.tvSubtitle4.setTextColor(
// ContextCompat.getColor(
// requireContext(),
// R.color.brightGreen
// )
// )
// }
return getString(R.string.normal)
}
if (predictedDenovixRatio in 0.16..0.165)

View File

@@ -267,11 +267,15 @@ class HemoCubeViewModel @Inject constructor(
testDetails?.abs3 = DataHolder.hemoCubeTestData?.abs3
testDetails?.abs4 = DataHolder.hemoCubeTestData?.abs4
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
testDetails?.slopeRatio = DataHolder.hemoCubeTestData?.slopeRatio
testDetails?.predictedDenovixRatio = DataHolder.hemoCubeTestData?.predictedDenovixRatio
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
testDetails?.coefficients = DataHolder.hemoCubeTestData?.coefficients
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString()
testDetails?.deviceRatioClass = DataHolder.hemoCubeTestData?.deviceRatioClass.toString()
testDetails?.slopeRatioClass = DataHolder.hemoCubeTestData?.slopeRatioClass.toString()
testDetails?.errorMessages = DataHolder.hemoCubeTestData?.errorMessages.toString()
testDetails?.batteryLevel = DataHolder.hemoCubeTestData?.batteryLevel.toString()
testDetails?.batteryCapacity = DataHolder.hemoCubeTestData?.batteryCapacity.toString()
testDetails?.batteryMaxCapacity = DataHolder.hemoCubeTestData?.batteryMaxCapacity.toString()

View File

@@ -97,9 +97,9 @@
<string name="start_now">ಈಗ ಪ್ರಾರಂಭಿಸಿ</string>
<string name="hemo_cube">ಹೆಮೋ ಕ್ಯೂಬ್</string>
<string name="hb">ಹೆಮೊಗ್ಲೊಬಿನ್</string>
<string name="normal">ಸಾಮಾನ್ಯ\ \ </string>
<string name="sickle_cell_disease">ಸಿಕ್ಲ್ ಸೆಲ್ ರೋಗ\ \ </string>
<string name="sickle_cell_trait">ಸಿಕ್ಲ್ ಸೆಲ್ ಗುಣ\ \ </string>
<string name="normal">ಸಾಮಾನ್ಯ</string>
<string name="sickle_cell_disease">ಸಿಕ್ಲ್ ಸೆಲ್ ರೋಗ</string>
<string name="sickle_cell_trait">ಸಿಕ್ಲ್ ಸೆಲ್ ಗುಣ</string>
<string name="undefined">ಅವ್ಯಾಖ್ಯಾತ\ \ </string>
<string name="sicklecell_nconfirmatory">ಸಿಕ್ಲ್‌ಸೆಲ್\nದೃಢೀಕರಣ</string>
<string name="sicklecell_screening">ಸಿಕ್ಲ್ ಸೆಲ್ ಸ್ಕ್ರೀನಿಂಗ್</string>

View File

@@ -10,6 +10,7 @@
<color name="gray">#808080</color>
<color name="brightGreen">#00FF00</color>
<color name="green_2">#295F2D</color>
<color name="red">#FF0000</color>
<color name="blue_app">#4daaff</color>
<color name="blue_app_dark">#005db3</color>

View File

@@ -98,9 +98,9 @@
<string name="start_now">Start Now</string>
<string name="hemo_cube">Hemo Cube</string>
<string name="hb">Hb</string>
<string name="normal">Normal\ \ </string>
<string name="sickle_cell_disease">Sickle Cell Disease\ \ </string>
<string name="sickle_cell_trait">Sickle Cell Trait\ \ </string>
<string name="normal">Normal</string>
<string name="sickle_cell_disease">Sickle Cell Disease</string>
<string name="sickle_cell_trait">Sickle Cell Trait</string>
<string name="undefined">Undefined\ \ </string>
<string name="sicklecell_nconfirmatory">Sicklecell\nConfirmatory</string>
<string name="sicklecell_screening">Sicklecell Screening</string>