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

Process skipped clients #506

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b5b5dbb
added broadcast reciever and service to reprocess the client
junaidwarsivd Jan 26, 2023
21b014b
added the corrections in the PR review
junaidwarsivd Jan 31, 2023
16470ec
added UnitTest for GizEventRepository
junaidwarsivd Jan 31, 2023
443625a
added more corrections to the PR changed the job trigger to isComplet…
junaidwarsivd Feb 1, 2023
b322055
corrected the condition
junaidwarsivd Feb 1, 2023
77e7122
removed unused imports
junaidwarsivd Feb 1, 2023
c405d49
reformatted the code
junaidwarsivd Feb 2, 2023
51d9247
updated according to the PR feedback
junaidwarsivd Feb 2, 2023
0402130
changed androidTestImplemenation to testImplementation
junaidwarsivd Feb 2, 2023
d3d2cfd
codacy issues removed
junaidwarsivd Feb 2, 2023
277e50c
added android 12 compatibility
junaidwarsivd Feb 10, 2023
89fb705
Code cleanup
ekigamba Mar 14, 2023
35ca072
Log skipped clients for reprocessing
ekigamba Mar 14, 2023
fa8589f
Process skipped clients events in-order of eventDate after processing…
ekigamba Mar 14, 2023
eb00e3d
Append APK file name with version and variant
ekigamba Dec 15, 2022
e2a4098
Separate oauth client id and secret for different variants
ekigamba Dec 15, 2022
0c4106b
Comment out code in client processor
ekigamba Dec 19, 2022
2f54b4b
Fix commented out code in client processor
ekigamba Mar 14, 2023
5c5cf23
Update ANC version to fix next button in form
ekigamba Mar 16, 2023
b4bb240
Fix OPD Close event processing
ekigamba Mar 20, 2023
6bd8dfa
Mark deceased children as closed in ec_client
ekigamba Mar 20, 2023
a834abb
Update README setup instructions
ekigamba Mar 21, 2023
07c67a8
Remove unused imports
ekigamba Mar 21, 2023
4626b37
Fix PNC registration form cannot move to the next page
ekigamba Mar 24, 2023
7e93ddf
Process death and OPD close events
ekigamba Mar 24, 2023
27b7787
Fix All Clients register search to remove dead clients
ekigamba Mar 24, 2023
502694f
Code cleanup
ekigamba Mar 24, 2023
eeab005
Update versionName and versionCode to 0.4.8 and 48
ekigamba Mar 24, 2023
57aa2d3
Fix Child register search showing deceased clients
ekigamba Mar 26, 2023
af4d112
Update versionName and versionCode to 0.4.9 and 49
ekigamba Mar 26, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ target/
tmp/
opensrp-giz-malawi/debug/
opensrp-giz-malawi/preview/
opensrp-giz-malawi/releaseDebug/
*google-services.json
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ These instructions will get you a copy of the project up and running on your loc
## Prerequisites
[Tools and Frameworks Setup](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/6619207/Tools+and+Frameworks+Setup)

## Development setup

### Steps to set up
[OpenSRP android client app build](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/6619236/OpenSRP+App+Build)
- [OpenSRP android client app build](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/6619236/OpenSRP+App+Build)
- Add the client-id and client-secret values for the three environments i.e. stage, preview and production. Add these values to the `local.properties` as `client.id.[stage|preview|production]` and `client.secret.[stage|preview|production]`.
- Add the `google-services.json` to `opensrp-client-giz-malawi/opensrp-giz-malawi`

