Skip to content

Commit

Permalink
Migrate some calls to FHIR and GraphQL (#86)
Browse files Browse the repository at this point in the history
* Github Action: manual build

* Update activity_about.xml

* Updated java version in github actions

* github actions: Changes cache from maven to gradle

* Revert "OTC-745 Implemented claim 2-way sync"

* Migrate some calls to FHIR and GraphQL (WIP)

The new implementation relies on OkHttp and Apollo.
OkHttp was added because the current implementation relies on Apache HTTP
client, which is not supported anymore since Android 6 (API 23).
A version supports Android 23+, but Apache does not officially maintain it.
Also, OkHttp is the current standard and comes with lots of benefits like,
among other things, the logger, automatic support for GZip, and a strong
security focus.
Apollo is in its version 2 as version 3+ requires Kotlin Coroutines.
Also, the plan is that some new endpoints or extensions could be added to the
FHIR API to remove the dependency on GraphQL.

Everything is hidden behind use cases to impact as less as possible the
current code base.

Also, migrate to AndroidX because of Apollo's dependencies. The versions
of the AndroidX have been kept back to avoid conflicts and upgrades.

* Moving the claim creation to FHIR (WIP)

This depends on a modification of the backend which would allow
to pass a reference with an OpenIMIS Code rather than a UUID.

There is still an open question about the "REJECTED" status to be solved.

OMT-339

* Moving GetControls to GraphQL

Deleting `ToRestApi` and removing Apache HTTP dependencies.
Adding a way to change the "Login/Logout" button automatically on login.

This depends on a new module migrating the controls to GraphQL that has not
yet been merged.

OMT-339

* Improve "Add claim" UI

* PR comments

* Fix issues after first review

* Detect "REJECTED" status

Based on the method `build_fhir_total_list` in the Python code,
if there is no total, the claim is rejected.

* Fix error message when Insuree is not found

---------

Co-authored-by: Dragos DOBRE <[email protected]>
Co-authored-by: Eric Darchis <[email protected]>
Co-authored-by: malinowskikam <[email protected]>
Co-authored-by: Kamil Malinowski <[email protected]>
Co-authored-by: Patrick Delcroix <[email protected]>
  • Loading branch information
6 people authored Oct 18, 2023
1 parent 436f2f6 commit ae0015e
Show file tree
Hide file tree
Showing 124 changed files with 14,143 additions and 3,099 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.apollographql.apollo:apollo-gradle-plugin:2.5.14'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
60 changes: 39 additions & 21 deletions claimManagement/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

apply plugin: 'com.android.application'
apply plugin: 'com.apollographql.apollo'

static def getDate() {
LocalDateTime date = LocalDateTime.now()
Expand All @@ -27,7 +28,7 @@ android {
targetSdkVersion 32
versionCode 4
versionName "2.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
Expand Down Expand Up @@ -56,7 +57,8 @@ android {
productFlavors.all {
resValue "string", "app_name_claims", "openIMIS Claims"
resValue "string", "ReleaseDateValue", getDate()
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/rest/"'
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/"'
buildConfigField "String", "REST_API_PREFIX", '"rest"'
buildConfigField "String", "RAR_PASSWORD", '")(#$1HsD"'
buildConfigField "String", "API_VERSION", '"3"'
}
Expand All @@ -65,50 +67,51 @@ android {
demoProd {
applicationIdSuffix ".demoProd"
resValue "string", "app_name_claims", "Claims Demo"
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/rest/"'
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/"'
dimension 'std'
}

demoRelease {
applicationIdSuffix ".demoRelease"
resValue "string", "app_name_claims", "Claims Release"
buildConfigField "String", "API_BASE_URL", '"https://release.openimis.org/rest/"'
buildConfigField "String", "API_BASE_URL", '"https://release.openimis.org/"'
dimension 'std'
}

chfDev {
applicationIdSuffix ".chfDev"
resValue "string", "app_name_claims", "Claims CHF"
buildConfigField "String", "API_BASE_URL", '"http://chf-dev.swisstph-mis.ch/rest/"'
buildConfigField "String", "API_BASE_URL", '"http://chf-dev.swisstph-mis.ch/"'
dimension 'std'
}

chfProd {
applicationIdSuffix ".chfProd"
resValue "string", "app_name_claims", "Claims CHF"
buildConfigField "String", "API_BASE_URL", '"http://chf-imis.or.tz/restapi/"'
buildConfigField "String", "API_BASE_URL", '"http://chf-imis.or.tz/"'
buildConfigField "String", "REST_API_PREFIX", '"restapi"'
dimension 'std'
}
mvDev {
applicationIdSuffix ".mvDev"
resValue "string", "app_name_claims", "Claims MV"
buildConfigField "String", "API_BASE_URL", '"http://imis-mv.swisstph-mis.ch/rest/"'
buildConfigField "String", "API_BASE_URL", '"http://imis-mv.swisstph-mis.ch/"'
dimension 'std'
}
bephaDev {
applicationIdSuffix ".bephaDev"
resValue "string", "app_name_claims", "Claims BEPHA"
buildConfigField "String", "API_BASE_URL", '"http://149.210.235.40/devupgrade/rest/"'
buildConfigField "String", "API_BASE_URL", '"http://149.210.235.40/devupgrade/"'
dimension 'std'
}
niger {
applicationIdSuffix ".niger"
resValue "string", "app_name_claims", "Claims Niger"
buildConfigField "String", "API_BASE_URL", '"http://oiniger.bluesquare.org/rest/"'
buildConfigField "String", "API_BASE_URL", '"http://oiniger.bluesquare.org/"'
}
tchadDev {
applicationIdSuffix ".tchadDev"
buildConfigField "String", "API_BASE_URL", '"https://imis-tchad-dev.swisstph-mis.ch/rest/"'
buildConfigField "String", "API_BASE_URL", '"https://imis-tchad-dev.swisstph-mis.ch/"'
resValue "string", "app_name_claims", "Claims TCHAD DEV"
dimension 'std'
}
Expand All @@ -126,10 +129,11 @@ android {
}
mauritaniaTrain {
applicationIdSuffix ".mauritaniaTrain"
buildConfigField "String", "API_BASE_URL", '"https://formation.cnass-mauritanie.swisstph-mis.ch/rest/"'
buildConfigField "String", "API_BASE_URL", '"https://formation.cnass-mauritanie.swisstph-mis.ch/"'
resValue "string", "app_name_claims", "Claims CNASS TRAIN"
dimension = 'std'
}

}

sourceSets {
Expand Down Expand Up @@ -177,27 +181,41 @@ android {
}
}

apollo {
service("service") {
packageName.set("org.openimis.imisclaims")
}
customTypeMapping = [
"Date" : "java.util.Date",
"DateTime" : "java.util.Date",
"Decimal": "java.lang.Double",
]
}


// Apply custom flavours
if(file('custom-flavours.gradle').exists()){
apply from: 'custom-flavours.gradle'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'androidx.annotation:annotation:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.embarkmobile:zxing-android-minimal:1.2.1@aar'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'android.arch.lifecycle:livedata:1.1.1'
implementation 'android.arch.lifecycle:viewmodel:1.1.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
implementation 'org.apache.httpcomponents:httpcore:4.4.11'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.11.0'
implementation('com.apollographql.apollo:apollo-runtime:2.5.14')
implementation ('com.apollographql.apollo:apollo-android-support:2.5.14'){
because("Apollo 3+ only works with Kotlin coroutines")
}
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation group: 'com.squareup.picasso', name: 'picasso', version: '2.71828'
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '1.2.7'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;
import android.net.Uri;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;

import org.openimis.imisclaims.AppInformation;
import org.openimis.imisclaims.BuildConfig;
Expand Down
2 changes: 1 addition & 1 deletion claimManagement/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
android:permission="android.permission.BIND_JOB_SERVICE" />

<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
query GetClaims($claim_administrator_code: String, $status_claim: Int, $visit_date_from: Date, $visit_date_to: Date, $processed_date_from: Date, $processed_date_to: Date) {
claims(
admin_Code: $claim_administrator_code
status: $status_claim
dateClaimed_Gte: $visit_date_from
dateClaimed_Lte: $visit_date_to
dateProcessed_Lte: $processed_date_to
dateProcessed_Gte: $processed_date_from
) {
totalCount
edges {
node {
uuid
code
healthFacility {
code
name
}
insuree {
chfId
lastName
otherNames
}
icd {
name
}
icd1 {
name
}
icd2 {
name
}
icd3 {
name
}
icd4 {
name
}
dateClaimed
dateFrom
dateTo
validityFrom
validityTo
visitType
status
claimed
approved
adjustment
explanation
guaranteeId
services {
qtyProvided
qtyApproved
priceAdjusted
priceValuated
explanation
justification
service {
code
name
price
}
}
items {
qtyProvided
qtyApproved
priceAdjusted
priceValuated
explanation
justification
item {
code
name
price
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
query GetControls {
control{
edges{
node{
name
usage
adjustability
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
query GetInsureeInquire($chfId: String) {
insurees(
chfId: $chfId
) {
edges {
node {
chfId
lastName
otherNames
dob
gender {
gender
}
photos {
folder
filename
photo
}
insureePolicies {
edges {
node {
policy {
product {
name
code
ceiling
ceilingIp
ceilingOp
deductible
deductibleIp
deductibleOp
maxNoAntenatal
maxAmountAntenatal
maxNoSurgery
maxAmountSurgery
maxNoConsultation
maxAmountConsultation
maxNoDelivery
maxAmountDelivery
maxNoHospitalization
maxAmountHospitalization
maxMembers
maxNoVisits
maxInstallments
maxCeilingPolicy
maxCeilingPolicyIp
maxCeilingPolicyOp
maxPolicyExtraMember
maxPolicyExtraMemberIp
maxPolicyExtraMemberOp
}
enrollDate
expiryDate
status
value
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
query GetPaymentList($claim_administrator_code: String) {
claimAdmins(code: $claim_administrator_code) {
edges {
node {
code
healthFacility {
code
servicesPricelist {
details {
edges {
node {
service {
code
name
price
}
}
}
}
}
itemsPricelist {
details {
edges {
node {
item {
code
name
price
}
}
}
}
}
}
}
}
}
}
Loading

0 comments on commit ae0015e

Please sign in to comment.