add result classification
- add result classification - add sample start command for positive confirmation - remove toast on result screen
This commit is contained in:
@@ -27,5 +27,6 @@ data class HemoCubeTestData(
|
||||
var led1Average: Double? = null,
|
||||
var led2Average: Double? = null,
|
||||
var deviceRatio: Double? = null,
|
||||
var calculatedRatio: Double? = null
|
||||
var calculatedRatio: Double? = null,
|
||||
var classificationResult: String = ""
|
||||
)
|
||||
|
||||
@@ -104,8 +104,6 @@ class HemoCubeFragment : Fragment() {
|
||||
|
||||
hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) {
|
||||
currentDeviceData = it
|
||||
showToast(calculateRatio(0.17).toString())
|
||||
|
||||
}
|
||||
|
||||
hemoCubeViewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isNetworkAvailable ->
|
||||
@@ -115,7 +113,7 @@ class HemoCubeFragment : Fragment() {
|
||||
val coefficient1 = coefficients[0]
|
||||
val coefficient2 = coefficients[1]
|
||||
val result = coefficient1 * coefficient2
|
||||
showToast("Result: $result")
|
||||
showToast("coefficients: $coefficient1, $coefficient2")
|
||||
}
|
||||
}
|
||||
isOnline = isNetworkAvailable
|
||||
@@ -279,7 +277,8 @@ class HemoCubeFragment : Fragment() {
|
||||
override fun onClickNegativeButton() {}
|
||||
|
||||
override fun onClickPositiveButton() {
|
||||
|
||||
listenToHemoCube()
|
||||
startSampleProcess()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -316,6 +315,7 @@ class HemoCubeFragment : Fragment() {
|
||||
this.led2Average = led2Average
|
||||
this.deviceRatio = deviceRatio
|
||||
this.calculatedRatio = calculateRatio(deviceRatio)
|
||||
this.classificationResult = findResult(calculatedRatio)
|
||||
this.resultData = fullReadOutput
|
||||
if (!isBufferValueAvailable()) {
|
||||
with(sharedPreferences.edit()) {
|
||||
@@ -331,6 +331,33 @@ class HemoCubeFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun findResult(calculatedRatio: Double?): String {
|
||||
try {
|
||||
if (calculatedRatio != null) {
|
||||
if (calculatedRatio < 0.085)
|
||||
return "Inconclusive. Very low Absorbance - Repeat test with Higher Blood Volume"
|
||||
if (calculatedRatio in 0.085 .. 0.155)
|
||||
return "Normal"
|
||||
if (calculatedRatio in 0.155 .. 0.175)
|
||||
return "Negative Borderline. Repeat Test"
|
||||
if (calculatedRatio in 0.175 .. 0.22)
|
||||
return "Sickle Cell Trait"
|
||||
if (calculatedRatio in 0.22 .. 0.25)
|
||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||
if (calculatedRatio in 0.25 .. 0.35)
|
||||
return "Sickle Cell Disease"
|
||||
if (calculatedRatio > 0.35)
|
||||
return "Inconclusive. Repeat with test with lower volume of blood"
|
||||
} else {
|
||||
return "NULL"
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
showToast("error while performing classification")
|
||||
return "ERROR"
|
||||
}
|
||||
return "NULL"
|
||||
}
|
||||
|
||||
private fun showToast(message: String) {
|
||||
Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
testDetails?.led2Average = DataHolder.hemoCubeTestData?.led2Average
|
||||
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
|
||||
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
|
||||
testDetails?.classificationResult = DataHolder.hemoCubeTestData?.classificationResult!!
|
||||
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user