Skip to content

Commit ae0015e

Browse files
bmonjoiedragos-dobreedarchismalinowskikamdelcroip
authored
Migrate some calls to FHIR and GraphQL (openimis#86)
* 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 <dragos.dobre@swisstph.ch> Co-authored-by: Eric Darchis <darchis@pobox.com> Co-authored-by: malinowskikam <kmalinowski@soldevelo.com> Co-authored-by: Kamil Malinowski <malinowskikam96@gmail.com> Co-authored-by: Patrick Delcroix <patrick.delcroix@swisstph.ch>
1 parent 436f2f6 commit ae0015e

124 files changed

Lines changed: 14143 additions & 3099 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
}
99
dependencies {
1010
classpath 'com.android.tools.build:gradle:7.3.1'
11+
classpath 'com.apollographql.apollo:apollo-gradle-plugin:2.5.14'
1112

1213
// NOTE: Do not place your application dependencies here; they belong
1314
// in the individual module build.gradle files

claimManagement/build.gradle

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import java.time.LocalDateTime
22
import java.time.format.DateTimeFormatter
33

44
apply plugin: 'com.android.application'
5+
apply plugin: 'com.apollographql.apollo'
56

67
static def getDate() {
78
LocalDateTime date = LocalDateTime.now()
@@ -27,7 +28,7 @@ android {
2728
targetSdkVersion 32
2829
versionCode 4
2930
versionName "2.0.1"
30-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
31+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
3132
}
3233
buildTypes {
3334
release {
@@ -56,7 +57,8 @@ android {
5657
productFlavors.all {
5758
resValue "string", "app_name_claims", "openIMIS Claims"
5859
resValue "string", "ReleaseDateValue", getDate()
59-
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/rest/"'
60+
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/"'
61+
buildConfigField "String", "REST_API_PREFIX", '"rest"'
6062
buildConfigField "String", "RAR_PASSWORD", '")(#$1HsD"'
6163
buildConfigField "String", "API_VERSION", '"3"'
6264
}
@@ -65,50 +67,51 @@ android {
6567
demoProd {
6668
applicationIdSuffix ".demoProd"
6769
resValue "string", "app_name_claims", "Claims Demo"
68-
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/rest/"'
70+
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/"'
6971
dimension 'std'
7072
}
7173

7274
demoRelease {
7375
applicationIdSuffix ".demoRelease"
7476
resValue "string", "app_name_claims", "Claims Release"
75-
buildConfigField "String", "API_BASE_URL", '"https://release.openimis.org/rest/"'
77+
buildConfigField "String", "API_BASE_URL", '"https://release.openimis.org/"'
7678
dimension 'std'
7779
}
7880

7981
chfDev {
8082
applicationIdSuffix ".chfDev"
8183
resValue "string", "app_name_claims", "Claims CHF"
82-
buildConfigField "String", "API_BASE_URL", '"http://chf-dev.swisstph-mis.ch/rest/"'
84+
buildConfigField "String", "API_BASE_URL", '"http://chf-dev.swisstph-mis.ch/"'
8385
dimension 'std'
8486
}
8587

8688
chfProd {
8789
applicationIdSuffix ".chfProd"
8890
resValue "string", "app_name_claims", "Claims CHF"
89-
buildConfigField "String", "API_BASE_URL", '"http://chf-imis.or.tz/restapi/"'
91+
buildConfigField "String", "API_BASE_URL", '"http://chf-imis.or.tz/"'
92+
buildConfigField "String", "REST_API_PREFIX", '"restapi"'
9093
dimension 'std'
9194
}
9295
mvDev {
9396
applicationIdSuffix ".mvDev"
9497
resValue "string", "app_name_claims", "Claims MV"
95-
buildConfigField "String", "API_BASE_URL", '"http://imis-mv.swisstph-mis.ch/rest/"'
98+
buildConfigField "String", "API_BASE_URL", '"http://imis-mv.swisstph-mis.ch/"'
9699
dimension 'std'
97100
}
98101
bephaDev {
99102
applicationIdSuffix ".bephaDev"
100103
resValue "string", "app_name_claims", "Claims BEPHA"
101-
buildConfigField "String", "API_BASE_URL", '"http://149.210.235.40/devupgrade/rest/"'
104+
buildConfigField "String", "API_BASE_URL", '"http://149.210.235.40/devupgrade/"'
102105
dimension 'std'
103106
}
104107
niger {
105108
applicationIdSuffix ".niger"
106109
resValue "string", "app_name_claims", "Claims Niger"
107-
buildConfigField "String", "API_BASE_URL", '"http://oiniger.bluesquare.org/rest/"'
110+
buildConfigField "String", "API_BASE_URL", '"http://oiniger.bluesquare.org/"'
108111
}
109112
tchadDev {
110113
applicationIdSuffix ".tchadDev"
111-
buildConfigField "String", "API_BASE_URL", '"https://imis-tchad-dev.swisstph-mis.ch/rest/"'
114+
buildConfigField "String", "API_BASE_URL", '"https://imis-tchad-dev.swisstph-mis.ch/"'
112115
resValue "string", "app_name_claims", "Claims TCHAD DEV"
113116
dimension 'std'
114117
}
@@ -126,10 +129,11 @@ android {
126129
}
127130
mauritaniaTrain {
128131
applicationIdSuffix ".mauritaniaTrain"
129-
buildConfigField "String", "API_BASE_URL", '"https://formation.cnass-mauritanie.swisstph-mis.ch/rest/"'
132+
buildConfigField "String", "API_BASE_URL", '"https://formation.cnass-mauritanie.swisstph-mis.ch/"'
130133
resValue "string", "app_name_claims", "Claims CNASS TRAIN"
131134
dimension = 'std'
132135
}
136+
133137
}
134138

135139
sourceSets {
@@ -177,27 +181,41 @@ android {
177181
}
178182
}
179183

184+
apollo {
185+
service("service") {
186+
packageName.set("org.openimis.imisclaims")
187+
}
188+
customTypeMapping = [
189+
"Date" : "java.util.Date",
190+
"DateTime" : "java.util.Date",
191+
"Decimal": "java.lang.Double",
192+
]
193+
}
194+
195+
180196
// Apply custom flavours
181197
if(file('custom-flavours.gradle').exists()){
182198
apply from: 'custom-flavours.gradle'
183199
}
184200

185201
dependencies {
186202
implementation fileTree(include: ['*.jar'], dir: 'libs')
187-
implementation 'com.android.support:support-annotations:28.0.0'
188-
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
203+
implementation 'androidx.annotation:annotation:1.0.0'
204+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
189205
implementation 'com.google.zxing:core:3.3.0'
190206
implementation 'com.embarkmobile:zxing-android-minimal:1.2.1@aar'
191207
implementation 'commons-io:commons-io:2.11.0'
192-
implementation 'com.android.support:design:28.0.0'
193-
implementation 'com.android.support:appcompat-v7:28.0.0'
194-
implementation 'android.arch.lifecycle:livedata:1.1.1'
195-
implementation 'android.arch.lifecycle:viewmodel:1.1.1'
196-
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
197-
implementation 'org.apache.httpcomponents:httpcore:4.4.11'
208+
implementation 'com.google.android.material:material:1.0.0'
209+
implementation 'androidx.appcompat:appcompat:1.0.0'
210+
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
211+
implementation 'com.squareup.okhttp3:logging-interceptor:4.11.0'
212+
implementation('com.apollographql.apollo:apollo-runtime:2.5.14')
213+
implementation ('com.apollographql.apollo:apollo-android-support:2.5.14'){
214+
because("Apollo 3+ only works with Kotlin coroutines")
215+
}
198216
testImplementation 'junit:junit:4.12'
199-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
200-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
217+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
218+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
201219
implementation group: 'com.squareup.picasso', name: 'picasso', version: '2.71828'
202220
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '1.2.7'
203221

claimManagement/src/debug/java/org/openimis/imisclaims/tools/Log.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import android.content.Context;
44
import android.net.Uri;
5-
import android.support.v4.content.FileProvider;
5+
import androidx.core.content.FileProvider;
66

77
import org.openimis.imisclaims.AppInformation;
88
import org.openimis.imisclaims.BuildConfig;

claimManagement/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
android:permission="android.permission.BIND_JOB_SERVICE" />
5050

5151
<provider
52-
android:name="android.support.v4.content.FileProvider"
52+
android:name="androidx.core.content.FileProvider"
5353
android:authorities="${applicationId}.fileprovider"
5454
android:exported="false"
5555
android:grantUriPermissions="true">
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
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) {
2+
claims(
3+
admin_Code: $claim_administrator_code
4+
status: $status_claim
5+
dateClaimed_Gte: $visit_date_from
6+
dateClaimed_Lte: $visit_date_to
7+
dateProcessed_Lte: $processed_date_to
8+
dateProcessed_Gte: $processed_date_from
9+
) {
10+
totalCount
11+
edges {
12+
node {
13+
uuid
14+
code
15+
healthFacility {
16+
code
17+
name
18+
}
19+
insuree {
20+
chfId
21+
lastName
22+
otherNames
23+
}
24+
icd {
25+
name
26+
}
27+
icd1 {
28+
name
29+
}
30+
icd2 {
31+
name
32+
}
33+
icd3 {
34+
name
35+
}
36+
icd4 {
37+
name
38+
}
39+
dateClaimed
40+
dateFrom
41+
dateTo
42+
validityFrom
43+
validityTo
44+
visitType
45+
status
46+
claimed
47+
approved
48+
adjustment
49+
explanation
50+
guaranteeId
51+
services {
52+
qtyProvided
53+
qtyApproved
54+
priceAdjusted
55+
priceValuated
56+
explanation
57+
justification
58+
service {
59+
code
60+
name
61+
price
62+
}
63+
}
64+
items {
65+
qtyProvided
66+
qtyApproved
67+
priceAdjusted
68+
priceValuated
69+
explanation
70+
justification
71+
item {
72+
code
73+
name
74+
price
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
query GetControls {
2+
control{
3+
edges{
4+
node{
5+
name
6+
usage
7+
adjustability
8+
}
9+
}
10+
}
11+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
query GetInsureeInquire($chfId: String) {
2+
insurees(
3+
chfId: $chfId
4+
) {
5+
edges {
6+
node {
7+
chfId
8+
lastName
9+
otherNames
10+
dob
11+
gender {
12+
gender
13+
}
14+
photos {
15+
folder
16+
filename
17+
photo
18+
}
19+
insureePolicies {
20+
edges {
21+
node {
22+
policy {
23+
product {
24+
name
25+
code
26+
ceiling
27+
ceilingIp
28+
ceilingOp
29+
deductible
30+
deductibleIp
31+
deductibleOp
32+
maxNoAntenatal
33+
maxAmountAntenatal
34+
maxNoSurgery
35+
maxAmountSurgery
36+
maxNoConsultation
37+
maxAmountConsultation
38+
maxNoDelivery
39+
maxAmountDelivery
40+
maxNoHospitalization
41+
maxAmountHospitalization
42+
maxMembers
43+
maxNoVisits
44+
maxInstallments
45+
maxCeilingPolicy
46+
maxCeilingPolicyIp
47+
maxCeilingPolicyOp
48+
maxPolicyExtraMember
49+
maxPolicyExtraMemberIp
50+
maxPolicyExtraMemberOp
51+
}
52+
enrollDate
53+
expiryDate
54+
status
55+
value
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}
62+
}
63+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
query GetPaymentList($claim_administrator_code: String) {
2+
claimAdmins(code: $claim_administrator_code) {
3+
edges {
4+
node {
5+
code
6+
healthFacility {
7+
code
8+
servicesPricelist {
9+
details {
10+
edges {
11+
node {
12+
service {
13+
code
14+
name
15+
price
16+
}
17+
}
18+
}
19+
}
20+
}
21+
itemsPricelist {
22+
details {
23+
edges {
24+
node {
25+
item {
26+
code
27+
name
28+
price
29+
}
30+
}
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)