display hb3 and hb4
This commit is contained in:
@@ -16,7 +16,7 @@ android {
|
||||
|
||||
// prod - production, preprod - preproduction, quality - qc,
|
||||
defaultConfig {
|
||||
applicationId "in.sminnovations.hpostesting"
|
||||
applicationId "in.sminnovations.hpostesting.quality"
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
versionCode 44
|
||||
|
||||
@@ -63,6 +63,7 @@ object Constants {
|
||||
"HC-V1-020",
|
||||
"HCV-000-3001",
|
||||
"HCV-000-3002",
|
||||
"devuser",
|
||||
)
|
||||
|
||||
const val password = "SMI@12345"
|
||||
@@ -83,19 +84,36 @@ object Constants {
|
||||
listOf(1.313, -0.89), // LED1, 435nm
|
||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
||||
listOf(0.2012, 0.0092), // LED3, 555nm
|
||||
listOf(1.0, 0.0) // LED4
|
||||
listOf(1.0, 0.0) // LED4, 560nm
|
||||
),
|
||||
"HCV-000-3002" to listOf(
|
||||
listOf(0.723142, -0.09135), // LED1, 435nm
|
||||
listOf(0.581462456, -0.58502), // LED2, 415nm
|
||||
listOf(0.1964, 0.011565), // LED3, 555nm
|
||||
listOf(1.0, 0.0) // LED4
|
||||
listOf(1.0, 0.0) // LED4, 560nm
|
||||
),
|
||||
)
|
||||
|
||||
val DEVICE_HB_PARAMETERS: Map<String, List<List<Double>>> = mapOf<String, List<List<Double>>>(
|
||||
"HCV-000-3001" to listOf(
|
||||
listOf(1.0, 0.0), // LED1, 435nm
|
||||
listOf(1.0, 0.0), // LED2, 415nm
|
||||
listOf(0.0305, 0.2067), // LED3, 555nm
|
||||
listOf(0.0258, 0.5534) // LED4, 560nm
|
||||
),
|
||||
"HCV-000-3002" to listOf(
|
||||
listOf(1.0, 0.0), // LED1, 435nm
|
||||
listOf(1.0, 0.0), // LED2, 415nm
|
||||
listOf(0.0305, 0.2067), // LED3, 555nm
|
||||
listOf(0.0258, 0.5534) // LED4, 560nm
|
||||
),
|
||||
)
|
||||
|
||||
const val INCUBATION_TIME_MIN = 0
|
||||
const val INCUBATION_TIME_MAX = 1400
|
||||
|
||||
const val MINIMUM_BATTERY_LEVEL = 0
|
||||
|
||||
val BUFFER_INTENSITY_THRESHOLDS: Map<String, List<List<Int>>> = mapOf<String, List<List<Int>>>(
|
||||
"HCV-000-3001" to listOf(
|
||||
listOf(20000, 25074),
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.google.android.datatransport.runtime.dagger.Provides
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 11, exportSchema = false)
|
||||
@Database(entities = [UserData::class, HemoCubeTestData::class, DeviceData::class], version = 12, exportSchema = false)
|
||||
@TypeConverters(Converters::class)
|
||||
abstract class MyDatabase : RoomDatabase() {
|
||||
abstract fun userDao(): UserDao
|
||||
|
||||
@@ -43,6 +43,8 @@ data class HemoCubeTestData(
|
||||
var abs2: Double? = null,
|
||||
var abs3: Double? = null,
|
||||
var abs4: Double? = null,
|
||||
var hb3: Double? = null,
|
||||
var hb4: Double? = null,
|
||||
var deviceRatio: Double? = null,
|
||||
var calculatedRatio: Double? = null,
|
||||
var predictedDenovixRatio: Double? = null,
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.widget.AutoCompleteTextView
|
||||
import androidx.core.content.ContextCompat.getSystemService
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||
import com.google.firebase.firestore.FirebaseFirestore
|
||||
|
||||
@@ -196,7 +197,7 @@ class UserListAdapter(
|
||||
// }
|
||||
}
|
||||
userCard.setOnClickListener {
|
||||
if (batLevel < 40) {
|
||||
if (batLevel < Constants.MINIMUM_BATTERY_LEVEL) {
|
||||
Toast.makeText(
|
||||
view.context,
|
||||
context?.getString(R.string.low_battery_warning),
|
||||
|
||||
@@ -296,13 +296,15 @@ class HemoCubeFragment : Fragment() {
|
||||
when {
|
||||
stringData.contains("SN") -> {
|
||||
val slData = stringData.split(" ")
|
||||
if (slData.size > 1) {
|
||||
if (slData.size > 1 && slData[1].trim().length == 12) {
|
||||
val hardwareId = slData[1].trim()
|
||||
deviceHardwareId = hardwareId
|
||||
with(sharedPreferences.edit()) {
|
||||
putString(Constants.DEVICE_ID, hardwareId)
|
||||
apply()
|
||||
}
|
||||
} else {
|
||||
hemoCubeViewModel.messages.postValue("config error")
|
||||
}
|
||||
activity?.runOnUiThread {
|
||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||
@@ -483,6 +485,14 @@ class HemoCubeFragment : Fragment() {
|
||||
constant = Constants.DEVICE_CONFIGURATION[deviceHardwareId]?.get(3)?.get(1)
|
||||
fittedAbs4 = gradient?.times(led4Average)?.plus(constant!!)!!
|
||||
|
||||
val slope3 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(2)?.get(0)
|
||||
val intercept3 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(2)?.get(1)
|
||||
val _hb3 = (led3Average - intercept3!!) / slope3!!
|
||||
|
||||
val slope4 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(3)?.get(0)
|
||||
val intercept4 = Constants.DEVICE_HB_PARAMETERS[deviceHardwareId]?.get(3)?.get(1)
|
||||
val _hb4 = (led4Average - intercept4!!) / slope4!!
|
||||
|
||||
_predictedDenovixRatio = fittedAbs3.div(fittedAbs1)
|
||||
|
||||
if (fittedAbs1 <= fittedAbs2) {
|
||||
@@ -530,6 +540,8 @@ class HemoCubeFragment : Fragment() {
|
||||
this.abs2 = fittedAbs2
|
||||
this.abs3 = fittedAbs3
|
||||
this.abs4 = fittedAbs4
|
||||
this.hb3 = _hb3
|
||||
this.hb4 = _hb4
|
||||
this.deviceRatio = deviceRatio
|
||||
this.calculatedRatio = calculateRatio(deviceRatio)
|
||||
this.predictedDenovixRatio = _predictedDenovixRatio
|
||||
@@ -537,7 +549,7 @@ class HemoCubeFragment : Fragment() {
|
||||
.toString() + ", " + currentDeviceData?.coefficients?.get(1).toString()
|
||||
this.classificationResult = findResult(calculatedRatio)
|
||||
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
|
||||
hemoCubeViewModel.messages.postValue(this.prdClassification)
|
||||
hemoCubeViewModel.messages.postValue("Hb3: $_hb3,\n Hb4: $_hb4")
|
||||
this.errorMessages = allErrorMessages
|
||||
this.resultData = deviceLog
|
||||
this.batteryLevel = hemoCubeViewModel.getBatteryLevel().toString()
|
||||
|
||||
@@ -125,6 +125,8 @@ class HemoCubeViewModel @Inject constructor(
|
||||
testDetails?.abs2 = DataHolder.hemoCubeTestData?.abs2
|
||||
testDetails?.abs3 = DataHolder.hemoCubeTestData?.abs3
|
||||
testDetails?.abs4 = DataHolder.hemoCubeTestData?.abs4
|
||||
testDetails?.hb3 = DataHolder.hemoCubeTestData?.hb3
|
||||
testDetails?.hb4 = DataHolder.hemoCubeTestData?.hb4
|
||||
testDetails?.deviceRatio = DataHolder.hemoCubeTestData?.deviceRatio
|
||||
testDetails?.predictedDenovixRatio = DataHolder.hemoCubeTestData?.predictedDenovixRatio
|
||||
testDetails?.calculatedRatio = DataHolder.hemoCubeTestData?.calculatedRatio
|
||||
|
||||
Reference in New Issue
Block a user