### Running the tests

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ subprojects {
ext.androidToolsBuildGradle = '4.0.1'
ext.androidBuildToolsVersion = '29.0.3'
ext.androidMinSdkVersion = 18
ext.androidCompileSdkVersion = 29
ext.androidTargetSdkVersion = 29
ext.androidCompileSdkVersion = 31
ext.androidTargetSdkVersion = 31

ext.androidAnnotationsVersion = '3.0.1'
ext.androidAnnotationsAPIVersion = '3.0.1'
Expand Down
102 changes: 66 additions & 36 deletions opensrp-giz-malawi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@ jacoco {
toolVersion = jacocoVersion
}

Properties properties = new Properties()
if (project.rootProject.file("local.properties").exists()) {
properties.load(project.rootProject.file("local.properties").newDataInputStream())
} else{
project.logger.error("local.properties file does not exist")
}

ext.getLocalProperty = { key ->
if (properties != null && properties.containsKey(key)) {
return properties[key]
} else {
project.logger.error(key + " could not be found. Setting it to an empty string")
return "\"\""
}
}


ext.checkKeys = { keys ->
keys.each { key ->
if (properties == null || !properties.containsKey(key)) {
project.logger.error(key + " is missing from the local.properties")
}
}
}

android {
useLibrary 'org.apache.http.legacy'
Expand All @@ -35,8 +59,8 @@ android {
applicationId "org.smartregister.giz"
minSdkVersion androidMinSdkVersion
targetSdkVersion androidTargetSdkVersion
versionCode 46
versionName "0.4.6"
versionCode 49
versionName "0.4.9"
multiDexEnabled true
buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l"
buildConfigField "boolean", "TIME_CHECK", "false"
Expand All @@ -50,34 +74,7 @@ android {

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

if (project.rootProject.file("local.properties").exists()) {

Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())

if (properties != null && properties.containsKey("oauth.client.id")) {

buildConfigField "String", "OAUTH_CLIENT_ID", properties["oauth.client.id"]

} else {
project.logger.error("oauth.client.id variable is not set in your local.properties")
buildConfigField "String", "OAUTH_CLIENT_ID", "\"sample_client_id\""
}


if (properties != null && properties.containsKey("oauth.client.secret")) {

buildConfigField "String", "OAUTH_CLIENT_SECRET", properties["oauth.client.secret"]

} else {
project.logger.error("oauth.client.secret variable is not set in your local.properties")
buildConfigField "String", "OAUTH_CLIENT_SECRET", "\"sample_client_secret\""
}
} else {
buildConfigField "String", "OAUTH_CLIENT_ID", '""'
buildConfigField "String", "OAUTH_CLIENT_SECRET", '""'
}

checkKeys(["oauth.client.id.production", "oauth.client.secret.production", "oauth.client.id.stage", "oauth.client.secret.stage", "oauth.client.id.preview", "oauth.client.secret.preview"])

javaCompileOptions {
annotationProcessorOptions {
Expand Down Expand Up @@ -128,6 +125,10 @@ android {
buildConfigField "int", "GROWTH_MONITORING_SYNC_TIME", '15'
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.production")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.production")

}

releaseDebug {
Expand All @@ -141,7 +142,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rule.pro'
resValue "string", 'opensrp_url', '"https://opensrp.health.gov.mw/opensrp/"'
buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10'
buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10'
buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '2'
buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2'
buildConfigField "int", "VACCINE_SYNC_TIME", '0'
buildConfigField "int", "DATABASE_VERSION", '20'
Expand All @@ -157,6 +158,9 @@ android {
buildConfigField "int", "GROWTH_MONITORING_SYNC_TIME", '15'
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.production")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.production")
}

preview {
Expand Down Expand Up @@ -185,6 +189,9 @@ android {
buildConfigField "int", "GROWTH_MONITORING_SYNC_TIME", '15'
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.preview")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.preview")
}

debug {
Expand All @@ -210,6 +217,22 @@ android {
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'
testCoverageEnabled true

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.stage")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.stage")
}
}

// https://stackoverflow.com/a/27119543/152938
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = new File(outputFileName.replace(".apk", "-${defaultConfig.versionName}.apk"))
}
}

testVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = new File(outputFileName.replace(".apk", "-${defaultConfig.versionName}.apk"))
}
}

Expand All @@ -232,6 +255,8 @@ android {
}
configurations.all {
exclude group: 'com.github.lecho', module: 'hellocharts-library'
exclude group: 'com.evernote', module: 'android-job'

}
}

Expand Down Expand Up @@ -269,16 +294,16 @@ dependencies {
exclude group: 'com.android.support', module: 'appcompat-v7'
}

