127 version, refresh buffer separated, added buffer flag, added remote config to manage threshold, remove cards direct test can be performed
This commit is contained in:
@@ -107,6 +107,7 @@ object Constants {
|
||||
const val DEVICE_ID = "DEVICE_ID"
|
||||
const val LABNAME = "LAB_NAME"
|
||||
const val CUVETTE_SIZE = "CUVETTE_SIZE"
|
||||
const val LAST_UPDATED = "LAST_UPDATED"
|
||||
const val IS_TOKEN_AVAILABLE = "IS_TOKEN_AVAILABLE"
|
||||
const val BUFFER_LED_LOWER_BOUND = 21000
|
||||
const val BUFFER_LED_UPPER_BOUND = 23500
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.example.hpostesting.data.model.patient.UserData
|
||||
|
||||
@Database(
|
||||
entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class],
|
||||
version = 35,
|
||||
version = 36,
|
||||
exportSchema = false
|
||||
)
|
||||
@TypeConverters(Converters::class)
|
||||
|
||||
@@ -110,5 +110,6 @@ data class HemoCubeTestData(
|
||||
var cuvetteSize: String? = "",
|
||||
var district: String? = "",
|
||||
var centerName: String? = "",
|
||||
var ipAddress:String?= ""
|
||||
var ipAddress:String?= "",
|
||||
var configUpdatedRecent:String?= ""
|
||||
)
|
||||
|
||||
@@ -103,7 +103,7 @@ class MainActivity : AppCompatActivity() {
|
||||
with(binding) {
|
||||
if (deviceType == Constants.DEVICE_TYPE_HEMOCUBE) {
|
||||
cvItem1.visibility = View.VISIBLE
|
||||
cvItem3.visibility = View.VISIBLE
|
||||
cvItem3.visibility = View.GONE
|
||||
cvItem2.visibility = View.GONE
|
||||
cvItem4.visibility = View.GONE
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class MainActivity : AppCompatActivity() {
|
||||
when {
|
||||
device.productId == Constants.HOMO_CUBE_ID && device.vendorId == Constants.VENDOR_ID -> {
|
||||
binding.cvItem1.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.GONE
|
||||
binding.cvItem2.visibility = View.GONE
|
||||
binding.cvItem4.visibility = View.GONE
|
||||
DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_HEMOCUBE)
|
||||
@@ -141,7 +141,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
device.productId == Constants.HEMO_CUBE_V2_PRODUCT_ID && device.vendorId == Constants.HEMO_CUBE_V2_VENDOR_ID -> {
|
||||
binding.cvItem1.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.GONE
|
||||
binding.cvItem2.visibility = View.GONE
|
||||
binding.cvItem4.visibility = View.GONE
|
||||
DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_HEMOCUBE)
|
||||
@@ -150,7 +150,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
device.productId == 24577 && device.vendorId == 1027 -> {
|
||||
binding.cvItem1.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.GONE
|
||||
binding.cvItem2.visibility = View.GONE
|
||||
binding.cvItem4.visibility = View.GONE
|
||||
DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_TRUEHEME)
|
||||
@@ -159,7 +159,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
device.productId == 8963 && device.vendorId == 1659 -> {
|
||||
binding.cvItem1.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.GONE
|
||||
binding.cvItem2.visibility = View.GONE
|
||||
binding.cvItem4.visibility = View.GONE
|
||||
DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_HEMOCUBE)
|
||||
@@ -168,7 +168,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
device.productId == 4614 && device.vendorId == 7111 -> {
|
||||
binding.cvItem1.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.VISIBLE
|
||||
binding.cvItem3.visibility = View.GONE
|
||||
binding.cvItem2.visibility = View.GONE
|
||||
binding.cvItem4.visibility = View.GONE
|
||||
DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_HEMOCUBE)
|
||||
|
||||
@@ -44,6 +44,7 @@ import androidx.core.content.FileProvider
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.data.constant.DataHolder
|
||||
@@ -784,17 +785,25 @@ class HomeFragment : Fragment() {
|
||||
private fun setUserId() {
|
||||
binding.btnSubmit.setOnClickListener {
|
||||
val userId = binding.userId.text.toString()
|
||||
val bloodGroup = binding.etBloodGroup.text
|
||||
if (userId.length >= 5 && (!bloodGroup.equals("Select Blood Group") || !bloodGroup.isNullOrBlank())) {
|
||||
hemoCubeViewModel.addUser(
|
||||
HemoCubeTestData(
|
||||
_id = userId,
|
||||
bloodGroup = bloodGroup.toString(),
|
||||
incubationTime = SimpleDateFormat(
|
||||
val bloodGroup = binding.etBloodGroup.text.toString()
|
||||
if (userId.length >= 5 && bloodGroup != "Select Blood Group") {
|
||||
DataHolder.selectedTest = UserData(
|
||||
_id = userId,
|
||||
bloodGroup = bloodGroup,
|
||||
incubationTime = SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||
).format(Calendar.getInstance().time).toString()
|
||||
)
|
||||
)
|
||||
findNavController().navigate(R.id.action_nav_home_to_mainActivity)
|
||||
// hemoCubeViewModel.addUser(
|
||||
// HemoCubeTestData(
|
||||
// _id = userId,
|
||||
// bloodGroup = bloodGroup.toString(),
|
||||
// incubationTime = SimpleDateFormat(
|
||||
// "yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||
// ).format(Calendar.getInstance().time).toString()
|
||||
// )
|
||||
// )
|
||||
Toast.makeText(requireContext(), "Successfully added- $userId", Toast.LENGTH_SHORT).show()
|
||||
binding.userId.setText("")
|
||||
// val userData = UserData(_id = userId)
|
||||
|
||||
@@ -59,7 +59,8 @@ class SlideshowFragment : Fragment(){
|
||||
binding.nameEditText.setText(sharedPreferences.getString(Constants.LABNAME,""))
|
||||
|
||||
selectedItem = sharedPreferences.getString(Constants.CUVETTE_SIZE,"10mm").toString()
|
||||
|
||||
val time = sharedPreferences.getString(Constants.LAST_UPDATED,"NA").toString()
|
||||
binding.lastUpdated.text = "Last updated config: $time"
|
||||
binding.btnGo.setOnClickListener {
|
||||
var labname = binding.nameEditText.text.toString()
|
||||
DataHolder.hemoCubeTestData?.apply {
|
||||
|
||||
@@ -186,7 +186,9 @@ class HemoCubeFragment : Fragment() {
|
||||
putBoolean(Constants.QUICK_CAPTURE, false)
|
||||
apply()
|
||||
}
|
||||
DataHolder.sampleReadCounter++
|
||||
if(DataHolder.hemoCubeTestData!!.classificationResult != "Invalid"){
|
||||
DataHolder.sampleReadCounter++
|
||||
}
|
||||
binding.btnSubmit.isEnabled = false
|
||||
binding.btnSubmit.isClickable = false
|
||||
activity?.runOnUiThread {
|
||||
@@ -222,6 +224,7 @@ class HemoCubeFragment : Fragment() {
|
||||
binding.btnSamplestart.isClickable = true
|
||||
binding.btnSamplestart.isEnabled = true
|
||||
}else{
|
||||
isUsingExistingBuffer = false
|
||||
hemoCubeViewModel.messages.postValue("Fresh Kit - Please take Buffer Blank reading")
|
||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||
binding.btnPlaceRefreshbuffer.visibility = View.GONE
|
||||
@@ -260,6 +263,7 @@ class HemoCubeFragment : Fragment() {
|
||||
Log.d("HemoCubeFragment","Test Process started, reBuffer started")
|
||||
binding.testing.visibility = View.VISIBLE
|
||||
}
|
||||
isUsingExistingBuffer = false
|
||||
refreshClick = true
|
||||
if(checkRefreshCuvette){
|
||||
startBufferProcess()
|
||||
@@ -624,6 +628,8 @@ class HemoCubeFragment : Fragment() {
|
||||
binding.btnPlaceRefreshbuffer.visibility = View.VISIBLE
|
||||
binding.btnPlacebuffer.visibility = View.GONE
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
binding.btnSamplestart.isClickable = false
|
||||
binding.btnSamplestart.isEnabled = false
|
||||
}
|
||||
}
|
||||
resultData.contains("#AIN") && refreshClick && this.testStatusCode <= TestStatus.CUVETTE_ABSENTR.code -> {
|
||||
@@ -631,6 +637,8 @@ class HemoCubeFragment : Fragment() {
|
||||
this.testStatusCode = TestStatus.CUVETTE_ABSENTR.code
|
||||
activity?.runOnUiThread {
|
||||
binding.testing.visibility = View.GONE
|
||||
binding.btnSamplestart.isClickable = false
|
||||
binding.btnSamplestart.isEnabled = false
|
||||
}
|
||||
showRetryButtonForCuvette()
|
||||
}
|
||||
@@ -643,6 +651,8 @@ class HemoCubeFragment : Fragment() {
|
||||
binding.btnRetryCheckCuvette.visibility = View.GONE
|
||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
binding.btnSamplestart.isClickable = false
|
||||
binding.btnSamplestart.isEnabled = false
|
||||
}
|
||||
}
|
||||
resultData.contains("#AIN") && this.testStatusCode <= TestStatus.CUVETTE_ABSENT.code -> {
|
||||
@@ -650,6 +660,8 @@ class HemoCubeFragment : Fragment() {
|
||||
this.testStatusCode = TestStatus.CUVETTE_ABSENT.code
|
||||
activity?.runOnUiThread {
|
||||
binding.testing.visibility = View.GONE
|
||||
binding.btnSamplestart.isClickable = false
|
||||
binding.btnSamplestart.isEnabled = false
|
||||
}
|
||||
showRetryButtonForCuvette()
|
||||
}
|
||||
@@ -733,8 +745,8 @@ class HemoCubeFragment : Fragment() {
|
||||
hemoCubeViewModel.messages.postValue(
|
||||
getString(R.string.sample_completed) + "\n" + getString(R.string.gathering_data)
|
||||
)
|
||||
fetchResult()
|
||||
currentResultData = ""
|
||||
fetchResult()
|
||||
}
|
||||
|
||||
resultData.contains("ovf") -> {
|
||||
@@ -956,7 +968,7 @@ class HemoCubeFragment : Fragment() {
|
||||
getString(R.string.data_collected_processing_data)
|
||||
)
|
||||
|
||||
val resultLines = resultData.split("\\s+(?=LB|LS)".toRegex())
|
||||
val resultLines = currentResultData.split("\\s+(?=LB|LS)".toRegex())
|
||||
var bufferIntensity = resultLines[1].split(' ')[1].trim()
|
||||
led1BufferForDevice = if (isUsingExistingBuffer) {
|
||||
sharedPreferences.getString(Constants.BUFFER_VALUE_1, "")?.toDoubleOrNull()!!
|
||||
@@ -1110,7 +1122,7 @@ class HemoCubeFragment : Fragment() {
|
||||
val deviceRatio = led2Average / led1Average
|
||||
val borderlineMetric = (led1Average - led2Average) / deviceRatio
|
||||
// activity?.runOnUiThread {
|
||||
// Toast.makeText(requireContext(),"led1Average: $led1Average, led2Average: $led2Average",Toast.LENGTH_LONG).show()
|
||||
// Toast.makeText(requireContext(),"count: ${DataHolder.sampleReadCounter}",Toast.LENGTH_LONG).show()
|
||||
// }
|
||||
if(led1Average < 0 || led2Average < 0){
|
||||
hemoCubeViewModel.messages.postValue("Negative Absorbance - Repeat test with reading Buffer first and sample second")
|
||||
@@ -1339,6 +1351,10 @@ class HemoCubeFragment : Fragment() {
|
||||
"%.3f".format(
|
||||
this.deviceRatio
|
||||
)
|
||||
} : ${
|
||||
"%.3f".format(
|
||||
borderlineMetric
|
||||
)
|
||||
}"
|
||||
)
|
||||
if (DataHolder.hemoCubeTestData?.testType == "HB")
|
||||
|
||||
@@ -422,6 +422,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
testDetails?.centerName = sharedPreference.getString(Constants.CENTER_NAME, "").toString()
|
||||
testDetails?.district = sharedPreference.getString(Constants.DISTRICT, "").toString()
|
||||
testDetails?.ipAddress = sharedPreference.getString(Constants.IP_ADDRESS, "").toString()
|
||||
testDetails?.configUpdatedRecent = sharedPreference.getString(Constants.LAST_UPDATED, "NA").toString()
|
||||
}
|
||||
|
||||
private fun addResultTestToDb(quickCapture: Boolean) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.content.SharedPreferences
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.hardware.usb.UsbDeviceConnection
|
||||
import android.hardware.usb.UsbManager
|
||||
import android.icu.text.SimpleDateFormat
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
@@ -49,6 +50,8 @@ import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import `in`.sminnovations.hpostesting.R
|
||||
import `in`.sminnovations.hpostesting.databinding.ActivityHemocubeBinding
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
|
||||
@AndroidEntryPoint
|
||||
open class HemocubeActivity : AppCompatActivity() {
|
||||
@@ -158,7 +161,11 @@ open class HemocubeActivity : AppCompatActivity() {
|
||||
val bufferMaxLed1 = remoteConfig.getDouble("bufferMaxLed1")
|
||||
val bufferMinLed2 = remoteConfig.getDouble("bufferMinLed2")
|
||||
val bufferMaxLed2 = remoteConfig.getDouble("bufferMaxLed2")
|
||||
val time = SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||
).format(Calendar.getInstance().time).toString()
|
||||
with(sharedPreferences.edit()) {
|
||||
putString(Constants.LAST_UPDATED, time)
|
||||
putString("bufferMinLed1", bufferMinLed1.toString())
|
||||
putString("bufferMaxLed1", bufferMaxLed1.toString())
|
||||
putString("bufferMinLed2", bufferMinLed2.toString())
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
android:id="@+id/cv_item3"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginStart="16dp"
|
||||
app:cardElevation="8dp"
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
android:id="@+id/et_blood_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/select_blood_group"
|
||||
android:text="@string/select_blood_group"
|
||||
android:inputType="none"
|
||||
android:labelFor="@id/til_blood_group"
|
||||
app:simpleItems="@array/blood_group" />
|
||||
@@ -143,6 +143,7 @@
|
||||
android:id="@+id/rv_order_offline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -86,16 +86,26 @@
|
||||
android:text="@string/add"
|
||||
app:cornerRadius="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/spinnerCuvette"
|
||||
|
||||
app:layout_constraintStart_toEndOf="@id/spinnerCuvette"
|
||||
app:layout_constraintTop_toTopOf="@id/spinnerCuvette" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/last_updated"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="Last"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_add_size"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="30dp"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/spinnerCuvette"
|
||||
app:layout_constraintTop_toBottomOf="@+id/last_updated"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
Reference in New Issue
Block a user