new 124 version with cuvette size option
This commit is contained in:
@@ -16,7 +16,7 @@ android {
|
||||
|
||||
// dev -> development, quality -> qc, uat -> User Acceptance Testing, preprod -> preproduction, prod -> production, iocl -> iocl-iisc production
|
||||
defaultConfig {
|
||||
applicationId "in.sminnovations.hpostesting.quality"
|
||||
applicationId "in.sminnovations.hpostesting.iocl"
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
versionCode 124
|
||||
@@ -169,5 +169,6 @@ dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||
implementation 'io.nats:jnats:2.11.4'
|
||||
implementation 'org.apache.commons:commons-math3:3.6.1'
|
||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
|
||||
|
||||
}
|
||||
@@ -1,40 +1,21 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "1004619739289",
|
||||
"project_id": "hpos-qa",
|
||||
"storage_bucket": "hpos-qa.appspot.com"
|
||||
"project_number": "630821402019",
|
||||
"project_id": "iocl-iisc",
|
||||
"storage_bucket": "iocl-iisc.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:1004619739289:android:f669b47552748433e5c808",
|
||||
"mobilesdk_app_id": "1:630821402019:android:ed56bae066ac32b51dd616",
|
||||
"android_client_info": {
|
||||
"package_name": "in.sminnovations.hposregistration.quality"
|
||||
"package_name": "in.sminnovations.hpostesting.iocl"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC4d4GhWHr_NMJAeBvnztQ_yQ3Qe9MAnLs"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:1004619739289:android:8397cd1f0357bd89e5c808",
|
||||
"android_client_info": {
|
||||
"package_name": "in.sminnovations.hpostesting.quality"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC4d4GhWHr_NMJAeBvnztQ_yQ3Qe9MAnLs"
|
||||
"current_key": "AIzaSyABIdxI89eTZ8BqU2cIoJOgJ1lS1cFLCtQ"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
|
||||
@@ -21,7 +21,7 @@ object Constants {
|
||||
const val DOCUMENT_ID_FOR_UPDATE ="2o71vBKLqdgEKYtFG8Lb"
|
||||
const val ABHA_APP_PACKAGE = "in.ndhm.phr"
|
||||
|
||||
const val MOLBIO_INTEGRATION = true
|
||||
const val MOLBIO_INTEGRATION = false
|
||||
const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in"
|
||||
const val deviceProvisionPassword = "f2ab0e7f9d69"
|
||||
const val DEVICE_ID_API = "deviceIDAPI"
|
||||
@@ -260,7 +260,7 @@ object Constants {
|
||||
const val BUFFER_VALUE_4 = "BufferValue4"
|
||||
const val DEVICE_ID = "DEVICE_ID"
|
||||
const val LABNAME = "LAB_NAME"
|
||||
|
||||
const val CUVETTE_SIZE = "CUVETTE_SIZE"
|
||||
const val IS_TOKEN_AVAILABLE = "IS_TOKEN_AVAILABLE"
|
||||
const val BUFFER_LED_LOWER_BOUND = 21000
|
||||
const val BUFFER_LED_UPPER_BOUND = 23500
|
||||
@@ -1735,5 +1735,32 @@ object Constants {
|
||||
listOf(0.0, 0.0)
|
||||
)
|
||||
)
|
||||
|
||||
//Hemocube for 10mm
|
||||
const val positiveBoderLine10mm1 = 1.15
|
||||
const val positiveBoderLine10mm2 = 1.66
|
||||
const val negativeBoderLine10mm = 2.4
|
||||
const val normalMin10mm = 0.11
|
||||
const val normalMax10mm = 0.23
|
||||
const val negativeBorderlineMin10mm = 0.23
|
||||
const val negativeBorderlineMax10mm = 0.25
|
||||
const val sickleCellTraitMin10mm = 0.25
|
||||
const val sickleCellTraitMax10mm = 0.31
|
||||
const val positiveForSickleCellMin10mm = 0.31
|
||||
const val positiveForSickleCellMax10mm = 0.39
|
||||
const val sickleCellDiseaseMin10mm = 0.39
|
||||
const val sickleCellDiseaseMax10mm = 1.0
|
||||
//Hemocube for 2mm
|
||||
const val positiveBoderLine2mm1 = 1.15
|
||||
const val positiveBoderLine2mm2 = 1.66
|
||||
const val negativeBoderLine2mm = 2.4
|
||||
const val normalMin2mm = 0.11
|
||||
const val normalMax2mm = 0.23
|
||||
const val negativeBorderlineMin2mm = 0.23
|
||||
const val negativeBorderlineMax2mm = 0.25
|
||||
const val sickleCellTraitMin2mm = 0.25
|
||||
const val sickleCellTraitMax2mm = 0.31
|
||||
const val positiveForSickleCellMin2mm = 0.31
|
||||
const val positiveForSickleCellMax2mm = 0.39
|
||||
const val sickleCellDiseaseMin2mm = 0.39
|
||||
const val sickleCellDiseaseMax2mm = 1.0
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import com.example.hpostesting.data.model.patient.UserData
|
||||
|
||||
@Database(
|
||||
entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class],
|
||||
version = 32,
|
||||
version = 33,
|
||||
exportSchema = false
|
||||
)
|
||||
@TypeConverters(Converters::class)
|
||||
|
||||
@@ -106,5 +106,6 @@ data class HemoCubeTestData(
|
||||
var filter: String? = "",
|
||||
var volume: String? = "",
|
||||
var isCSVCreated: Boolean = false,
|
||||
var labName: String? = ""
|
||||
var labName: String? = "",
|
||||
var cuvetteSize: String? = ""
|
||||
)
|
||||
|
||||
@@ -212,41 +212,41 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
|
||||
firebaseAppDistribution.updateIfNewReleaseAvailable()
|
||||
.addOnProgressListener { updateProgress ->
|
||||
|
||||
if (updateProgress.apkBytesDownloaded > 0) {
|
||||
Toast.makeText(
|
||||
this,
|
||||
"${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded / 1048576} /${updateProgress.apkFileTotalBytes / 1048576} MB",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
// (Optional) Handle errors.
|
||||
if (e is FirebaseAppDistributionException) {
|
||||
when (e.errorCode) {
|
||||
FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> {
|
||||
// SDK did nothing. This is expected when building for Play.
|
||||
}
|
||||
|
||||
else -> {
|
||||
// Handle other errors.
|
||||
Toast.makeText(
|
||||
this,
|
||||
"AppDistribution error, status: ${e.errorCode}",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
}
|
||||
.addOnSuccessListener {
|
||||
// Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
// val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
|
||||
// firebaseAppDistribution.updateIfNewReleaseAvailable()
|
||||
// .addOnProgressListener { updateProgress ->
|
||||
//
|
||||
// if (updateProgress.apkBytesDownloaded > 0) {
|
||||
// Toast.makeText(
|
||||
// this,
|
||||
// "${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded / 1048576} /${updateProgress.apkFileTotalBytes / 1048576} MB",
|
||||
// Toast.LENGTH_SHORT
|
||||
// ).show()
|
||||
// }
|
||||
// }
|
||||
// .addOnFailureListener { e ->
|
||||
// // (Optional) Handle errors.
|
||||
// if (e is FirebaseAppDistributionException) {
|
||||
// when (e.errorCode) {
|
||||
// FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> {
|
||||
// // SDK did nothing. This is expected when building for Play.
|
||||
// }
|
||||
//
|
||||
// else -> {
|
||||
// // Handle other errors.
|
||||
// Toast.makeText(
|
||||
// this,
|
||||
// "AppDistribution error, status: ${e.errorCode}",
|
||||
// Toast.LENGTH_SHORT
|
||||
// ).show()
|
||||
// }
|
||||
// }
|
||||
// FirebaseCrashlytics.getInstance().recordException(e)
|
||||
// }
|
||||
// }
|
||||
// .addOnSuccessListener {
|
||||
//// Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
}
|
||||
|
||||
override fun setConnect(connect: Boolean) {
|
||||
|
||||
@@ -20,6 +20,8 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -38,6 +40,8 @@ import `in`.sminnovations.hpostesting.databinding.FragmentSlideshowBinding
|
||||
private var isLanguageChanged = false
|
||||
|
||||
class SlideshowFragment : Fragment(){
|
||||
private var selectedItem = "10mm"
|
||||
private val values = arrayOf("10mm", "2mm")
|
||||
private lateinit var binding: FragmentSlideshowBinding
|
||||
private lateinit var sharedPreferences: SharedPreferences
|
||||
override fun onCreateView(
|
||||
@@ -54,6 +58,7 @@ class SlideshowFragment : Fragment(){
|
||||
|
||||
binding.nameEditText.setText(sharedPreferences.getString(Constants.LABNAME,""))
|
||||
|
||||
selectedItem = sharedPreferences.getString(Constants.CUVETTE_SIZE,"10mm").toString()
|
||||
|
||||
binding.btnGo.setOnClickListener {
|
||||
var labname = binding.nameEditText.text.toString()
|
||||
@@ -72,6 +77,35 @@ class SlideshowFragment : Fragment(){
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, values)
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
val pos: Int
|
||||
if(selectedItem == "10mm"){
|
||||
pos = 0
|
||||
}else{
|
||||
pos = 1
|
||||
}
|
||||
|
||||
binding.spinnerCuvette.adapter = adapter
|
||||
binding.spinnerCuvette.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
// Handle item selection here
|
||||
selectedItem = values[position]
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||
// Do nothing here
|
||||
}
|
||||
}
|
||||
binding.spinnerCuvette.setSelection(pos)
|
||||
binding.btnAddSize.setOnClickListener {
|
||||
with(sharedPreferences.edit()) {
|
||||
putString(Constants.CUVETTE_SIZE, selectedItem)
|
||||
apply()
|
||||
}
|
||||
Toast.makeText(requireContext(), "Selected cuvette size: $selectedItem", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
childFragmentManager.beginTransaction().replace(binding.container.id,PrefsFragment()).commit()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,11 @@ class LoginFragment : Fragment() {
|
||||
} else {
|
||||
if (loginId.isBlank()) {
|
||||
binding.loginId.error = R.string.enter_proper_login_id.toString()
|
||||
Log.d("LoginFragment","enter proper login id")
|
||||
}
|
||||
if (password.isBlank()) {
|
||||
binding.password.error = R.string.enter_proper_password.toString()
|
||||
Log.d("LoginFragment","enter proper password")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +99,7 @@ class LoginFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun navigateToHomeFragment() {
|
||||
Log.d("LoginFragment","Login Successful")
|
||||
findNavController().navigate(R.id.action_loginFragment_to_homeFragment)
|
||||
}
|
||||
|
||||
@@ -108,9 +111,11 @@ class LoginFragment : Fragment() {
|
||||
navigateToHomeFragment()
|
||||
return
|
||||
} else {
|
||||
Log.d("LoginFragment","wrong password")
|
||||
Toast.makeText(requireContext(), R.string.wrong_password, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
Log.d("LoginFragment","wrong password")
|
||||
Toast.makeText(requireContext(), R.string.wrong_user_id, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@ import java.util.Locale
|
||||
|
||||
class DiagnosticsFragment : Fragment() {
|
||||
// Initialize variables to store LED DAC values
|
||||
var led1Dac: Int? = null
|
||||
var led2Dac: Int? = null
|
||||
var led3Dac: Int? = null
|
||||
var led4Dac: Int? = null
|
||||
var led1Dac: Double? = null
|
||||
var led2Dac: Double? = null
|
||||
var led3Dac: Double? = null
|
||||
var led4Dac: Double? = null
|
||||
private var currentProgress = 0
|
||||
private val targetProgress = 95 // Target progress value
|
||||
private val delayBetweenIncrements = 1500
|
||||
@@ -383,11 +383,38 @@ class DiagnosticsFragment : Fragment() {
|
||||
if (!ledDataMap.containsKey(ledName)) {
|
||||
ledDataMap[ledName] = mutableListOf()
|
||||
}
|
||||
if ((ledDataMap[ledName]?.size ?: 0) < 6) {
|
||||
ledDataMap[ledName]?.add(xValue to yValue)
|
||||
if ((ledDataMap[ledName]?.size ?: 0) < 7) {
|
||||
if(xValue != 0.0){
|
||||
ledDataMap[ledName]?.add(xValue to yValue)
|
||||
}
|
||||
}
|
||||
// ledDataMap[ledName]?.add(xValue to yValue)
|
||||
}
|
||||
// var valuesAdded = 0 // Track the number of values added
|
||||
//
|
||||
// for (match in matches) {
|
||||
// val ledName = match.groupValues[1]
|
||||
// val xValue = match.groupValues[2].toDouble()
|
||||
// val yValue = match.groupValues[3].toDouble()
|
||||
//
|
||||
// // Add x and y values to the corresponding lists based on the LED name
|
||||
// if (!ledDataMap.containsKey(ledName)) {
|
||||
// ledDataMap[ledName] = mutableListOf()
|
||||
// }
|
||||
//
|
||||
// // Check if we have already added one value, then add the next six
|
||||
// if (valuesAdded > 0 && (ledDataMap[ledName]?.size ?: 0) < 6) {
|
||||
// ledDataMap[ledName]?.add(xValue to yValue)
|
||||
// }
|
||||
//
|
||||
// // Increase the count of values added
|
||||
// valuesAdded++
|
||||
//
|
||||
// // Break the loop if we have added 6 values
|
||||
// if (valuesAdded >= 7) {
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
|
||||
// String array to store pass or fail messages for each LED
|
||||
val results = mutableListOf<String>()
|
||||
@@ -401,7 +428,7 @@ class DiagnosticsFragment : Fragment() {
|
||||
// Find LED DAC values using regex
|
||||
regex.findAll(resultData).forEach {
|
||||
val (led, dac) = it.destructured
|
||||
val dacValue = dac.toInt()
|
||||
val dacValue = dac.toDouble()
|
||||
|
||||
when (led.toInt()) {
|
||||
1 -> led1Dac = dacValue
|
||||
@@ -446,12 +473,20 @@ class DiagnosticsFragment : Fragment() {
|
||||
// Calculation for ADC value
|
||||
val adcValue = when (ledName) {
|
||||
"LED:1" -> 22000.0
|
||||
"LED:2", "LED:3" -> 18000.0
|
||||
"LED:2"-> 18000.0
|
||||
"LED:3" -> 18000.0
|
||||
"LED:4" -> 22000.0
|
||||
else -> 0.0
|
||||
}
|
||||
val ledValue = when (ledName) {
|
||||
"LED:1" -> led1Dac
|
||||
"LED:2" -> led2Dac
|
||||
"LED:3" -> led3Dac
|
||||
"LED:4" -> led4Dac
|
||||
else -> 0.0
|
||||
}
|
||||
val dacValue = calculateDAC(adcValue, slope, constant)
|
||||
val resultDAC = dacValue - led1Dac!!
|
||||
val resultDAC = dacValue - ledValue!!
|
||||
if(resultDAC < 200){
|
||||
currentResultData += "$ledName DAC LEVEL PASS (✓)\n"
|
||||
println("$ledName DAC LEVEL PASS")
|
||||
@@ -464,7 +499,7 @@ class DiagnosticsFragment : Fragment() {
|
||||
return message
|
||||
}
|
||||
|
||||
fun calculateDAC(adc: Double, slope: Double, constant: Double): Double {
|
||||
private fun calculateDAC(adc: Double, slope: Double, constant: Double): Double {
|
||||
return (adc - constant) / slope
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import kotlin.math.log10
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
class HemoCubeFragment : Fragment() {
|
||||
private var temperature=""
|
||||
private var cuvetteSize = "10mm"
|
||||
private var checkCuvette = false
|
||||
private var checkCuvetteSam = false
|
||||
private var sampleClick = false
|
||||
@@ -95,6 +96,7 @@ class HemoCubeFragment : Fragment() {
|
||||
sharedPreferences =
|
||||
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||
|
||||
cuvetteSize = sharedPreferences.getString(Constants.CUVETTE_SIZE,"10mm").toString()
|
||||
testState = TestState(
|
||||
testDetails = DataHolder.selectedTest?.toHemoCubeTestData(),
|
||||
)
|
||||
@@ -116,6 +118,7 @@ class HemoCubeFragment : Fragment() {
|
||||
binding.btnSubmit.isEnabled = false
|
||||
binding.btnSubmit.isClickable = false
|
||||
activity?.runOnUiThread {
|
||||
Log.d("HemoCubeFragment","Test Process completed, result saved")
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
binding.btnSubmit.visibility = View.GONE
|
||||
}
|
||||
@@ -130,8 +133,9 @@ class HemoCubeFragment : Fragment() {
|
||||
binding.tvTitle.visibility = View.GONE
|
||||
binding.btnGo.visibility = View.GONE
|
||||
// binding.btnPlacebuffer.visibility = View.GONE
|
||||
|
||||
binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id}"
|
||||
val cuvetteSize = sharedPreferences.getString(Constants.CUVETTE_SIZE,"10mm")
|
||||
val cuvetteText = "Cuvette Size: $cuvetteSize"
|
||||
binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id} \n\n $cuvetteText"
|
||||
binding.tvSubtitle4.text = "Config"
|
||||
|
||||
|
||||
@@ -149,25 +153,32 @@ class HemoCubeFragment : Fragment() {
|
||||
|
||||
|
||||
binding.btnSamplestart.setOnClickListener {
|
||||
|
||||
activity?.runOnUiThread {
|
||||
Log.d("HemoCubeFragment","Test Process started, Sample started")
|
||||
binding.testing.visibility = View.VISIBLE
|
||||
}
|
||||
sampleClick = true
|
||||
// if(checkCuvetteSam){
|
||||
if(checkCuvetteSam){
|
||||
activity?.runOnUiThread {
|
||||
binding.tvSubtitle4.visibility = View.VISIBLE
|
||||
// binding.tvSubtitle4.text = "Sample Started"
|
||||
}
|
||||
startSampleProcess()
|
||||
// it.visibility = View.GONE
|
||||
// }else{
|
||||
// checkCuvettePresence()
|
||||
// }
|
||||
it.visibility = View.GONE
|
||||
}else{
|
||||
checkCuvettePresence()
|
||||
}
|
||||
}
|
||||
binding.btnRetryCheckCuvette.setOnClickListener {
|
||||
|
||||
Log.d("HemoCubeFragment","Retry Check Cuvette")
|
||||
checkCuvettePresence()
|
||||
}
|
||||
binding.btnPlacebuffer.setOnClickListener {
|
||||
// if(checkCuvette){
|
||||
activity?.runOnUiThread {
|
||||
Log.d("HemoCubeFragment","Test Process started, Buffer started")
|
||||
binding.testing.visibility = View.VISIBLE
|
||||
}
|
||||
if(checkCuvette){
|
||||
|
||||
startBufferProcess()
|
||||
// if (isBufferValueAvailable() || !Constants.BLANK_EVERY_TEST) {
|
||||
@@ -182,9 +193,9 @@ class HemoCubeFragment : Fragment() {
|
||||
|
||||
// it.visibility = View.GONE
|
||||
// }
|
||||
// }else{
|
||||
// checkCuvettePresence()
|
||||
// }
|
||||
}else{
|
||||
checkCuvettePresence()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -464,7 +475,7 @@ class HemoCubeFragment : Fragment() {
|
||||
fetchResult()
|
||||
}
|
||||
//#EC for v0 and v1 and #RC for v2
|
||||
(resultData.contains("#RC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> {
|
||||
(resultData.contains("#EC") && this.testStatusCode < TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code) -> {
|
||||
this.testStatusCode = TestStatus.EPROM_ADC_RETRIEVAL_COMPLETED.code
|
||||
hemoCubeViewModel.messages.postValue("Ready to test")//EPROM ADC Loaded
|
||||
//checkCuvettePresence()
|
||||
@@ -472,7 +483,7 @@ class HemoCubeFragment : Fragment() {
|
||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
}
|
||||
// getTemp()
|
||||
getTemp()
|
||||
}
|
||||
(resultData.contains("#AC") && this.testStatusCode < TestStatus.TEMPERATURE_CHECK.code) -> {
|
||||
this.testStatusCode = TestStatus.TEMPERATURE_CHECK.code
|
||||
@@ -484,6 +495,7 @@ class HemoCubeFragment : Fragment() {
|
||||
this.testStatusCode = TestStatus.CUVETTE_PRESENTS.code
|
||||
activity?.runOnUiThread {
|
||||
checkCuvetteSam = true
|
||||
binding.testing.visibility = View.GONE
|
||||
binding.btnRetryCheckCuvette.visibility = View.GONE
|
||||
binding.btnPlacebuffer.visibility = View.GONE
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
@@ -492,6 +504,9 @@ class HemoCubeFragment : Fragment() {
|
||||
resultData.contains("#AIN") && sampleClick && this.testStatusCode <= TestStatus.CUVETTE_ABSENTS.code -> {
|
||||
hemoCubeViewModel.messages.postValue(getString(R.string.cuvette_absent))
|
||||
this.testStatusCode = TestStatus.CUVETTE_ABSENTS.code
|
||||
activity?.runOnUiThread {
|
||||
binding.testing.visibility = View.GONE
|
||||
}
|
||||
showRetryButtonForCuvette()
|
||||
}
|
||||
|
||||
@@ -500,6 +515,7 @@ class HemoCubeFragment : Fragment() {
|
||||
this.testStatusCode = TestStatus.CUVETTE_PRESENT.code
|
||||
activity?.runOnUiThread {
|
||||
checkCuvette = true
|
||||
binding.testing.visibility = View.GONE
|
||||
binding.btnRetryCheckCuvette.visibility = View.GONE
|
||||
binding.btnPlacebuffer.visibility = View.VISIBLE
|
||||
binding.btnSamplestart.visibility = View.VISIBLE
|
||||
@@ -508,6 +524,9 @@ class HemoCubeFragment : Fragment() {
|
||||
resultData.contains("#AIN") && this.testStatusCode <= TestStatus.CUVETTE_ABSENT.code -> {
|
||||
hemoCubeViewModel.messages.postValue(getString(R.string.cuvette_absent))
|
||||
this.testStatusCode = TestStatus.CUVETTE_ABSENT.code
|
||||
activity?.runOnUiThread {
|
||||
binding.testing.visibility = View.GONE
|
||||
}
|
||||
showRetryButtonForCuvette()
|
||||
}
|
||||
resultData.contains("#BS") && this.testStatusCode < TestStatus.BUFFER_STARTED.code -> {
|
||||
@@ -525,6 +544,7 @@ class HemoCubeFragment : Fragment() {
|
||||
resultData = ""
|
||||
// resultData.replace("#AIN","#BAIN",false)
|
||||
Log.d("resultDataBC",resultData)
|
||||
binding.testing.visibility = View.GONE
|
||||
binding.tvSubtitle4.text = getString(R.string.buffer_completed)
|
||||
// binding.btnSamplestart.visibility = View.VISIBLE
|
||||
binding.btnPlacebuffer.visibility = View.GONE
|
||||
@@ -547,6 +567,7 @@ class HemoCubeFragment : Fragment() {
|
||||
(resultData.contains("#SC") || resultData.contains("#SC1")) && this.testStatusCode < TestStatus.SAMPLE_COMPLETED.code -> {
|
||||
this.testStatusCode = TestStatus.SAMPLE_COMPLETED.code
|
||||
activity?.runOnUiThread {
|
||||
binding.testing.visibility = View.GONE
|
||||
binding.btnSamplestart.visibility = View.GONE
|
||||
}
|
||||
hemoCubeViewModel.messages.postValue(
|
||||
@@ -557,6 +578,9 @@ class HemoCubeFragment : Fragment() {
|
||||
}
|
||||
|
||||
resultData.contains("ovf") -> {
|
||||
activity?.runOnUiThread {
|
||||
binding.testing.visibility = View.GONE
|
||||
}
|
||||
hemoCubeViewModel.messages.postValue(
|
||||
getString(R.string.power_bank)
|
||||
)
|
||||
@@ -1021,6 +1045,7 @@ class HemoCubeFragment : Fragment() {
|
||||
led4Buffer = led4BufferForDevice
|
||||
appVersion = version
|
||||
labName = sharedPreferences.getString(Constants.LABNAME,"")
|
||||
cuvetteSize = sharedPreferences.getString(Constants.CUVETTE_SIZE,"")
|
||||
this.led1Sample = led1SampleForDevice
|
||||
this.led2Sample = led2SampleForDevice
|
||||
this.led3Sample = led3SampleForDevice
|
||||
@@ -1050,6 +1075,7 @@ class HemoCubeFragment : Fragment() {
|
||||
deviceRatioClass,
|
||||
borderlineMetric
|
||||
)
|
||||
Log.d("HemoCubeFragment",this.classificationResult)
|
||||
hemoCubeViewModel.messages.postValue(
|
||||
"${this.classificationResult} \n Device Ratio: ${
|
||||
"%.3f".format(
|
||||
@@ -1121,17 +1147,38 @@ class HemoCubeFragment : Fragment() {
|
||||
try {
|
||||
// hemoCubeViewModel.messages.postValue("post classification checks")
|
||||
if (deviceRatio != null && borderlineMetric != null) {
|
||||
if (deviceRatioClass == "Negative Borderline") {
|
||||
return if (borderlineMetric >= 2.4)
|
||||
"Borderline. Normal"
|
||||
else
|
||||
"Borderline. Sickle Cell Trait"
|
||||
}
|
||||
if (deviceRatioClass == "Positive for Sickle Cell. HPLC for Confirmation") {
|
||||
return if (borderlineMetric >= 1.4)//1.34
|
||||
"Borderline. Sickle Cell Trait"
|
||||
else
|
||||
"Borderline. Sickle Cell Disease"
|
||||
if(cuvetteSize == "10mm"){
|
||||
if (deviceRatioClass == "Negative Borderline") {
|
||||
return if (borderlineMetric >= Constants.negativeBoderLine10mm)
|
||||
"Borderline. Normal"
|
||||
else
|
||||
"Borderline. Sickle Cell Trait"
|
||||
}
|
||||
if (deviceRatioClass == "Positive for Sickle Cell. HPLC for Confirmation") {
|
||||
if (borderlineMetric < Constants.positiveBoderLine10mm1){//1.34
|
||||
return "Borderline. Sickle Cell Disease"
|
||||
}else if(borderlineMetric > Constants.positiveBoderLine10mm2){
|
||||
return "Borderline. Sickle Cell Trait"
|
||||
}else if(borderlineMetric > Constants.positiveBoderLine10mm1 && borderlineMetric < Constants.positiveBoderLine10mm2){
|
||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||
}
|
||||
}
|
||||
}else if(cuvetteSize == "2mm"){
|
||||
if (deviceRatioClass == "Negative Borderline") {
|
||||
return if (borderlineMetric >= Constants.negativeBoderLine2mm)
|
||||
"Borderline. Normal"
|
||||
else
|
||||
"Borderline. Sickle Cell Trait"
|
||||
}
|
||||
if (deviceRatioClass == "Positive for Sickle Cell. HPLC for Confirmation") {
|
||||
if (borderlineMetric < Constants.positiveBoderLine2mm1){//1.34
|
||||
return "Borderline. Sickle Cell Disease"
|
||||
}else if(borderlineMetric > Constants.positiveBoderLine2mm2){
|
||||
return "Borderline. Sickle Cell Trait"
|
||||
}else if(borderlineMetric > Constants.positiveBoderLine2mm1 && borderlineMetric < Constants.positiveBoderLine2mm2){
|
||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
@@ -1170,18 +1217,42 @@ class HemoCubeFragment : Fragment() {
|
||||
fun deviceRatioClassification(ratio: Double?): String {
|
||||
try {
|
||||
if (ratio != null) {
|
||||
if (ratio in 0.11..0.23) {
|
||||
if(cuvetteSize == "10mm"){
|
||||
if (ratio in Constants.normalMin10mm..Constants.normalMax10mm) {
|
||||
// setSubtitleTextColor(R.color.green_2)
|
||||
return "Normal"
|
||||
return "Normal"
|
||||
}
|
||||
if (ratio in Constants.negativeBorderlineMin10mm..Constants.negativeBorderlineMax10mm){
|
||||
return "Negative Borderline"
|
||||
}
|
||||
if (ratio in Constants.sickleCellTraitMin10mm..Constants.sickleCellTraitMax10mm){
|
||||
return "Sickle Cell Trait"
|
||||
}
|
||||
if (ratio in Constants.positiveForSickleCellMin10mm..Constants.positiveForSickleCellMax10mm){//0.36
|
||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||
}
|
||||
if (ratio in Constants.sickleCellDiseaseMin10mm..Constants.sickleCellDiseaseMax10mm){
|
||||
return "Sickle Cell Disease"
|
||||
}
|
||||
}else if(cuvetteSize == "2mm"){
|
||||
if (ratio in Constants.normalMin2mm..Constants.normalMax2mm) {
|
||||
// setSubtitleTextColor(R.color.green_2)
|
||||
return "Normal"
|
||||
}
|
||||
if (ratio in Constants.negativeBorderlineMin2mm..Constants.negativeBorderlineMax2mm){
|
||||
return "Negative Borderline"
|
||||
}
|
||||
if (ratio in Constants.sickleCellTraitMin2mm..Constants.sickleCellTraitMax2mm){
|
||||
return "Sickle Cell Trait"
|
||||
}
|
||||
if (ratio in Constants.positiveForSickleCellMin2mm..Constants.positiveForSickleCellMax2mm){//0.36
|
||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||
}
|
||||
if (ratio in Constants.sickleCellDiseaseMin2mm..Constants.sickleCellDiseaseMax2mm){
|
||||
return "Sickle Cell Disease"
|
||||
}
|
||||
}
|
||||
if (ratio in 0.23..0.25)
|
||||
return "Negative Borderline"
|
||||
if (ratio in 0.25..0.31)
|
||||
return "Sickle Cell Trait"
|
||||
if (ratio in 0.31..0.39)//0.36
|
||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||
if (ratio in 0.39..1.0)
|
||||
return "Sickle Cell Disease"
|
||||
|
||||
} else {
|
||||
return "Invalid"
|
||||
}
|
||||
@@ -1200,6 +1271,7 @@ class HemoCubeFragment : Fragment() {
|
||||
|
||||
fun handleException(e: Exception) {
|
||||
showToast(R.string.error_classification)
|
||||
Log.d("HemoCubeFragment",e.toString())
|
||||
Firebase.crashlytics.recordException(e)
|
||||
}
|
||||
|
||||
|
||||
@@ -414,6 +414,7 @@ class HemoCubeViewModel @Inject constructor(
|
||||
testDetails?.volume = DataHolder.hemoCubeTestData?.volume
|
||||
testDetails?.filter = DataHolder.hemoCubeTestData?.filter
|
||||
testDetails?.labName = DataHolder.hemoCubeTestData?.labName
|
||||
testDetails?.cuvetteSize = DataHolder.hemoCubeTestData?.cuvetteSize
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ open class HemocubeActivity : AppCompatActivity() {
|
||||
DataHolder.usbConnected.postValue(true)
|
||||
}
|
||||
} else {
|
||||
Log.d("HemoCubeActivity", "permission denied for device")
|
||||
onErrorReported("permission denied for device")
|
||||
DataHolder.usbConnected.postValue(true)
|
||||
}
|
||||
@@ -115,10 +116,12 @@ open class HemocubeActivity : AppCompatActivity() {
|
||||
if (it) {
|
||||
myMenu?.get(0)?.icon =
|
||||
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
||||
Log.d("HemoCubeActivity", "Device is Connected")
|
||||
} else {
|
||||
myMenu?.get(0)?.icon =
|
||||
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
||||
Toast.makeText(this, "Device is Disconnected", Toast.LENGTH_SHORT).show()
|
||||
Log.d("HemoCubeActivity", "Device is Disconnected")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,8 +133,10 @@ open class HemocubeActivity : AppCompatActivity() {
|
||||
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager)
|
||||
|
||||
if (availableDrivers.isEmpty()) {
|
||||
Log.d("HemoCubeActivity", "No Device is Connected")
|
||||
onErrorReported("No Device is Connected")
|
||||
} else {
|
||||
Log.d("HemoCubeActivity", "Device available")
|
||||
mDriver = availableDrivers[0]
|
||||
mConnection = manager.openDevice(mDriver.device)
|
||||
|
||||
|
||||
BIN
app/src/main/res/drawable/verified.gif
Normal file
BIN
app/src/main/res/drawable/verified.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 KiB |
BIN
app/src/main/res/drawable/virtual_lab.gif
Normal file
BIN
app/src/main/res/drawable/virtual_lab.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 828 KiB |
@@ -65,6 +65,7 @@
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="700"
|
||||
android:text="Name: SMI\n ID: 1672282828"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -77,7 +78,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="72dp"
|
||||
android:layout_marginTop="92dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="18sp"
|
||||
@@ -248,6 +249,7 @@
|
||||
android:textColor="@color/black"
|
||||
android:textSize="11sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_btns" />
|
||||
|
||||
@@ -265,14 +267,25 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/error_message" />
|
||||
|
||||
<ImageView
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/testing"
|
||||
android:visibility="gone"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/virtual_lab"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_device_messages" />
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/iv_check"
|
||||
android:visibility="gone"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/check"
|
||||
android:src="@drawable/verified"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_device_messages" />
|
||||
|
||||
@@ -55,12 +55,47 @@
|
||||
app:layout_constraintStart_toEndOf="@id/lab_name"
|
||||
app:layout_constraintTop_toTopOf="@id/lab_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_cuvette"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="Select Cuvette Size"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/lab_name"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="30dp"/>
|
||||
<Spinner
|
||||
android:id="@+id/spinnerCuvette"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerInParent="true"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_cuvette"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="30dp"
|
||||
/>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_add_size"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="24dp"
|
||||
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" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/lab_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/spinnerCuvette"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
Reference in New Issue
Block a user