Compare commits
15 Commits
2.1.99
...
dev-bulk-u
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c9903c759 | ||
|
|
dd1144d884 | ||
|
|
37c8dde5bd | ||
|
|
5f460f6aa3 | ||
|
|
ad625992a7 | ||
|
|
db518007b3 | ||
|
|
4d09bad516 | ||
|
|
aad33e3907 | ||
|
|
52279c4419 | ||
|
|
190a72e407 | ||
|
|
4aa6fb020b | ||
|
|
044a545979 | ||
|
|
1f9f8060cb | ||
|
|
4fef75b937 | ||
|
|
42b33c9397 |
@@ -14,13 +14,13 @@ android {
|
|||||||
compileSdk 34
|
compileSdk 34
|
||||||
namespace 'in.sminnovations.hpostesting'
|
namespace 'in.sminnovations.hpostesting'
|
||||||
|
|
||||||
// prod - production, preprod - preproduction, quality - qc, dev - development
|
// dev - development, quality - qc, uat - User Acceptance Test, preprod - preproduction, prod - production
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "in.sminnovations.hpostesting.quality"
|
applicationId "in.sminnovations.hpostesting.dev"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 99
|
versionCode 111
|
||||||
versionName "2.1.99"
|
versionName "2.1.111"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +1,205 @@
|
|||||||
{
|
{
|
||||||
"project_info": {
|
"project_info": {
|
||||||
"project_number": "1004619739289",
|
"project_number": "650071678820",
|
||||||
"project_id": "hpos-qa",
|
"project_id": "hpos-af3cc",
|
||||||
"storage_bucket": "hpos-qa.appspot.com"
|
"storage_bucket": "hpos-af3cc.appspot.com"
|
||||||
},
|
},
|
||||||
"client": [
|
"client": [
|
||||||
{
|
{
|
||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:1004619739289:android:f669b47552748433e5c808",
|
"mobilesdk_app_id": "1:650071678820:android:f1435a1c07f710036c6471",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "in.sminnovations.hposregistration.quality"
|
"package_name": "com.example.hposconsentform"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [],
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
"api_key": [
|
"api_key": [
|
||||||
{
|
{
|
||||||
"current_key": "AIzaSyC4d4GhWHr_NMJAeBvnztQ_yQ3Qe9MAnLs"
|
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"services": {
|
"services": {
|
||||||
"appinvite_service": {
|
"appinvite_service": {
|
||||||
"other_platform_oauth_client": []
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:1004619739289:android:8397cd1f0357bd89e5c808",
|
"mobilesdk_app_id": "1:650071678820:android:7865bef608cdee6f6c6471",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "in.sminnovations.hpostesting.quality"
|
"package_name": "com.smi.counselling"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [],
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
"api_key": [
|
"api_key": [
|
||||||
{
|
{
|
||||||
"current_key": "AIzaSyC4d4GhWHr_NMJAeBvnztQ_yQ3Qe9MAnLs"
|
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"services": {
|
"services": {
|
||||||
"appinvite_service": {
|
"appinvite_service": {
|
||||||
"other_platform_oauth_client": []
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:650071678820:android:2925e9ce3417d2386c6471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "in.sminnovations.hemocube"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-srhm9spm9hjn4frcd3r6o02gdhdbtd15.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "in.sminnovations.hemocube",
|
||||||
|
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:650071678820:android:7569c1cad4fc99916c6471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "in.sminnovations.hposregistration"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-70kp5jvjda4r5diqch2kn4lc40p4f42g.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "in.sminnovations.hposregistration",
|
||||||
|
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:650071678820:android:f96be19e5d43102b6c6471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "in.sminnovations.hpostesting"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-l87dnr0bdj95get0khgnvfv2an1k6ogq.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "in.sminnovations.hpostesting",
|
||||||
|
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:650071678820:android:a53292637abb7c0d6c6471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "in.sminnovations.hpostesting.dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,7 @@
|
|||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/title_activity_dashboard"
|
android:label="@string/title_activity_dashboard"
|
||||||
android:theme="@style/Theme.HPOS.NoActionBar"
|
android:theme="@style/Theme.HPOS.NoActionBar"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
tools:ignore="AppLinkUrlError,MissingClass">
|
tools:ignore="AppLinkUrlError,MissingClass">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -118,9 +119,8 @@
|
|||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="com.example.hpostesting.fileprovider"
|
android:authorities="com.example.hpostesting.qa.fileprovider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true">
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ object Constants {
|
|||||||
|
|
||||||
const val ABHA_APP_PACKAGE = "in.ndhm.phr"
|
const val ABHA_APP_PACKAGE = "in.ndhm.phr"
|
||||||
|
|
||||||
const val MOLBIO_INTERGATION = false
|
const val MOLBIO_INTEGRATION = false
|
||||||
const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in"
|
const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in"
|
||||||
const val deviceProvisionPassword = "f2ab0e7f9d69"
|
const val deviceProvisionPassword = "f2ab0e7f9d69"
|
||||||
const val DEVICE_ID_API = "deviceIDAPI"
|
const val DEVICE_ID_API = "deviceIDAPI"
|
||||||
|
|||||||
@@ -5,5 +5,8 @@ data class DiagnosticsData (
|
|||||||
var appVersion: String? = "",
|
var appVersion: String? = "",
|
||||||
var deviceType: String = "HEMOCUBE",
|
var deviceType: String = "HEMOCUBE",
|
||||||
var deviceData: String = "",
|
var deviceData: String = "",
|
||||||
|
var devicePassword: String = "",
|
||||||
|
var deviceNatsToken: String = "",
|
||||||
|
var accessToken: String = "",
|
||||||
var runTime: String = ""
|
var runTime: String = ""
|
||||||
)
|
)
|
||||||
@@ -4,7 +4,7 @@ import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
|||||||
|
|
||||||
data class MolbioV2Result(
|
data class MolbioV2Result(
|
||||||
val age: Int? = 31,
|
val age: Int? = 31,
|
||||||
val analysisDate: String? = "",
|
val analysisDate: String? = "2024-02-08 16:33:56",
|
||||||
val analysisId: String? = "",
|
val analysisId: String? = "",
|
||||||
val analysisStatus: String? = "",
|
val analysisStatus: String? = "",
|
||||||
val analysisType: String? = "HPOS",
|
val analysisType: String? = "HPOS",
|
||||||
@@ -12,11 +12,11 @@ data class MolbioV2Result(
|
|||||||
val bloodGroup: String? = "",
|
val bloodGroup: String? = "",
|
||||||
val coefficients: List<Int>? = listOf(22, 22),
|
val coefficients: List<Int>? = listOf(22, 22),
|
||||||
val collectionLocation: List<Any>? = listOf(),
|
val collectionLocation: List<Any>? = listOf(),
|
||||||
val collectionTime: String? = "",
|
val collectionTime: String? = "2024-02-08 16:33:56",
|
||||||
val collector: String? = "",
|
val collector: String? = "",
|
||||||
val curveFitting: String? = "Linear",
|
val curveFitting: String? = "Linear",
|
||||||
val deviceName: String? = "HPOS",
|
val deviceName: String? = "HPOS",
|
||||||
val expiryTime: String? = "",
|
val expiryTime: String? = "2024-02-08 16:33:56",
|
||||||
val gender: String? = "",
|
val gender: String? = "",
|
||||||
val interpretation: String? = "",
|
val interpretation: String? = "",
|
||||||
val `operator`: String? = "",
|
val `operator`: String? = "",
|
||||||
@@ -30,7 +30,7 @@ data class MolbioV2Result(
|
|||||||
val testId: String? = "",
|
val testId: String? = "",
|
||||||
val testResult: String? = "",
|
val testResult: String? = "",
|
||||||
val testStatus: String? = "",
|
val testStatus: String? = "",
|
||||||
val testTime: String? = "",
|
val testTime: String? = "2024-02-08 16:33:56",
|
||||||
val testType: String? = "",
|
val testType: String? = "",
|
||||||
val thresholds: String? = "",
|
val thresholds: String? = "",
|
||||||
val underMedication: Boolean? = false,
|
val underMedication: Boolean? = false,
|
||||||
|
|||||||
@@ -223,26 +223,40 @@ class KitScanActivity : AppCompatActivity(), IDcsSdkApiDelegate {
|
|||||||
notifications_mask or DCSSDKDefs.DCSSDK_EVENT.DCSSDK_EVENT_BARCODE.value
|
notifications_mask or DCSSDKDefs.DCSSDK_EVENT.DCSSDK_EVENT_BARCODE.value
|
||||||
sdkHandler!!.dcssdkSubsribeForEvents(notifications_mask)
|
sdkHandler!!.dcssdkSubsribeForEvents(notifications_mask)
|
||||||
mScannerInfoList.addAll(sdkHandler!!.dcssdkGetAvailableScannersList())
|
mScannerInfoList.addAll(sdkHandler!!.dcssdkGetAvailableScannersList())
|
||||||
sdkHandler!!.dcssdkEstablishCommunicationSession(mScannerInfoList[0].scannerID)
|
Log.e("scannersize",sdkHandler!!.dcssdkGetAvailableScannersList().size.toString())
|
||||||
|
if (mScannerInfoList.isNotEmpty()) {
|
||||||
|
sdkHandler!!.dcssdkEstablishCommunicationSession(mScannerInfoList[0].scannerID)
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this,"Error", Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pullTrigger() {
|
private fun pullTrigger() {
|
||||||
if (!mScannerInfoList[0].isActive) {
|
// Check if the list is not empty before accessing its elements
|
||||||
sdkHandler!!.dcssdkEstablishCommunicationSession(mScannerInfoList[0].scannerID)
|
if (mScannerInfoList.isNotEmpty()) {
|
||||||
|
// Only proceed if the scanner is not active
|
||||||
|
if (!mScannerInfoList[0].isActive) {
|
||||||
|
sdkHandler?.dcssdkEstablishCommunicationSession(mScannerInfoList[0].scannerID)
|
||||||
|
}
|
||||||
|
val inXML = "<inArgs><scannerID> 1 </scannerID></inArgs>"
|
||||||
|
val outXML = StringBuilder()
|
||||||
|
val result: DCSSDK_RESULT =
|
||||||
|
sdkHandler!!.dcssdkExecuteCommandOpCodeInXMLForScanner(
|
||||||
|
DCSSDK_COMMAND_OPCODE.DCSSDK_DEVICE_PULL_TRIGGER, inXML, outXML, mScannerInfoList[0].scannerID // Ensure you're using the correct scanner ID
|
||||||
|
)
|
||||||
|
if (result == DCSSDK_RESULT.DCSSDK_RESULT_SUCCESS) {
|
||||||
|
Log.d("Scanning", "Success")
|
||||||
|
} else if (result == DCSSDK_RESULT.DCSSDK_RESULT_FAILURE) {
|
||||||
|
Log.d("Scanning", "Failed")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle the case where the list is empty, perhaps notify the user or log an error
|
||||||
|
Log.e("ScannerError", "No scanners are connected or available.")
|
||||||
}
|
}
|
||||||
val inXML = "<inArgs><scannerID> 1 </scannerID></inArgs>"
|
|
||||||
val outXML = StringBuilder()
|
|
||||||
val result: DCSSDK_RESULT =
|
|
||||||
sdkHandler!!.dcssdkExecuteCommandOpCodeInXMLForScanner(
|
|
||||||
DCSSDK_COMMAND_OPCODE.DCSSDK_DEVICE_PULL_TRIGGER, inXML, outXML, 1
|
|
||||||
)
|
|
||||||
if (result == DCSSDK_RESULT.DCSSDK_RESULT_SUCCESS) Log.d(
|
|
||||||
"Scanning",
|
|
||||||
"Success"
|
|
||||||
) else if (result == DCSSDK_RESULT.DCSSDK_RESULT_FAILURE) Log.d("Scanning", "Failed")
|
|
||||||
//new MyAsyncTask(1, DCSSDKDefs.DCSSDK_COMMAND_OPCODE.DCSSDK_DEVICE_PULL_TRIGGER,null).execute(inXML);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//this function is called if barcode is detected.
|
//this function is called if barcode is detected.
|
||||||
override fun dcssdkEventBarcode(barcodeData: ByteArray?, barcodeType: Int, fromScannerID: Int) {
|
override fun dcssdkEventBarcode(barcodeData: ByteArray?, barcodeType: Int, fromScannerID: Int) {
|
||||||
val result = String(barcodeData!!)
|
val result = String(barcodeData!!)
|
||||||
|
|||||||
@@ -149,6 +149,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
Constants.DEVICE_TYPE_HEMOCUBE
|
Constants.DEVICE_TYPE_HEMOCUBE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device.productId == 4614 && device.vendorId == 7111 -> {
|
||||||
|
binding.cvItem1.visibility = View.VISIBLE
|
||||||
|
binding.cvItem3.visibility = View.VISIBLE
|
||||||
|
binding.cvItem2.visibility = View.GONE
|
||||||
|
binding.cvItem4.visibility = View.GONE
|
||||||
|
DataHolder.deviceType.postValue(Constants.DEVICE_TYPE_HEMOCUBE)
|
||||||
|
Constants.DEVICE_TYPE_HEMOCUBE
|
||||||
|
}
|
||||||
|
|
||||||
device.productId == Constants.DEVICE_PRODUCT_ID && device.vendorId == Constants.DEVICE_VENDOR_ID -> {
|
device.productId == Constants.DEVICE_PRODUCT_ID && device.vendorId == Constants.DEVICE_VENDOR_ID -> {
|
||||||
Log.d(
|
Log.d(
|
||||||
TAG,
|
TAG,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import android.view.ViewGroup
|
|||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.example.hpostesting.data.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.constant.Constants
|
import com.example.hpostesting.data.constant.Constants
|
||||||
@@ -30,6 +31,9 @@ class AssuranceControlsFragment: Fragment() {
|
|||||||
binding = FragmentAssuranceControlsBinding.inflate(inflater, container, false)
|
binding = FragmentAssuranceControlsBinding.inflate(inflater, container, false)
|
||||||
sharedPreferences =
|
sharedPreferences =
|
||||||
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
DataHolder.hemoCubeTestData!!.solution = ""
|
||||||
|
DataHolder.hemoCubeTestData!!.volume = ""
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +46,7 @@ class AssuranceControlsFragment: Fragment() {
|
|||||||
// binding.btnSubmit.visibility = View.GONE
|
// binding.btnSubmit.visibility = View.GONE
|
||||||
|
|
||||||
val solutionSpinner: Spinner = binding.spinnerSolutions
|
val solutionSpinner: Spinner = binding.spinnerSolutions
|
||||||
val solutionOptions = arrayOf("Select solution", "Tartrazine", "AR")
|
val solutionOptions = arrayOf("Select solution", "Tartrazine", "Acid Red")
|
||||||
val solutionAdapter = ArrayAdapter(requireContext(), R.layout.simple_spinner_item, solutionOptions)
|
val solutionAdapter = ArrayAdapter(requireContext(), R.layout.simple_spinner_item, solutionOptions)
|
||||||
solutionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
solutionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
solutionSpinner.adapter = solutionAdapter
|
solutionSpinner.adapter = solutionAdapter
|
||||||
@@ -121,6 +125,13 @@ class AssuranceControlsFragment: Fragment() {
|
|||||||
volumeSpinner.setSelection(volumePosition)
|
volumeSpinner.setSelection(volumePosition)
|
||||||
|
|
||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
|
val selectedSolution = DataHolder.hemoCubeTestData!!.solution
|
||||||
|
val selectedVolume = DataHolder.hemoCubeTestData!!.volume
|
||||||
|
if (selectedSolution == "Select solution" || selectedVolume == "Select volume") {
|
||||||
|
Toast.makeText(requireContext(), "Please select both solution and volume", Toast.LENGTH_SHORT).show()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
DataHolder.hemoCubeTestData!!.quickCapture = true
|
DataHolder.hemoCubeTestData!!.quickCapture = true
|
||||||
val currentUnixTime = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
val currentUnixTime = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
Instant.now().epochSecond
|
Instant.now().epochSecond
|
||||||
|
|||||||
@@ -105,8 +105,6 @@ class AutoDacFragment: Fragment() {
|
|||||||
HemoCubeCommands.AUTO_DAC_COMMAND,
|
HemoCubeCommands.AUTO_DAC_COMMAND,
|
||||||
object : UsbServiceListener {
|
object : UsbServiceListener {
|
||||||
override fun onUsbRead(data: ByteArray?) {
|
override fun onUsbRead(data: ByteArray?) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
override fun onUsbError(e: Exception?) {
|
override fun onUsbError(e: Exception?) {
|
||||||
autoDacViewModel.progressBar.postValue(false)
|
autoDacViewModel.progressBar.postValue(false)
|
||||||
@@ -148,6 +146,9 @@ class AutoDacFragment: Fragment() {
|
|||||||
autoDacViewModel.addAutoDacDataToDb(
|
autoDacViewModel.addAutoDacDataToDb(
|
||||||
DiagnosticsData(
|
DiagnosticsData(
|
||||||
deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString(),
|
deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString(),
|
||||||
|
devicePassword = sharedPreferences.getString(Constants.DEVICE_PASSWORD_API, "").toString(),
|
||||||
|
deviceNatsToken = sharedPreferences.getString(Constants.NATS_TOKEN, "").toString(),
|
||||||
|
accessToken = sharedPreferences.getString(Constants.ACCESS_TOKEN, "").toString(),
|
||||||
deviceData = resultData,
|
deviceData = resultData,
|
||||||
runTime = SimpleDateFormat(
|
runTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
@@ -169,7 +170,6 @@ class AutoDacFragment: Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun parseData(inputData: List<String>): List<Pair<String, String>> {
|
fun parseData(inputData: List<String>): List<Pair<String, String>> {
|
||||||
val pattern = Regex("([A-Z]+)\\s(\\d+)")
|
val pattern = Regex("([A-Z]+)\\s(\\d+)")
|
||||||
val parsedData = mutableListOf<Pair<String, String>>()
|
val parsedData = mutableListOf<Pair<String, String>>()
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
|
|||||||
|
|
||||||
val uri: Uri = FileProvider.getUriForFile(
|
val uri: Uri = FileProvider.getUriForFile(
|
||||||
this,
|
this,
|
||||||
"com.example.hpostesting.fileprovider",
|
"com.example.hpostesting.qa.fileprovider",
|
||||||
file
|
file
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.example.hpostesting.presentation.dashboard
|
package com.example.hpostesting.presentation.dashboard
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
@@ -14,12 +15,13 @@ import com.example.hpostesting.data.constant.Constants
|
|||||||
import com.example.hpostesting.presentation.autodac.AutoDacActivity
|
import com.example.hpostesting.presentation.autodac.AutoDacActivity
|
||||||
import com.example.hpostesting.presentation.buffercheck.HemocubeBufferCheckActivity
|
import com.example.hpostesting.presentation.buffercheck.HemocubeBufferCheckActivity
|
||||||
import com.example.hpostesting.presentation.calibration.CalibrationActivity
|
import com.example.hpostesting.presentation.calibration.CalibrationActivity
|
||||||
import com.example.hpostesting.presentation.deviceprovision.DeviceProvisionActivity
|
|
||||||
import com.example.hpostesting.presentation.deviceinfo.DeviceActivity
|
import com.example.hpostesting.presentation.deviceinfo.DeviceActivity
|
||||||
|
import com.example.hpostesting.presentation.deviceprovision.DeviceProvisionActivity
|
||||||
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
import com.example.hpostesting.presentation.diagnostics.DiagnosticsActivity
|
||||||
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
||||||
|
|
||||||
|
|
||||||
class GalleryFragment : Fragment() {
|
class GalleryFragment : Fragment() {
|
||||||
|
|
||||||
private var _binding: FragmentGalleryBinding? = null
|
private var _binding: FragmentGalleryBinding? = null
|
||||||
@@ -82,6 +84,19 @@ class GalleryFragment : Fragment() {
|
|||||||
startActivity(Intent(requireContext(), DeviceActivity::class.java))
|
startActivity(Intent(requireContext(), DeviceActivity::class.java))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.btnFirefox.setOnClickListener {
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW)
|
||||||
|
intent.component = ComponentName("org.mozilla.firefox", "org.mozilla.gecko.BrowserApp")
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.btnFiles.setOnClickListener {
|
||||||
|
val intent = Intent(Intent.ACTION_GET_CONTENT)
|
||||||
|
intent.type = "file/*"
|
||||||
|
startActivity(intent)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
userid = sharedPreferences.getString(Constants.USER_ID, "").toString()
|
userid = sharedPreferences.getString(Constants.USER_ID, "").toString()
|
||||||
binding.tvSubtitle4.text = "Login ID : ${userid}"
|
binding.tvSubtitle4.text = "Login ID : ${userid}"
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,40 @@ class HomeFragment : Fragment() {
|
|||||||
setSearch()
|
setSearch()
|
||||||
checkForLocalDBData()
|
checkForLocalDBData()
|
||||||
checkForTokenAndUpdate()
|
checkForTokenAndUpdate()
|
||||||
|
|
||||||
|
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
||||||
|
val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
|
||||||
|
userDataList.forEach { userData ->
|
||||||
|
if (!userData.molbioFlag && isTokenAvailable) {
|
||||||
|
resultList.results?.add(
|
||||||
|
MolbioV2Result(
|
||||||
|
rawData = userData,
|
||||||
|
analysisId = userData._id,
|
||||||
|
analysisDate = "2024-02-08 16:33:56",
|
||||||
|
analysisStatus = userData.classificationResult,
|
||||||
|
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(),
|
||||||
|
interpretation = userData.classificationResult,
|
||||||
|
testId = userData._id,
|
||||||
|
testTime = userData.testTime,
|
||||||
|
collectionTime = "2024-02-08 16:33:56",//userData.testTime,
|
||||||
|
expiryTime = "2024-02-08 16:33:56"//userData.testTime,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (!userData.molbioFlag && isTokenAvailable) {
|
||||||
|
userData.molbioFlag = true
|
||||||
|
hemoCubeViewModel.uploadResult(resultList)
|
||||||
|
}
|
||||||
|
if (!userData.localFlag) {
|
||||||
|
userData.localFlag = true
|
||||||
|
hemoCubeViewModel.bulkAddResultTestToDb(userData)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding.internetAvailableCL.visibility = View.GONE
|
binding.internetAvailableCL.visibility = View.GONE
|
||||||
binding.internetNotAvailableCL.visibility = View.VISIBLE
|
binding.internetNotAvailableCL.visibility = View.VISIBLE
|
||||||
@@ -149,9 +183,9 @@ class HomeFragment : Fragment() {
|
|||||||
val btnSaveLocalVisibility =
|
val btnSaveLocalVisibility =
|
||||||
if (userData.any { it.testStatus == true }) View.VISIBLE else View.GONE
|
if (userData.any { it.testStatus == true }) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
binding.btnSaveLocal.visibility = btnSaveLocalVisibility
|
binding.downloadCSV.visibility = btnSaveLocalVisibility
|
||||||
|
|
||||||
binding.btnSaveLocal.setOnClickListener {
|
binding.downloadCSV.setOnClickListener {
|
||||||
if (btnSaveLocalVisibility == View.VISIBLE) {
|
if (btnSaveLocalVisibility == View.VISIBLE) {
|
||||||
// Execute the action when the button is visible (testStatus is true for at least one user)
|
// Execute the action when the button is visible (testStatus is true for at least one user)
|
||||||
showDownloadDialog(requireContext())
|
showDownloadDialog(requireContext())
|
||||||
@@ -165,6 +199,8 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.btnNewKit.setOnClickListener {
|
binding.btnNewKit.setOnClickListener {
|
||||||
with(sharedPreference.edit()) {
|
with(sharedPreference.edit()) {
|
||||||
putString(Constants.KIT_NUMBER, "")
|
putString(Constants.KIT_NUMBER, "")
|
||||||
@@ -192,17 +228,20 @@ class HomeFragment : Fragment() {
|
|||||||
val accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString()
|
val accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString()
|
||||||
val password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "").toString()
|
val password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "").toString()
|
||||||
val userID = sharedPreference.getString(Constants.DEVICE_ID_API, "").toString()
|
val userID = sharedPreference.getString(Constants.DEVICE_ID_API, "").toString()
|
||||||
|
|
||||||
if (userID.isNotEmpty() && password.isNotEmpty()) {
|
if (userID.isNotEmpty() && password.isNotEmpty()) {
|
||||||
if (accessToken.isEmpty()) {
|
if (!isTokenAvailable) {
|
||||||
hemoCubeViewModel.login(createLoginRequestData(userID, password))
|
hemoCubeViewModel.login(createLoginRequestData(userID, password))
|
||||||
} else {
|
} else {
|
||||||
if (isTokenExpired(accessToken)) {
|
if (isTokenExpired(accessToken)) {
|
||||||
hemoCubeViewModel.login(createLoginRequestData(userID, password))
|
hemoCubeViewModel.login(createLoginRequestData(userID, password))
|
||||||
} else {
|
} else {
|
||||||
isTokenAvailable = true
|
isTokenAvailable = true
|
||||||
|
|
||||||
hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
|
hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
|
||||||
hemoCubeViewModel.uploadLogs()
|
hemoCubeViewModel.uploadLogs()
|
||||||
hemoCubeViewModel.startPeriodicCheckUpdate()
|
hemoCubeViewModel.startPeriodicCheckUpdate()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -212,6 +251,7 @@ class HomeFragment : Fragment() {
|
|||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
hemoCubeViewModel.loginResponse.observe(viewLifecycleOwner) { response ->
|
hemoCubeViewModel.loginResponse.observe(viewLifecycleOwner) { response ->
|
||||||
when (response) {
|
when (response) {
|
||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
@@ -593,29 +633,32 @@ class HomeFragment : Fragment() {
|
|||||||
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
||||||
val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
|
val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
|
||||||
userDataList.forEach { userData ->
|
userDataList.forEach { userData ->
|
||||||
if (!userData.localFlag) {
|
|
||||||
userData.localFlag = true
|
|
||||||
hemoCubeViewModel.bulkAddResultTestToDb(userData)
|
|
||||||
if (!userData.molbioFlag && isTokenAvailable) {
|
if (!userData.molbioFlag && isTokenAvailable) {
|
||||||
resultList.results?.add(
|
resultList.results?.add(
|
||||||
MolbioV2Result(
|
MolbioV2Result(
|
||||||
rawData = userData,
|
rawData = userData,
|
||||||
analysisId = userData._id,
|
analysisId = userData._id,
|
||||||
analysisDate = userData.testTime,
|
analysisDate = "2024-02-08 16:33:56", //userData.reportUploadTime,
|
||||||
analysisStatus = userData.classificationResult,
|
analysisStatus = userData.classificationResult,
|
||||||
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(),
|
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(),
|
||||||
interpretation = userData.classificationResult,
|
interpretation = userData.classificationResult,
|
||||||
testId = userData._id,
|
testId = userData._id,
|
||||||
testTime = userData.testTime,
|
testTime = userData.testTime,
|
||||||
collectionTime = userData.testTime,
|
collectionTime = "2024-02-08 16:33:56",//userData.testTime,
|
||||||
expiryTime = userData.testTime,
|
expiryTime = "2024-02-08 16:33:56",//userData.testTime,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!userData.localFlag){
|
||||||
|
userData.localFlag = true
|
||||||
|
hemoCubeViewModel.bulkAddResultTestToDb(userData)
|
||||||
|
}
|
||||||
|
if (!userData.molbioFlag && isTokenAvailable) {
|
||||||
|
userData.molbioFlag = true
|
||||||
|
hemoCubeViewModel.uploadResult(resultList)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (isTokenAvailable) {
|
|
||||||
hemoCubeViewModel.uploadResult(resultList)
|
|
||||||
}
|
}
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ class DeviceProvisionFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun getDeviceId() {
|
private fun getDeviceId() {
|
||||||
(activity as DeviceProvisionActivity).mService.sendAndListenToHemoCube(
|
(activity as DeviceProvisionActivity).mService.sendAndListenToHemoCube(
|
||||||
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
|
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
|
||||||
@@ -146,14 +145,19 @@ class DeviceProvisionFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun extractV2HardwareId(input: String): String? {
|
||||||
|
val pattern = Regex("SNS\\s*(.*?)\\s*SNE")
|
||||||
|
val matchResult: MatchResult? = pattern.find(input)
|
||||||
|
|
||||||
|
return matchResult?.groups?.get(1)?.value
|
||||||
|
}
|
||||||
|
|
||||||
private fun handleUsbData() {
|
private fun handleUsbData() {
|
||||||
when {
|
when {
|
||||||
resultData.contains("SNE") -> {
|
resultData.contains("SNE") -> {
|
||||||
val pattern = Regex("HPP1-\\d{4}")
|
val hardwareId = extractV2HardwareId(resultData)
|
||||||
val matchResult = pattern.find(resultData)
|
|
||||||
val hardwareId = matchResult?.value
|
|
||||||
|
|
||||||
if (hardwareId.toString().length == 9) {
|
if (!hardwareId.isNullOrBlank()) {
|
||||||
with(sharedPreferences.edit()) {
|
with(sharedPreferences.edit()) {
|
||||||
putString(Constants.DEVICE_ID, hardwareId)
|
putString(Constants.DEVICE_ID, hardwareId)
|
||||||
apply()
|
apply()
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ class DiagnosticsFragment : Fragment() {
|
|||||||
if (resultData.contains("END") || fullReadOutput.contains("END")) {
|
if (resultData.contains("END") || fullReadOutput.contains("END")) {
|
||||||
diagnosticsViewModel.addDiagnosticsDataToDb(DiagnosticsData(
|
diagnosticsViewModel.addDiagnosticsDataToDb(DiagnosticsData(
|
||||||
deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString(),
|
deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString(),
|
||||||
|
devicePassword = sharedPreferences.getString(Constants.DEVICE_PASSWORD_API, "").toString(),
|
||||||
|
deviceNatsToken = sharedPreferences.getString(Constants.NATS_TOKEN, "").toString(),
|
||||||
|
accessToken = sharedPreferences.getString(Constants.ACCESS_TOKEN, "").toString(),
|
||||||
deviceData = resultData,
|
deviceData = resultData,
|
||||||
runTime = SimpleDateFormat(
|
runTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class HemoCubeFragment : Fragment() {
|
|||||||
when (it) {
|
when (it) {
|
||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
uploadedToMolbio = true
|
uploadedToMolbio = true
|
||||||
if (Constants.MOLBIO_INTERGATION) {
|
if (Constants.MOLBIO_INTEGRATION) {
|
||||||
it.data.data?.get(0)?.rawData?.let { it1 ->
|
it.data.data?.get(0)?.rawData?.let { it1 ->
|
||||||
hemoCubeViewModel.updateMolbioFlag(
|
hemoCubeViewModel.updateMolbioFlag(
|
||||||
it1._id
|
it1._id
|
||||||
@@ -805,8 +805,8 @@ class HemoCubeFragment : Fragment() {
|
|||||||
|
|
||||||
calculatedPredictedDenovixRatio = fittedAbs3.div(fittedAbs1)
|
calculatedPredictedDenovixRatio = fittedAbs3.div(fittedAbs1)
|
||||||
|
|
||||||
val slope = (led1Average - led2Average) / (435 - 415)
|
val slope = (led4Average - led1Average) / (431-411)
|
||||||
val calculatedSlopeRatio = abs(led3Average / slope)
|
val calculatedSlopeRatio = abs(led2Average / slope)
|
||||||
val slopeClass = slopeRatioClassification(calculatedSlopeRatio)
|
val slopeClass = slopeRatioClassification(calculatedSlopeRatio)
|
||||||
|
|
||||||
if (fittedAbs1 <= fittedAbs2) {
|
if (fittedAbs1 <= fittedAbs2) {
|
||||||
@@ -874,8 +874,8 @@ class HemoCubeFragment : Fragment() {
|
|||||||
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
|
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
|
||||||
this.deviceRatioClass = deviceRatioClassification(deviceRatio)
|
this.deviceRatioClass = deviceRatioClassification(deviceRatio)
|
||||||
this.slopeRatioClass = slopeClass
|
this.slopeRatioClass = slopeClass
|
||||||
this.classificationResult = deviceRatioClass //findResult(calculatedRatio)
|
this.classificationResult = findResultWithAdditionalMethods(deviceRatio, deviceRatioClass, slopeRatio)
|
||||||
hemoCubeViewModel.messages.postValue("${this.deviceRatioClass} ${if (led4Average < 0.17) " - Low Hb" else ""}\n")
|
hemoCubeViewModel.messages.postValue("${this.classificationResult} \n Device Ratio: ${"%.3f".format(this.deviceRatio)} \n Slope Ratio: ${"%.3f".format(this.slopeRatio)}")
|
||||||
if (DataHolder.hemoCubeTestData?.testType == "HB")
|
if (DataHolder.hemoCubeTestData?.testType == "HB")
|
||||||
hemoCubeViewModel.messages.postValue("Hb: $calculatedHb4")
|
hemoCubeViewModel.messages.postValue("Hb: $calculatedHb4")
|
||||||
this.errorMessages = testState.allErrorMessages
|
this.errorMessages = testState.allErrorMessages
|
||||||
@@ -909,50 +909,36 @@ class HemoCubeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findResult(calculatedRatio: Double?): String {
|
fun findResultWithAdditionalMethods(deviceRatio: Double?, deviceRatioClass: String?, slopeRatio: Double?): String {
|
||||||
try {
|
try {
|
||||||
hemoCubeViewModel.messages.postValue("result classification")
|
// hemoCubeViewModel.messages.postValue("post classification checks")
|
||||||
if (calculatedRatio != null) {
|
if (deviceRatio != null) {
|
||||||
if (calculatedRatio < 0.05)
|
if (slopeRatio != null) {
|
||||||
return getString(R.string.error_repeat_test_higher_volume)
|
if (deviceRatioClass == "Normal" && slopeRatio > 45.0)
|
||||||
if (calculatedRatio in 0.05..0.155) {
|
return "Negative Borderline, Repeat Test"
|
||||||
return getString(R.string.normal)
|
|
||||||
}
|
}
|
||||||
if (calculatedRatio in 0.155..0.175)
|
|
||||||
return getString(R.string.negative_borderline)
|
|
||||||
if (calculatedRatio in 0.175..0.22)
|
|
||||||
return getString(R.string.sickle_cell_trait)
|
|
||||||
if (calculatedRatio in 0.22..0.25)
|
|
||||||
return getString(R.string.positive_for_sickle_cell)
|
|
||||||
if (calculatedRatio in 0.25..0.35)
|
|
||||||
return getString(R.string.sickle_cell_disease)
|
|
||||||
if (calculatedRatio > 0.35)
|
|
||||||
return getString(R.string.error_repeat_test_lower_volume)
|
|
||||||
} else {
|
|
||||||
return getString(R.string.invalid)
|
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showToast(R.string.error_classification)
|
handleException(e)
|
||||||
Firebase.crashlytics.recordException(e)
|
return "Error"
|
||||||
return getString(R.string.error)
|
|
||||||
}
|
}
|
||||||
return getString(R.string.invalid)
|
return deviceRatioClass.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deviceRatioClassification(ratio: Double?): String {
|
fun deviceRatioClassification(ratio: Double?): String {
|
||||||
try {
|
try {
|
||||||
if (ratio != null) {
|
if (ratio != null) {
|
||||||
if (ratio in 0.1..0.29) {
|
if (ratio in 0.001..0.23) {
|
||||||
// setSubtitleTextColor(R.color.green_2)
|
// setSubtitleTextColor(R.color.green_2)
|
||||||
return "Normal"
|
return "Normal"
|
||||||
}
|
}
|
||||||
if (ratio in 0.29..0.32)
|
if (ratio in 0.23..0.24)
|
||||||
return "Negative Borderline, Repeat Test"
|
return "Negative Borderline, Repeat Test"
|
||||||
if (ratio in 0.32..0.35)
|
if (ratio in 0.24..0.29)
|
||||||
return "Sickle Cell Trait"
|
return "Sickle Cell Trait"
|
||||||
if (ratio in 0.35..0.38)
|
if (ratio in 0.29..0.32)
|
||||||
return "Positive for Sickle Cell. HPLC for Confirmation"
|
return "Positive for Sickle Cell. HPLC for Confirmation"
|
||||||
if (ratio in 0.38..0.5)
|
if (ratio in 0.32..Double.POSITIVE_INFINITY)
|
||||||
return "Sickle Cell Disease"
|
return "Sickle Cell Disease"
|
||||||
} else {
|
} else {
|
||||||
return "Invalid"
|
return "Invalid"
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ class TrueHemeFragment : Fragment() {
|
|||||||
when (it) {
|
when (it) {
|
||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
uploadedToMolbio = true
|
uploadedToMolbio = true
|
||||||
if (Constants.MOLBIO_INTERGATION) {
|
if (Constants.MOLBIO_INTEGRATION) {
|
||||||
it.data.data?.get(0)?.rawData?.let { it1 ->
|
it.data.data?.get(0)?.rawData?.let { it1 ->
|
||||||
hemoCubeViewModel.updateMolbioFlag(
|
hemoCubeViewModel.updateMolbioFlag(
|
||||||
it1._id
|
it1._id
|
||||||
|
|||||||
5
app/src/main/res/drawable/downloads.xml
Normal file
5
app/src/main/res/drawable/downloads.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="@color/primary"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@color/primary" android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
|
||||||
|
</vector>
|
||||||
@@ -108,4 +108,33 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/btn_calibration" />
|
app:layout_constraintTop_toBottomOf="@id/btn_calibration" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_firefox"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/Firefox"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_deviceProvision" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_files"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/Files"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_firefox" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -115,15 +115,15 @@
|
|||||||
tools:listitem="@layout/offline_user_list_view" />
|
tools:listitem="@layout/offline_user_list_view" />
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<!-- <ImageView-->
|
||||||
android:id="@+id/btnSaveLocal"
|
<!-- android:id="@+id/btnSaveLocal"-->
|
||||||
android:layout_width="30dp"
|
<!-- android:layout_width="30dp"-->
|
||||||
android:layout_height="30dp"
|
<!-- android:layout_height="30dp"-->
|
||||||
android:layout_marginEnd="10dp"
|
<!-- android:layout_marginEnd="10dp"-->
|
||||||
android:src="@drawable/downloads"
|
<!-- android:src="@drawable/downloads"-->
|
||||||
android:visibility="gone"
|
<!-- android:visibility="gone"-->
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/rv_order_offline"
|
<!-- app:layout_constraintBottom_toBottomOf="@+id/rv_order_offline"-->
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,8 @@
|
|||||||
<string name="assurance_controls">Quality Assurance</string>
|
<string name="assurance_controls">Quality Assurance</string>
|
||||||
<string name="calibration">Calibration</string>
|
<string name="calibration">Calibration</string>
|
||||||
<string name="deviceProvision">Device Provision</string>
|
<string name="deviceProvision">Device Provision</string>
|
||||||
|
<string name="Firefox">Firefox</string>
|
||||||
|
<string name="Files">Files</string>
|
||||||
<string name="deviceinfo">Device Information</string>
|
<string name="deviceinfo">Device Information</string>
|
||||||
<string name="place_buffer">Start</string>
|
<string name="place_buffer">Start</string>
|
||||||
<string name="Start_Sample">Start Sample</string>
|
<string name="Start_Sample">Start Sample</string>
|
||||||
|
|||||||
@@ -318,28 +318,28 @@ class HemoCubeFragmentTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDeviceRatioClassificationNormal() {
|
fun testDeviceRatioClassificationNormal() {
|
||||||
val ratio = 0.25
|
val ratio = 0.22
|
||||||
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
||||||
assertEquals("Normal", result)
|
assertEquals("Normal", result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDeviceRatioClassificationNegativeBorderline() {
|
fun testDeviceRatioClassificationNegativeBorderline() {
|
||||||
val ratio = 0.31
|
val ratio = 0.235
|
||||||
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
||||||
assertEquals("Negative Borderline, Repeat Test", result)
|
assertEquals("Negative Borderline, Repeat Test", result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDeviceRatioClassificationSickleCellTrait() {
|
fun testDeviceRatioClassificationSickleCellTrait() {
|
||||||
val ratio = 0.34
|
val ratio = 0.25
|
||||||
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
||||||
assertEquals("Sickle Cell Trait", result)
|
assertEquals("Sickle Cell Trait", result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDeviceRatioClassificationPositiveForSickleCell() {
|
fun testDeviceRatioClassificationPositiveForSickleCell() {
|
||||||
val ratio = 0.37
|
val ratio = 0.31
|
||||||
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
||||||
assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result)
|
assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result)
|
||||||
}
|
}
|
||||||
@@ -357,4 +357,46 @@ class HemoCubeFragmentTest {
|
|||||||
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
val result = hemoCubeFragment.deviceRatioClassification(ratio)
|
||||||
assertEquals("Invalid", result)
|
assertEquals("Invalid", result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_ValidInput_ReturnsNegativeBorderlineRepeatTest() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)
|
||||||
|
assertEquals("Negative Borderline, Repeat Test", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_NormalDeviceRatio_ReturnsNormalBelowSlopeRatioThreshold() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 30.0)
|
||||||
|
assertEquals("Normal", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_NBL_ReturnsNBL() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline, Repeat Test", 70.0)
|
||||||
|
assertEquals("Negative Borderline, Repeat Test", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_SCT_ReturnsSCT() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Trait", 70.0)
|
||||||
|
assertEquals("Sickle Cell Trait", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_PBL_ReturnsPBL() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Positive for Sickle Cell. HPLC for Confirmation", 70.0)
|
||||||
|
assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun findResultWithAdditionalMethods_SCD_ReturnsSCD() {
|
||||||
|
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
|
||||||
|
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Disease", 70.0)
|
||||||
|
assertEquals("Sickle Cell Disease", result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user