api('org.smartregister:opensrp-client-anc:2.0.3.29-LOCAL-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-anc:2.0.3.40-LOCAL-SNAPSHOT@aar') {
transitive = true
exclude group: 'id.zelory', module: 'compressor'
exclude group: 'org.smartregister', module: 'opensrp-client-core'
exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
exclude group: 'org.smartregister', module: 'opensrp-client-configurable-views'
exclude group: 'com.android.support', module: 'appcompat-v7'
}
//
api('org.smartregister:opensrp-client-native-form:2.1.11-SNAPSHOT@aar') {

api('org.smartregister:opensrp-client-native-form:2.1.14.1-GIZ-SNAPSHOT@aar') {
transitive = true
exclude group: 'id.zelory', module: 'compressor'
exclude group: 'com.android.support', module: 'recyclerview-v7'
Expand Down Expand Up @@ -325,7 +350,7 @@ dependencies {
exclude group: 'com.android.support', module: 'appcompat-v7'
}

api('org.smartregister:opensrp-client-immunization:4.0.6-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-immunization:4.0.7-SNAPSHOT@aar') {
transitive = true
exclude group: 'id.zelory', module: 'compressor'
exclude group: 'org.smartregister', module: 'opensrp-client-core'
Expand Down Expand Up @@ -376,7 +401,10 @@ dependencies {
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
implementation 'io.reactivex.rxjava2:rxjava:2.1.5'
implementation 'com.evernote:android-job:1.2.6'
implementation('com.github.devv911:android-job:1.4.5') {
exclude group: 'com.google.android', module: 'android'
}
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'com.github.lecho:hellocharts-android:1.5.8@aar'
implementation 'id.zelory:compressor:2.1.1'
implementation('com.google.android.material:material:1.0.0') {
Expand Down Expand Up @@ -404,6 +432,8 @@ dependencies {

implementation "androidx.multidex:multidex:2.0.1"
testImplementation "androidx.work:work-testing:2.7.1"
testImplementation 'androidx.test:runner:1.3.0'
testImplementation 'androidx.test:core:1.3.0'


def robolectricVersion = '4.1'
Expand Down
24 changes: 13 additions & 11 deletions opensrp-giz-malawi/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
android:name=".activity.LoginActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Login"
android:exported="true"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down Expand Up @@ -280,17 +281,18 @@
android:theme="@style/ChildTheme.NoActionBar"
tools:replace="android:theme" />
<!-- END OF PNC ACTIVITIES -->
<service android:name="org.smartregister.immunization.service.intent.VaccineIntentService" />
<service android:name="org.smartregister.immunization.service.intent.RecurringIntentService" />
<service android:name="org.smartregister.immunization.service.intent.VaccineSchedulesUpdateIntentService" />
<service android:name="org.smartregister.growthmonitoring.service.intent.ZScoreRefreshIntentService" />
<service android:name="org.smartregister.growthmonitoring.service.intent.WeightIntentService" />
<service android:name="org.smartregister.growthmonitoring.service.intent.HeightIntentService" />
<service android:name="org.smartregister.sync.intent.PullUniqueIdsIntentService" />
<service android:name="org.smartregister.sync.intent.ValidateIntentService" />
<service android:name="org.smartregister.sync.intent.ExtendedSyncIntentService" />
<service android:name="org.smartregister.sync.intent.SettingsSyncIntentService" />
<service android:name="org.smartregister.sync.intent.SyncIntentService" />
<service android:name="org.smartregister.immunization.service.intent.VaccineIntentService" android:exported="false" />
<service android:name="org.smartregister.immunization.service.intent.RecurringIntentService" android:exported="false" />
<service android:name="org.smartregister.immunization.service.intent.VaccineSchedulesUpdateIntentService" android:exported="false"/>
<service android:name="org.smartregister.growthmonitoring.service.intent.ZScoreRefreshIntentService" android:exported="false" />
<service android:name="org.smartregister.growthmonitoring.service.intent.WeightIntentService" android:exported="false"/>
<service android:name="org.smartregister.growthmonitoring.service.intent.HeightIntentService" android:exported="false"/>
<service android:name="org.smartregister.sync.intent.PullUniqueIdsIntentService" android:exported="false" />
<service android:name="org.smartregister.sync.intent.ValidateIntentService" android:exported="false"/>
<service android:name="org.smartregister.sync.intent.ExtendedSyncIntentService" android:exported="false" />
<service android:name="org.smartregister.sync.intent.SettingsSyncIntentService" android:exported="false" />
<service android:name="org.smartregister.sync.intent.SyncIntentService" android:exported="false" />
<service android:name=".service.ReProcessSyncIntentService" android:exported="false"/>

<uses-library
android:name="org.apache.http.legacy"
Expand Down
11 changes: 11 additions & 0 deletions opensrp-giz-malawi/src/main/assets/ec_client_classification.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
"field_value": "Death",
"creates_case": [
"deceased"
],
"closes_case": [
"ec_client",
"ec_child_details"
]
},
{
Expand Down Expand Up @@ -268,6 +272,13 @@
"creates_case": [
"reason_for_defaulting"
]
},
{
"field": "eventType",
"field_value": "OPD Close",
"closes_case": [
"ec_client"
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package org.smartregister.anc.library.presenter;

import android.text.TextUtils;
import android.util.Log;
import android.view.View;

import com.vijay.jsonwizard.constants.JsonFormConstants;
import com.vijay.jsonwizard.fragments.JsonFormFragment;
import com.vijay.jsonwizard.interactors.JsonFormInteractor;
import com.vijay.jsonwizard.presenters.JsonWizardFormFragmentPresenter;
import com.vijay.jsonwizard.views.JsonFormFragmentView;
import com.vijay.jsonwizard.widgets.NativeRadioButtonFactory;

import org.apache.commons.lang3.StringUtils;
import org.smartregister.anc.library.fragment.ContactWizardJsonFormFragment;
import org.smartregister.anc.library.util.ANCFormUtils;
import org.smartregister.anc.library.util.ConstantsUtils;

/**
* Created by keyman on 04/08/18.
*/
public class ContactWizardJsonFormFragmentPresenter2 extends JsonWizardFormFragmentPresenter {

public static final String TAG = ContactWizardJsonFormFragmentPresenter2.class.getName();

public ContactWizardJsonFormFragmentPresenter2(JsonFormFragment formFragment, JsonFormInteractor jsonFormInteractor) {
super(formFragment, jsonFormInteractor);
}

@Override
public void setUpToolBar() {
super.setUpToolBar();

}

@Override
protected boolean moveToNextWizardStep() {
String nextStep = getFormFragment().getJsonApi().nextStep();
if (StringUtils.isNotBlank(nextStep)) {

getFormFragment().getJsonApi().getAppExecutors().mainThread().execute(new Runnable() {
@Override
public void run() {

JsonFormFragment next = ContactWizardJsonFormFragment.getFormFragment(nextStep);
JsonFormFragmentView jsonFormFragmentView = getView();
if (jsonFormFragmentView != null) {
jsonFormFragmentView.hideKeyBoard();
jsonFormFragmentView.transactThis(next);
}
}
});

return true;
}
return false;
}

@Override
public void onClick(View view) {
key = (String) view.getTag(com.vijay.jsonwizard.R.id.key);
type = (String) view.getTag(com.vijay.jsonwizard.R.id.type);
switch (type) {
case ConstantsUtils.EXPANSION_PANEL:
String info = (String) view.getTag(com.vijay.jsonwizard.R.id.label_dialog_info);
if (!TextUtils.isEmpty(info)) {
showInformationDialog(view);
}
break;
case ConstantsUtils.EXTENDED_RADIO_BUTTON:
showInformationDialog(view);
break;
default:
super.onClick(view);
break;
}
}

@Override
protected void nativeRadioButtonClickActions(View view) {
String type = (String) view.getTag(com.vijay.jsonwizard.R.id.specify_type);
String specifyWidget = (String) view.getTag(com.vijay.jsonwizard.R.id.specify_widget);
Log.i(TAG, "The dialog content widget is this: " + specifyWidget);
if (JsonFormConstants.CONTENT_INFO.equals(type) && specifyWidget.equals(JsonFormConstants.DATE_PICKER)) {
NativeRadioButtonFactory.showDateDialog(view);
} else if (JsonFormConstants.CONTENT_INFO.equals(type) && !specifyWidget.equals(JsonFormConstants.DATE_PICKER)) {
ANCFormUtils formUtils = new ANCFormUtils();
formUtils.showGenericDialog(view);
} else if (view.getId() == com.vijay.jsonwizard.R.id.label_edit_button) {
setRadioViewsEditable(view);
} else {
showInformationDialog(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.smartregister.view.activity.BaseProfileActivity;

public class ChildProfileActivity extends BaseProfileActivity {

@Override
protected void attachBaseContext(android.content.Context base) {
// get language from prefs
Expand Down
Loading