removed birthyear,bloodgroup, gender, abhaid, UserImage field for molbio data
This commit is contained in:
@@ -1244,7 +1244,7 @@ object Constants {
|
||||
const val PQ_MODE = true
|
||||
const val READINGS_PER_SAMPLE = 1
|
||||
|
||||
const val MINIMUM_BATTERY_LEVEL = 0
|
||||
const val MINIMUM_BATTERY_LEVEL = 40F
|
||||
|
||||
val BUFFER_INTENSITY_THRESHOLDS: Map<String, List<List<Int>>> = mapOf<String, List<List<Int>>>(
|
||||
"HCV-000-3001" to listOf(
|
||||
|
||||
@@ -19,11 +19,12 @@ import androidx.room.TypeConverters
|
||||
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||
import com.example.hpostesting.data.model.patient.DeviceData
|
||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.example.hpostesting.data.model.patient.MolbioHemocubeData
|
||||
import com.example.hpostesting.data.model.patient.UserData
|
||||
|
||||
@Database(
|
||||
entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class],
|
||||
version = 32,
|
||||
entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class,MolbioHemocubeData::class],
|
||||
version = 34,
|
||||
exportSchema = false
|
||||
)
|
||||
@TypeConverters(Converters::class)
|
||||
@@ -31,4 +32,5 @@ abstract class MyDatabase : RoomDatabase() {
|
||||
abstract fun userDao(): UserDao
|
||||
abstract fun hemoCubeDao(): HemoCubeDao
|
||||
abstract fun hemoCubeBufferDao(): HemoCubeBufferDao
|
||||
|
||||
}
|
||||
@@ -14,15 +14,16 @@
|
||||
package com.example.hpostesting.data.model.molbioresult
|
||||
|
||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.example.hpostesting.data.model.patient.MolbioHemocubeData
|
||||
|
||||
data class MolbioV2Result(
|
||||
val age: Int? = 31,
|
||||
// val age: Int? = 31,
|
||||
val analysisDate: String? = "2024-02-08 16:33:56",
|
||||
val analysisId: String? = "",
|
||||
val analysisStatus: String? = "",
|
||||
val analysisType: String? = "HPOS",
|
||||
val analysisTypeMethod: String? = "",
|
||||
val bloodGroup: String? = "",
|
||||
// val bloodGroup: String? = "",
|
||||
val coefficients: List<Int>? = listOf(22, 22),
|
||||
val collectionLocation: List<Any>? = listOf(),
|
||||
val collectionTime: String? = "2024-02-08 16:33:56",
|
||||
@@ -30,12 +31,12 @@ data class MolbioV2Result(
|
||||
val curveFitting: String? = "Linear",
|
||||
val deviceName: String? = "HPOS",
|
||||
val expiryTime: String? = "2024-02-08 16:33:56",
|
||||
val gender: String? = "",
|
||||
// val gender: String? = "",
|
||||
val interpretation: String? = "",
|
||||
val `operator`: String? = "",
|
||||
val patientId: Int? = 4545,
|
||||
val pregnancy: Boolean? = false,
|
||||
val rawData: HemoCubeTestData? = HemoCubeTestData(),
|
||||
val rawData: MolbioHemocubeData? = HemoCubeTestData().MolbioHemocubeData(),
|
||||
val recommendation: String? = "NA",
|
||||
val sampleId: String? = "",
|
||||
val sampleType: String? = "",
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
package com.example.hpostesting.data.model.molbioresult
|
||||
|
||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.example.hpostesting.data.model.patient.MolbioHemocubeData
|
||||
|
||||
data class MolbioV2ResultData(
|
||||
val age: Int? = 0,
|
||||
// val age: Int? = 0,
|
||||
val analysisDate: String? = "2024-02-08 16:33:56",
|
||||
val analysisStatus: String? = "",
|
||||
val analysisType: String? = "",
|
||||
val analysisTypeMethod: String? = "",
|
||||
val bloodGroup: String? = "",
|
||||
// val bloodGroup: String? = "",
|
||||
val coefficients: List<Int>? = listOf(),
|
||||
val collectionLocation: List<Any>? = listOf(),
|
||||
val collectionTime: String? = "2024-02-08 16:33:56",
|
||||
@@ -31,13 +32,13 @@ data class MolbioV2ResultData(
|
||||
val curveFitting: String? = "",
|
||||
val deviceId: Int? = 0,
|
||||
val expiryTime: String? = "2024-02-08 16:33:56",
|
||||
val gender: String? = "",
|
||||
// val gender: String? = "",
|
||||
val id: Int? = 0,
|
||||
val interpretation: String? = "",
|
||||
val `operator`: String? = "",
|
||||
val patientId: Int? = 0,
|
||||
val pregnancy: Boolean? = false,
|
||||
val rawData: HemoCubeTestData? = HemoCubeTestData(),
|
||||
val rawData: MolbioHemocubeData? = HemoCubeTestData().MolbioHemocubeData(),
|
||||
val recommendation: String? = "",
|
||||
val sampleId: String? = "",
|
||||
val sampleType: String? = "",
|
||||
|
||||
@@ -108,3 +108,89 @@ data class HemoCubeTestData(
|
||||
var isCSVCreated: Boolean = false,
|
||||
var labName: String? = ""
|
||||
)
|
||||
|
||||
fun HemoCubeTestData.MolbioHemocubeData() = MolbioHemocubeData(
|
||||
sampleid = sampleid,
|
||||
_id = _id,
|
||||
name = name,
|
||||
incubationTime = incubationTime,
|
||||
state = state,
|
||||
location = location,
|
||||
reportUploadTime = reportUploadTime,
|
||||
testType = testType,
|
||||
testTime = testTime,
|
||||
testStatus = testStatus,
|
||||
localFlag = localFlag,
|
||||
deviceId = deviceId,
|
||||
appVersion = appVersion,
|
||||
deviceSerialNumber = deviceSerialNumber,
|
||||
deviceType = deviceType,
|
||||
kitSerial = kitSerial,
|
||||
resultData = resultData,
|
||||
led1Buffer = led1Buffer,
|
||||
led2Buffer = led2Buffer,
|
||||
led3Buffer = led3Buffer,
|
||||
led4Buffer = led4Buffer,
|
||||
led1Sample = led1Sample,
|
||||
led2Sample = led2Sample,
|
||||
led3Sample = led3Sample,
|
||||
led4Sample = led4Sample,
|
||||
led1Average = led1Average,
|
||||
led2Average = led2Average,
|
||||
led3Average = led3Average,
|
||||
led4Average = led4Average,
|
||||
abs1 = abs1,
|
||||
abs2 = abs2,
|
||||
abs3 = abs3,
|
||||
abs4 = abs4,
|
||||
hb3 = hb3,
|
||||
hb4 = hb4,
|
||||
led1Gain1 = led1Gain1,
|
||||
led2Gain1 = led2Gain1,
|
||||
led3Gain1 = led3Gain1,
|
||||
led4Gain1 = led4Gain1,
|
||||
led1Gain2 = led1Gain2,
|
||||
led2Gain2 = led2Gain2,
|
||||
led3Gain2 = led3Gain2,
|
||||
led4Gain2 = led4Gain2,
|
||||
led1Gain3 = led1Gain3,
|
||||
led2Gain3 = led2Gain3,
|
||||
led3Gain3 = led3Gain3,
|
||||
led4Gain3 = led4Gain3,
|
||||
led1Gain4 = led1Gain4,
|
||||
led2Gain4 = led2Gain4,
|
||||
led3Gain4 = led3Gain4,
|
||||
led4Gain4 = led4Gain4,
|
||||
led1Air1 = led1Air1,
|
||||
led2Air1 = led2Air1,
|
||||
led3Air1 = led3Air1,
|
||||
led4Air1 = led4Air1,
|
||||
led1Air2 = led1Air2,
|
||||
led2Air2 = led2Air2,
|
||||
led3Air2 = led3Air2,
|
||||
led4Air2 = led4Air2,
|
||||
deviceRatio = deviceRatio,
|
||||
calculatedRatio = calculatedRatio,
|
||||
predictedDenovixRatio = predictedDenovixRatio,
|
||||
slopeRatio = slopeRatio,
|
||||
coefficients = coefficients,
|
||||
classificationResult = classificationResult,
|
||||
prdClassification = prdClassification,
|
||||
deviceRatioClass = deviceRatioClass,
|
||||
slopeRatioClass = slopeRatioClass,
|
||||
borderlineMethod2Class = borderlineMethod2Class,
|
||||
errorMessages = errorMessages,
|
||||
batteryLevel = batteryLevel,
|
||||
batteryCapacity = batteryCapacity,
|
||||
batteryMaxCapacity = batteryMaxCapacity,
|
||||
batteryTemperature = batteryTemperature,
|
||||
batteryVoltage = batteryVoltage,
|
||||
molbioFlag = molbioFlag,
|
||||
quickCapture = quickCapture,
|
||||
solution = solution,
|
||||
concentration = concentration,
|
||||
filter = filter,
|
||||
volume = volume,
|
||||
isCSVCreated = isCSVCreated,
|
||||
labName = labName
|
||||
)
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.example.hpostesting.data.model.patient
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "molbio_hemo_cube_test_table")
|
||||
data class MolbioHemocubeData(
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
var sampleid: Int = 0,
|
||||
var _id: String = "",
|
||||
var name: String = "",
|
||||
var incubationTime: String = "",
|
||||
var state: String = "",
|
||||
var location: UserData.Location? = null,
|
||||
var reportUploadTime: String? = "",
|
||||
var testType: String? = "HEMOCUBE",
|
||||
var testTime: String? = "",
|
||||
var testStatus: Boolean? = false,
|
||||
var localFlag: Boolean = false,
|
||||
var deviceId: String? = "",
|
||||
var appVersion: String? = "",
|
||||
var deviceSerialNumber: String = "",
|
||||
var deviceType: String = "HEMOCUBE",
|
||||
var kitSerial: String = "",
|
||||
var resultData: String = "",
|
||||
var led1Buffer: Double? = null,
|
||||
var led2Buffer: Double? = null,
|
||||
var led3Buffer: Double? = null,
|
||||
var led4Buffer: Double? = null,
|
||||
var led1Sample: Double? = null,
|
||||
var led2Sample: Double? = null,
|
||||
var led3Sample: Double? = null,
|
||||
var led4Sample: Double? = null,
|
||||
var led1Average: Double? = null,
|
||||
var led2Average: Double? = null,
|
||||
var led3Average: Double? = null,
|
||||
var led4Average: Double? = null,
|
||||
var abs1: Double? = null,
|
||||
var abs2: Double? = null,
|
||||
var abs3: Double? = null,
|
||||
var abs4: Double? = null,
|
||||
var hb3: Double? = null,
|
||||
var hb4: Double? = null,
|
||||
var led1Gain1: Double? = null,
|
||||
var led2Gain1: Double? = null,
|
||||
var led3Gain1: Double? = null,
|
||||
var led4Gain1: Double? = null,
|
||||
var led1Gain2: Double? = null,
|
||||
var led2Gain2: Double? = null,
|
||||
var led3Gain2: Double? = null,
|
||||
var led4Gain2: Double? = null,
|
||||
var led1Gain3: Double? = null,
|
||||
var led2Gain3: Double? = null,
|
||||
var led3Gain3: Double? = null,
|
||||
var led4Gain3: Double? = null,
|
||||
var led1Gain4: Double? = null,
|
||||
var led2Gain4: Double? = null,
|
||||
var led3Gain4: Double? = null,
|
||||
var led4Gain4: Double? = null,
|
||||
var led1Air1: Double? = null,
|
||||
var led2Air1: Double? = null,
|
||||
var led3Air1: Double? = null,
|
||||
var led4Air1: Double? = null,
|
||||
var led1Air2: Double? = null,
|
||||
var led2Air2: Double? = null,
|
||||
var led3Air2: Double? = null,
|
||||
var led4Air2: Double? = null,
|
||||
var deviceRatio: Double? = null,
|
||||
var calculatedRatio: Double? = null,
|
||||
var predictedDenovixRatio: Double? = null,
|
||||
var slopeRatio: Double? = null,
|
||||
var coefficients: String? = "",
|
||||
var classificationResult: String = "",
|
||||
var prdClassification: String = "",
|
||||
var deviceRatioClass: String = "",
|
||||
var slopeRatioClass: String = "",
|
||||
var borderlineMethod2Class: String = "",
|
||||
var errorMessages: String = "",
|
||||
var batteryLevel: String = "",
|
||||
var batteryCapacity: String = "",
|
||||
var batteryMaxCapacity: String = "",
|
||||
var batteryTemperature: String = "",
|
||||
var batteryVoltage: String = "",
|
||||
var molbioFlag: Boolean = false,
|
||||
var quickCapture: Boolean = false,
|
||||
var solution: String? = "",
|
||||
var concentration: String? = "",
|
||||
var filter: String? = "",
|
||||
var volume: String? = "",
|
||||
var isCSVCreated: Boolean = false,
|
||||
var labName: String? = ""
|
||||
)
|
||||
|
||||
@@ -15,7 +15,10 @@ package com.example.hpostesting.presentation.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.res.Resources
|
||||
import android.os.BatteryManager
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -90,7 +93,9 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int,
|
||||
}
|
||||
if(fromWhere == "Home"){
|
||||
userCard.setOnClickListener {
|
||||
if (false) {
|
||||
var batLevel = 50F
|
||||
batLevel = getBatteryLevel()!!.toFloat()
|
||||
if (batLevel < Constants.MINIMUM_BATTERY_LEVEL) {
|
||||
Toast.makeText(
|
||||
view.context,
|
||||
view.context.getString(R.string.low_battery_warning),
|
||||
@@ -172,4 +177,25 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
fun getBatteryLevel(): Float? {
|
||||
val batteryPct: Float? = batteryStatus?.let { intent ->
|
||||
val level: Int =
|
||||
intent.getIntExtra(
|
||||
BatteryManager.EXTRA_LEVEL,
|
||||
-1
|
||||
)
|
||||
val scale: Int =
|
||||
intent.getIntExtra(
|
||||
BatteryManager.EXTRA_SCALE,
|
||||
-1
|
||||
)
|
||||
level * 100 / scale.toFloat()
|
||||
}
|
||||
|
||||
return batteryPct
|
||||
}
|
||||
private val batteryStatus: Intent? =
|
||||
IntentFilter(Intent.ACTION_BATTERY_CHANGED).let { ifilter ->
|
||||
view.context.registerReceiver(null, ifilter)
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ import com.example.hpostesting.data.model.molbioresult.MolbioV2ResultResponse
|
||||
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||
import com.example.hpostesting.data.model.patient.DeviceData
|
||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.example.hpostesting.data.model.patient.MolbioHemocubeData
|
||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
||||
import com.example.hpostesting.data.model.updates.CheckUpdateResponse
|
||||
@@ -78,6 +79,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
var isServiceConnected = false
|
||||
val progressBar = MutableLiveData(false)
|
||||
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||
private val testDetailsmolbio = DataHolder.hemoCubeTestData?.MolbioHemocubeData()
|
||||
val messages = MutableLiveData<String>()
|
||||
private val sharedPreference =
|
||||
context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||
@@ -187,7 +189,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
?: "defaultThreshold" // Handle possible nulls safely
|
||||
resultList.results?.add(
|
||||
MolbioV2Result(
|
||||
rawData = userData,
|
||||
rawData = userData.MolbioHemocubeData(),
|
||||
analysisId = userData._id,
|
||||
analysisDate = currentTimeFormatted,
|
||||
analysisStatus = userData.classificationResult
|
||||
@@ -462,7 +464,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
apply()
|
||||
}
|
||||
// Sanitize testDetails before using it in the API call
|
||||
val sanitizedTestDetails = sanitizeDoubleValues(testDetails)
|
||||
val sanitizedTestDetails = testDetailsmolbio?.let { sanitizeDoubleValues(it) }
|
||||
|
||||
// Now, use sanitizedTestDetails for the API call
|
||||
uploadResult(
|
||||
@@ -470,7 +472,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
mutableListOf(
|
||||
MolbioV2Result(
|
||||
rawData = sanitizedTestDetails,
|
||||
analysisId = sanitizedTestDetails._id,
|
||||
analysisId = sanitizedTestDetails!!._id,
|
||||
analysisDate = currentTimeFormatted,
|
||||
analysisStatus = sanitizedTestDetails.classificationResult,
|
||||
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[sanitizedTestDetails.deviceId]?.toString(),
|
||||
@@ -510,17 +512,17 @@ class HemoCubeViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun sanitizeDoubleValues(hemoCubeTestData: HemoCubeTestData): HemoCubeTestData {
|
||||
hemoCubeTestData::class.java.declaredFields.forEach { field ->
|
||||
fun sanitizeDoubleValues(molbiohemocubeData: MolbioHemocubeData): MolbioHemocubeData {
|
||||
molbiohemocubeData::class.java.declaredFields.forEach { field ->
|
||||
if (field.type == Double::class.javaObjectType || field.type == Double::class.javaPrimitiveType) {
|
||||
field.isAccessible = true
|
||||
val value = field.get(hemoCubeTestData) as Double?
|
||||
val value = field.get(molbiohemocubeData) as Double?
|
||||
if (value != null && (value.isInfinite() || value.isNaN())) {
|
||||
field.set(hemoCubeTestData, 0.0) // Replace with a suitable default value
|
||||
field.set(molbiohemocubeData, 0.0) // Replace with a suitable default value
|
||||
}
|
||||
}
|
||||
}
|
||||
return hemoCubeTestData
|
||||
return molbiohemocubeData
|
||||
}
|
||||
|
||||
private fun updateLocalFlag(userId: String) = viewModelScope.launch {
|
||||
@@ -535,6 +537,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
hemoCubeDao.insertAll(userData)
|
||||
}
|
||||
|
||||
|
||||
fun deleteById(userId: String) = viewModelScope.launch {
|
||||
hemoCubeDao.deleteById(id = userId)
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.example.hpostesting.data.model.molbioresult.MolbioV2ResultResponse
|
||||
import com.example.hpostesting.data.model.patient.BufferCheckData
|
||||
import com.example.hpostesting.data.model.patient.DeviceData
|
||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
||||
import com.example.hpostesting.data.model.patient.MolbioHemocubeData
|
||||
import com.example.hpostesting.data.model.patient.toHemoCubeTestData
|
||||
import com.example.hpostesting.data.model.updates.CheckUpdateRequest
|
||||
import com.example.hpostesting.data.model.updates.CheckUpdateResponse
|
||||
@@ -75,6 +76,7 @@ class TrueHemeViewModel @Inject constructor(
|
||||
var isServiceConnected = false
|
||||
val progressBar = MutableLiveData(false)
|
||||
private val testDetails = DataHolder.selectedTest?.toHemoCubeTestData()
|
||||
private val testDetailsmolbio = DataHolder.hemoCubeTestData?.MolbioHemocubeData()
|
||||
val messages = MutableLiveData<String>()
|
||||
private val sharedPreference =
|
||||
context.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||
@@ -321,12 +323,12 @@ class TrueHemeViewModel @Inject constructor(
|
||||
}
|
||||
Log.i("Testdb", "Data uploaded to Firestore successfully")
|
||||
fireBaseUpload.postValue("Success")
|
||||
testDetails.localFlag = true
|
||||
testDetailsmolbio!!.localFlag = true
|
||||
uploadResult(
|
||||
MolbioV2ResultRequest(
|
||||
mutableListOf(
|
||||
MolbioV2Result(
|
||||
rawData = testDetails,
|
||||
rawData = testDetailsmolbio,
|
||||
analysisId = testDetails._id,
|
||||
analysisDate = testDetails.testTime,
|
||||
analysisStatus = testDetails.classificationResult,
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
<string name="all_registered_user_are_tested_successfully">All registered user are tested successfully</string>
|
||||
<string name="start_incubation">Incubate</string>
|
||||
<string name="check_buffer">Check Buffer</string>
|
||||
<string name="low_battery_warning">Battery level is low than 40%, please charge the device to continue testing</string>
|
||||
<string name="low_battery_warning">Battery level is lower than 40%, please charge the device to continue testing</string>
|
||||
<string name="test_already_conducted">Test has been already conducted for this user</string>
|
||||
<string name="incubation_not_completed">Incubation has not completed 15 minutes</string>
|
||||
<string name="incubation_crossed_30_minutes">Incubation crossed 30 minutes, need to repeat the incubation</string>
|
||||
|
||||
Reference in New Issue
Block a user