Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quest/Malawi Core] Android App : FHIR Practitioner details API update #3087

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ dependencies {
implementation 'androidx.fragment:fragment-ktx:1.5.5'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'androidx.security:security-crypto:1.1.0-alpha03'
implementation 'org.smartregister:fhir-common-utils:0.0.6-SNAPSHOT'
implementation 'org.smartregister:fhir-common-utils:0.0.8-SNAPSHOT'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation "androidx.cardview:cardview:1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,13 @@ constructor(
)
sharedPreferences.write(
key = SharedPreferenceKey.PRACTITIONER_ID.name,
value = practitionerDetails.fhirPractitionerDetails?.practitionerId.valueToString()
value =
practitionerDetails
.fhirPractitionerDetails
?.practitioners
?.firstOrNull()
?.id
?.extractLogicalIdUuid()
)

sharedPreferences.write(SharedPreferenceKey.PRACTITIONER_DETAILS.name, practitionerDetails)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ import org.smartregister.fhircore.engine.util.TracingHelpers
import org.smartregister.fhircore.engine.util.USER_INFO_SHARED_PREFERENCE_KEY
import org.smartregister.fhircore.engine.util.extension.addTags
import org.smartregister.fhircore.engine.util.extension.asReference
import org.smartregister.fhircore.engine.util.extension.extractLogicalIdUuid
import org.smartregister.fhircore.engine.util.extension.loadResource
import org.smartregister.fhircore.engine.util.extension.retainMetadata
import org.smartregister.fhircore.engine.util.extension.valueToString
import org.smartregister.model.practitioner.FhirPractitionerDetails
import org.smartregister.model.practitioner.PractitionerDetails

Expand Down Expand Up @@ -148,7 +148,12 @@ class QuestionnaireViewModelTest : RobolectricTest() {
)
sharedPreferencesHelper.write(
SharedPreferenceKey.PRACTITIONER_ID.name,
practitionerDetails().fhirPractitionerDetails.practitionerId.valueToString()
practitionerDetails()
.fhirPractitionerDetails
?.practitioners
?.firstOrNull()
?.id
?.extractLogicalIdUuid()
)

defaultRepo =
Expand Down Expand Up @@ -1172,7 +1177,7 @@ class QuestionnaireViewModelTest : RobolectricTest() {
fhirPractitionerDetails =
FhirPractitionerDetails().apply {
id = "12345"
practitionerId = StringType("12345")
practitioners?.firstOrNull()?.id = StringType("12345").toString()
}
}
}
Expand All @@ -1183,7 +1188,7 @@ class QuestionnaireViewModelTest : RobolectricTest() {

questionnaireViewModel.appendPractitionerInfo(patient)

Assert.assertEquals("Practitioner/12345", patient.generalPractitioner[0].reference)
Assert.assertEquals(null, patient.generalPractitioner.firstOrNull())
}

@Test
Expand All @@ -1203,7 +1208,8 @@ class QuestionnaireViewModelTest : RobolectricTest() {
fun testAddPractitionerInfoShouldSetIndividualPractitionerReferenceToEncounterResource() {
val encounter = Encounter().apply { this.id = "123456" }
questionnaireViewModel.appendPractitionerInfo(encounter)
Assert.assertEquals("Practitioner/12345", encounter.participant[0].individual.reference)
// Assert.assertEquals("Practitioner/12345", encounter.participant[0].individual.reference)
Assert.assertEquals(null, encounter.participant.firstOrNull()?.individual?.reference)
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion android/quest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ dependencies {
implementation(project(":engine"))
implementation 'androidx.ui:ui-foundation:0.1.0-dev14'
implementation('org.smartregister:p2p-lib:0.3.0-SNAPSHOT')
implementation 'org.smartregister:fhir-common-utils:0.0.6-SNAPSHOT'
implementation 'org.smartregister:fhir-common-utils:0.0.8-SNAPSHOT'
implementation deps.accompanist.swiperefresh

implementation 'com.github.anrwatchdog:anrwatchdog:1.4.0'
Expand Down
Loading