diff --git a/.gitignore b/.gitignore
index c16ed227ef..f29deebda6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,5 @@ project.properties
.settings
build/
jacoco.exec
-opensrp-chw/ba/
\ No newline at end of file
+opensrp-chw/ba/
+opensrp-chw/nacp/
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 9d88944b7e..ce9656fbd7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -64,9 +64,9 @@ subprojects {
ext.androidToolsBuildGradle = '4.0.1'
ext.androidBuildToolsVersion = '29.0.3'
- ext.androidMinSdkVersion = 19
- ext.androidCompileSdkVersion = 29
- ext.androidTargetSdkVersion = 29
+ ext.androidMinSdkVersion = 21
+ ext.androidCompileSdkVersion = 30
+ ext.androidTargetSdkVersion = 31
ext.androidAnnotationsVersion = '3.0.1'
ext.androidAnnotationsAPIVersion = '3.0.1'
diff --git a/opensrp-chw/build.gradle b/opensrp-chw/build.gradle
index 09a8c650d4..50dc92556d 100644
--- a/opensrp-chw/build.gradle
+++ b/opensrp-chw/build.gradle
@@ -10,12 +10,37 @@ buildscript {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
-
+def githubProperties = new Properties()
+if (rootProject.file("github.properties").exists()) {
+ githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
+}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://maven.fabric.io/public' }
+ maven {
+
+ name = "GitHubPackages"
+
+ url = uri("https://maven.pkg.github.com/SoftmedTanzania/opensrp-client-chw-core")
+ credentials {
+ username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
+ password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
+ }
+
+ }
+
+ maven {
+
+ name = "GitHubPackages"
+
+ url = uri("https://maven.pkg.github.com/SoftmedTanzania/opensrp-client-chw-ld")
+ credentials {
+ username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
+ password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
+ }
+ }
mavenLocal()
}
}
@@ -109,7 +134,7 @@ android {
buildConfigField "int", "SCHEDULE_SERVICE_MINUTES", '720'
buildConfigField "int", "STOCK_USAGE_REPORT_MINUTES", '1440'
buildConfigField "boolean", "USE_UNIFIED_REFERRAL_APPROACH", "true"
- buildConfigField "boolean", "BUILD_FOR_BORESHA_AFYA_SOUTH", "false"
+ buildConfigField "boolean", "BUILD_FOR_BORESHA_AFYA_SOUTH", "true"
}
debug {
@@ -127,7 +152,7 @@ android {
buildConfigField "int", "SCHEDULE_SERVICE_MINUTES", '360'
buildConfigField "int", "STOCK_USAGE_REPORT_MINUTES", '1440'
buildConfigField "boolean", "USE_UNIFIED_REFERRAL_APPROACH", "true"
- buildConfigField "boolean", "BUILD_FOR_BORESHA_AFYA_SOUTH", "false"
+ buildConfigField "boolean", "BUILD_FOR_BORESHA_AFYA_SOUTH", "true"
testCoverageEnabled true
}
}
@@ -171,6 +196,24 @@ android {
flavorDimensions 'baseDimension'
productFlavors {
+ nacp {
+ dimension = 'baseDimension'
+ applicationIdSuffix ".moh"
+ versionCode 14
+ versionName "1.1.6"
+ buildConfigField "String", 'opensrp_url', '"https://ucs.nacp.go.tz/opensrp/"'
+ buildConfigField "String", 'guidebooks_url', '"https://opensrp.s3.amazonaws.com/media/ba/"'
+// buildConfigField "String", 'opensrp_url_debug', '"http://50.116.15.4:8082/opensrp/"'
+ buildConfigField "String", 'opensrp_url_debug', '"http://170.187.199.69:8082/opensrp/"'
+ buildConfigField "String[]", "LOCATION_HIERACHY", '{"Country","Region","District","Ward" , "MOH Jhpiego Facility Name", "Health Facility", "Village", "Village Sublocations"}'
+ buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS", '{"Ward" , "Facility", "Health Facility", "Village", "Village Sublocations"}'
+ buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS_DEBUG", '{"Ward", "Facility", "Health Facility", "Village", "Village Sublocations"}'
+ buildConfigField "String", 'DEFAULT_LOCATION', '"Village Sublocations"'
+ buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"Village"'
+ buildConfigField "long", "MAPBOX_DOWNLOAD_TILE_LIMIT", "6001"
+
+ buildConfigField "int", "DATABASE_VERSION", '25'
+ }
ba {
dimension = 'baseDimension'
applicationIdSuffix ".ba"
@@ -291,10 +334,20 @@ android {
dataBinding {
enabled = true
}
+
+ bundle {
+ language {
+ // Specifies that the app bundle should not support
+ // configuration APKs for language resources. These
+ // resources are instead packaged with each base and
+ // dynamic feature APK.
+ enableSplit = false
+ }
+ }
}
dependencies {
- implementation('org.smartregister:opensrp-client-chw-core:1.5.29-SNAPSHOT@aar') {
+ implementation('org.smartregister:opensrp-client-chw-core:1.5.36.14-NACP-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'androidx.legacy', module: 'legacy-support-v4'
@@ -302,17 +355,6 @@ dependencies {
exclude group: 'androidx.constraintlayout', module: 'constraintlayout'
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'com.rengwuxian.materialedittext', module: 'library'
- exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
- }
- implementation('org.smartregister:opensrp-client-native-form:2.1.13-SNAPSHOT@aar') {
- transitive = true
- exclude group: 'com.android.support', module: 'appcompat-v7'
- exclude group: 'com.android.support', module: 'cardview-v7'
- exclude group: 'com.android.support', module: 'support-media-compat'
- exclude group: 'com.android.support', module: 'support-v4'
- exclude group: 'com.android.support', module: 'design'
- exclude group: 'io.ona.rdt-capture', module: 'lib'
- exclude group: 'com.google.guava', module: 'guava'
}
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.1.0'
implementation('io.ona.kujaku:library:0.9.0') {
@@ -330,6 +372,8 @@ dependencies {
implementation 'com.android.support:multidex:1.0.3'
//Do not upgrade to 24.jre-1 due to compatibility issues
implementation 'com.google.guava:guava:20.0'
+ implementation 'androidx.webkit:webkit:1.4.0'
+ implementation 'com.whiteelephant:monthandyearpicker:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'org.mockito:mockito-android:3.0.0'
diff --git a/opensrp-chw/src/chad/java/org/smartregister/chw/activity/HivProfileActivityFlv.java b/opensrp-chw/src/chad/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
new file mode 100644
index 0000000000..dd5af7c454
--- /dev/null
+++ b/opensrp-chw/src/chad/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class HivProfileActivityFlv extends DefaultHivProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/chad/java/org/smartregister/chw/activity/TbProfileActivityFlv.java b/opensrp-chw/src/chad/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
new file mode 100644
index 0000000000..524838ce9e
--- /dev/null
+++ b/opensrp-chw/src/chad/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class TbProfileActivityFlv extends DefaultTbProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/drc/java/org/smartregister/chw/activity/HivProfileActivityFlv.java b/opensrp-chw/src/drc/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
new file mode 100644
index 0000000000..2b4ea8beb6
--- /dev/null
+++ b/opensrp-chw/src/drc/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
@@ -0,0 +1,5 @@
+package org.smartregister.chw.activity;
+
+public class HivProfileActivityFlv extends DefaultHivProfileActivityFlv {
+
+}
diff --git a/opensrp-chw/src/drc/java/org/smartregister/chw/activity/TbProfileActivityFlv.java b/opensrp-chw/src/drc/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
new file mode 100644
index 0000000000..794a0a6bec
--- /dev/null
+++ b/opensrp-chw/src/drc/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
@@ -0,0 +1,5 @@
+package org.smartregister.chw.activity;
+
+public class TbProfileActivityFlv extends DefaultTbProfileActivityFlv {
+
+}
diff --git a/opensrp-chw/src/guinea/java/org/smartregister/chw/activity/HivProfileActivityFlv.java b/opensrp-chw/src/guinea/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
new file mode 100644
index 0000000000..dd5af7c454
--- /dev/null
+++ b/opensrp-chw/src/guinea/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class HivProfileActivityFlv extends DefaultHivProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/guinea/java/org/smartregister/chw/activity/TbProfileActivityFlv.java b/opensrp-chw/src/guinea/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
new file mode 100644
index 0000000000..524838ce9e
--- /dev/null
+++ b/opensrp-chw/src/guinea/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class TbProfileActivityFlv extends DefaultTbProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/liberia/java/org/smartregister/chw/activity/HivProfileActivityFlv.java b/opensrp-chw/src/liberia/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
new file mode 100644
index 0000000000..dd5af7c454
--- /dev/null
+++ b/opensrp-chw/src/liberia/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class HivProfileActivityFlv extends DefaultHivProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/liberia/java/org/smartregister/chw/activity/TbProfileActivityFlv.java b/opensrp-chw/src/liberia/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
new file mode 100644
index 0000000000..524838ce9e
--- /dev/null
+++ b/opensrp-chw/src/liberia/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class TbProfileActivityFlv extends DefaultTbProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/HivProfileActivityFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
new file mode 100644
index 0000000000..dd5af7c454
--- /dev/null
+++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/HivProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class HivProfileActivityFlv extends DefaultHivProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/TbProfileActivityFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
new file mode 100644
index 0000000000..524838ce9e
--- /dev/null
+++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/TbProfileActivityFlv.java
@@ -0,0 +1,4 @@
+package org.smartregister.chw.activity;
+
+public class TbProfileActivityFlv extends DefaultTbProfileActivityFlv {
+}
diff --git a/opensrp-chw/src/main/AndroidManifest.xml b/opensrp-chw/src/main/AndroidManifest.xml
index 36a582f220..9d21615bc7 100644
--- a/opensrp-chw/src/main/AndroidManifest.xml
+++ b/opensrp-chw/src/main/AndroidManifest.xml
@@ -3,33 +3,115 @@
xmlns:tools="http://schemas.android.com/tools"
package="org.smartregister.chw">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -49,6 +134,9 @@
+
@@ -146,20 +234,6 @@
-
-
-
-
-
-
-
-
-
@@ -221,35 +292,108 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -279,12 +423,62 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/opensrp-chw/src/main/assets/config/mother_champion-reporting-indicator-definitions.yml b/opensrp-chw/src/main/assets/config/mother_champion-reporting-indicator-definitions.yml
new file mode 100644
index 0000000000..8cc489e938
--- /dev/null
+++ b/opensrp-chw/src/main/assets/config/mother_champion-reporting-indicator-definitions.yml
@@ -0,0 +1,53 @@
+indicators:
+ - key: "b-1"
+ description: "Idadi ya wateja wa PMTCT waliounganishwa kwenye kikundi/vikundi vya IGA and Ushauri Nasaha"
+ indicatorQuery: " SELECT count(DISTINCT emcf.entity_id) as count
+ from ec_mother_champion_followup emcf
+ WHERE linked_to_psychosocial_group = 'yes'
+ AND date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
+ date(substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 1, 4) ||
+ '-' ||
+ substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 6, 2) ||
+ '-' || '01')"
+ - key: "b-2"
+ description: "Idadi ya wateja wapya wa PMTCT waliofuatiliwa na mama vinara na kuanza kutumia dawa"
+ indicatorQuery: " SELECT count(DISTINCT emcf.entity_id) as count
+ from ec_mother_champion_followup emcf
+ WHERE visit_number = 0
+ AND date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
+ date(substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 1, 4) ||
+ '-' ||
+ substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 6, 2) ||
+ '-' || '01')"
+ - key: "b-3"
+ description: "Idadi ya wateja wa PMTCT waliopotea kwenye matumizi ya dawa (LTF) na kurudishwa/kufuatiliwa na mama vinara"
+ indicatorQuery: " SELECT count(DISTINCT epcf.entity_id) as count
+ from ec_pmtct_community_feedback epcf
+ WHERE date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
+ date(substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 1, 4) ||
+ '-' ||
+ substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 6, 2) ||
+ '-' || '01')"
+ - key: "b-4"
+ description: "Idadi ya vipindi alivyofundisha mama kinara/vinara kwa wateja wa PMTCT"
+ indicatorQuery: " SELECT count(DISTINCT id) as count
+ from ec_sbcc es
+ WHERE date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
+ date(substr(es.sbcc_date, 7, 4) || '-' || substr(es.sbcc_date, 4, 2) || '-' || '01')"
+ - key: "b-5"
+ description: "Idadi ya wateja wa PMTCT walioelimishwa na mama kinara/vinara"
+ indicatorQuery: " SELECT SUM(participants_number) as count
+ from ec_sbcc es
+ WHERE date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
+ date(substr(es.sbcc_date, 7, 4) || '-' || substr(es.sbcc_date, 4, 2) || '-' || '01')"
+ - key: "b-7"
+ description: "Idadi ya wenza waliofuatiliwa/kuletwa kituoni kupima"
+ indicatorQuery: " SELECT COUNT(DISTINCT eapcf.entity_id) as count
+ from ec_anc_partner_community_feedback eapcf
+ WHERE
+ partner_agree_attending_hf = 'yes'
+ AND date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
+ date(substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 1, 4) ||
+ '-' ||
+ substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 6, 2) ||
+ '-' || '01')"
\ No newline at end of file
diff --git a/opensrp-chw/src/main/assets/json.form/anc_pregnancy_outcome.json b/opensrp-chw/src/main/assets/json.form/anc_pregnancy_outcome.json
index ace7fe2a56..2170d22084 100644
--- a/opensrp-chw/src/main/assets/json.form/anc_pregnancy_outcome.json
+++ b/opensrp-chw/src/main/assets/json.form/anc_pregnancy_outcome.json
@@ -123,6 +123,7 @@
"hint": "Delivery date",
"expanded": false,
"max_date": "today",
+ "min_date": "today-6w",
"v_required": {
"value": "true",
"err": "Please enter date the woman delivered"
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/HealthFacilityVisitAction.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/HealthFacilityVisitAction.java
index 4393475af3..decda4b68a 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/HealthFacilityVisitAction.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/HealthFacilityVisitAction.java
@@ -67,9 +67,6 @@ public String getPreProcessed() {
LocalDate visitDate = dateList.get(0);
scheduleStatus = (visitDate.isBefore(LocalDate.now())) ? BaseAncHomeVisitAction.ScheduleStatus.OVERDUE : BaseAncHomeVisitAction.ScheduleStatus.DUE;
- String due = (visitDate.isBefore(LocalDate.now())) ? context.getString(R.string.overdue) : context.getString(R.string.due);
-
- subTitle = MessageFormat.format("{0}{1}", due, DateTimeFormat.forPattern("dd MMM yyyy").print(visitDate));
String title = jsonObject.getJSONObject(JsonFormConstants.STEP1).getString(JsonFormConstants.STEP_TITLE);
jsonObject.getJSONObject(JsonFormConstants.STEP1).put("title", MessageFormat.format(title, memberObject.getConfirmedContacts() + 1));
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPPreventiveServicesActionHelper.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPPreventiveServicesActionHelper.java
new file mode 100644
index 0000000000..9de0aa8e78
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPPreventiveServicesActionHelper.java
@@ -0,0 +1,99 @@
+package org.smartregister.chw.actionhelper;
+
+import static com.vijay.jsonwizard.utils.FormUtils.fields;
+import static com.vijay.jsonwizard.utils.FormUtils.getFieldJSONObject;
+import static org.smartregister.util.JsonFormUtils.STEP1;
+
+import android.content.Context;
+
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.smartregister.chw.core.utils.CoreJsonFormUtils;
+import org.smartregister.chw.kvp.dao.KvpDao;
+import org.smartregister.chw.kvp.domain.VisitDetail;
+import org.smartregister.chw.kvp.model.BaseKvpVisitAction;
+
+import java.util.List;
+import java.util.Map;
+
+public class KvpPrEPPreventiveServicesActionHelper implements BaseKvpVisitAction.KvpVisitActionHelper {
+
+ private String condoms_given;
+ private String jsonPayload;
+ private String baseEntityId;
+
+ public KvpPrEPPreventiveServicesActionHelper(String baseEntityId) {
+ this.baseEntityId = baseEntityId;
+ }
+
+ @Override
+ public void onJsonFormLoaded(String jsonPayload, Context context, Map> map) {
+ this.jsonPayload = jsonPayload;
+ }
+
+ @Override
+ public String getPreProcessed() {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ if (!KvpDao.getDominantKVPGroup(baseEntityId).equalsIgnoreCase("pwud") &&
+ !KvpDao.getDominantKVPGroup(baseEntityId).equalsIgnoreCase("pwid")) {
+ getFieldJSONObject(fields(jsonObject, STEP1), "number_of_needles_and_syringes_distributed").put("type", "hidden");
+ getFieldJSONObject(fields(jsonObject, STEP1), "number_of_sterile_water_for_injection_distributed").put("type", "hidden");
+ getFieldJSONObject(fields(jsonObject, STEP1), "number_of_alcohol_swabs_distributed").put("type", "hidden");
+ getFieldJSONObject(fields(jsonObject, STEP1), "number_of_disposable_safety_boxes_distributed").put("type", "hidden");
+ getFieldJSONObject(fields(jsonObject, STEP1), "number_of_plasters_distributed").put("type", "hidden");
+ getFieldJSONObject(fields(jsonObject, STEP1), "protective_items_for_PWID_label").put("type", "hidden");
+ }
+ return jsonObject.toString();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ public void onPayloadReceived(String jsonPayload) {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ condoms_given = CoreJsonFormUtils.getValue(jsonObject, "condoms_given");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public BaseKvpVisitAction.ScheduleStatus getPreProcessedStatus() {
+ return null;
+ }
+
+ @Override
+ public String getPreProcessedSubTitle() {
+ return null;
+ }
+
+ @Override
+ public String postProcess(String jsonPayload) {
+ return null;
+ }
+
+ @Override
+ public String evaluateSubTitle() {
+ return null;
+ }
+
+ @Override
+ public BaseKvpVisitAction.Status evaluateStatusOnPayload() {
+ if (StringUtils.isBlank(condoms_given))
+ return BaseKvpVisitAction.Status.PENDING;
+ else {
+ return BaseKvpVisitAction.Status.COMPLETED;
+ }
+ }
+
+ @Override
+ public void onPayloadReceived(BaseKvpVisitAction baseKvpVisitAction) {
+ //overridden
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPReferralServicesActionHelper.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPReferralServicesActionHelper.java
new file mode 100644
index 0000000000..4029436314
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPReferralServicesActionHelper.java
@@ -0,0 +1,80 @@
+package org.smartregister.chw.actionhelper;
+
+import android.content.Context;
+
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.smartregister.chw.core.utils.CoreJsonFormUtils;
+import org.smartregister.chw.kvp.domain.VisitDetail;
+import org.smartregister.chw.kvp.model.BaseKvpVisitAction;
+
+import java.util.List;
+import java.util.Map;
+
+public class KvpPrEPReferralServicesActionHelper implements BaseKvpVisitAction.KvpVisitActionHelper {
+
+ private String referral_to_structural_services;
+ private String jsonPayload;
+
+ @Override
+ public void onJsonFormLoaded(String jsonPayload, Context context, Map> map) {
+ this.jsonPayload = jsonPayload;
+ }
+
+ @Override
+ public String getPreProcessed() {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ return jsonObject.toString();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ public void onPayloadReceived(String jsonPayload) {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ referral_to_structural_services = CoreJsonFormUtils.getValue(jsonObject, "referral_to_structural_services");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public BaseKvpVisitAction.ScheduleStatus getPreProcessedStatus() {
+ return null;
+ }
+
+ @Override
+ public String getPreProcessedSubTitle() {
+ return null;
+ }
+
+ @Override
+ public String postProcess(String s) {
+ return null;
+ }
+
+ @Override
+ public String evaluateSubTitle() {
+ return null;
+ }
+
+ @Override
+ public BaseKvpVisitAction.Status evaluateStatusOnPayload() {
+ if (StringUtils.isBlank(referral_to_structural_services))
+ return BaseKvpVisitAction.Status.PENDING;
+ else {
+ return BaseKvpVisitAction.Status.COMPLETED;
+ }
+ }
+
+ @Override
+ public void onPayloadReceived(BaseKvpVisitAction baseKvpVisitAction) {
+ //overridden
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPSbccServicesActionHelper.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPSbccServicesActionHelper.java
new file mode 100644
index 0000000000..0de617d314
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPSbccServicesActionHelper.java
@@ -0,0 +1,82 @@
+package org.smartregister.chw.actionhelper;
+
+import android.content.Context;
+
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.smartregister.chw.core.utils.CoreJsonFormUtils;
+import org.smartregister.chw.kvp.domain.VisitDetail;
+import org.smartregister.chw.kvp.model.BaseKvpVisitAction;
+
+import java.util.List;
+import java.util.Map;
+
+public class KvpPrEPSbccServicesActionHelper implements BaseKvpVisitAction.KvpVisitActionHelper {
+
+ private String jsonPayload;
+ private String subTitle;
+ private String services_offered;
+ private BaseKvpVisitAction.ScheduleStatus scheduleStatus;
+
+ @Override
+ public void onJsonFormLoaded(String jsonPayload, Context context, Map> map) {
+ this.jsonPayload = jsonPayload;
+ }
+
+ @Override
+ public String getPreProcessed() {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ return jsonObject.toString();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ public void onPayloadReceived(String jsonPayload) {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ services_offered = CoreJsonFormUtils.getValue(jsonObject, "sbcc_services_offered");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public BaseKvpVisitAction.ScheduleStatus getPreProcessedStatus() {
+ return scheduleStatus;
+ }
+
+ @Override
+ public String getPreProcessedSubTitle() {
+ return subTitle;
+ }
+
+ @Override
+ public String postProcess(String s) {
+ return null;
+ }
+
+ @Override
+ public String evaluateSubTitle() {
+ return null;
+ }
+
+ @Override
+ public BaseKvpVisitAction.Status evaluateStatusOnPayload() {
+ if (StringUtils.isBlank(services_offered))
+ return BaseKvpVisitAction.Status.PENDING;
+ else {
+ return BaseKvpVisitAction.Status.COMPLETED;
+ }
+ }
+
+ @Override
+ public void onPayloadReceived(BaseKvpVisitAction baseKvpVisitAction) {
+ //Overridden
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPStructuralServicesActionHelper.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPStructuralServicesActionHelper.java
new file mode 100644
index 0000000000..c4250ead88
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPStructuralServicesActionHelper.java
@@ -0,0 +1,80 @@
+package org.smartregister.chw.actionhelper;
+
+import android.content.Context;
+
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.smartregister.chw.core.utils.CoreJsonFormUtils;
+import org.smartregister.chw.kvp.domain.VisitDetail;
+import org.smartregister.chw.kvp.model.BaseKvpVisitAction;
+
+import java.util.List;
+import java.util.Map;
+
+public class KvpPrEPStructuralServicesActionHelper implements BaseKvpVisitAction.KvpVisitActionHelper {
+
+ private String structural_services_provided;
+ private String jsonPayload;
+
+ @Override
+ public void onJsonFormLoaded(String jsonPayload, Context context, Map> map) {
+ this.jsonPayload = jsonPayload;
+ }
+
+ @Override
+ public String getPreProcessed() {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ return jsonObject.toString();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ public void onPayloadReceived(String jsonPayload) {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ structural_services_provided = CoreJsonFormUtils.getValue(jsonObject, "structural_services_provided");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public BaseKvpVisitAction.ScheduleStatus getPreProcessedStatus() {
+ return null;
+ }
+
+ @Override
+ public String getPreProcessedSubTitle() {
+ return null;
+ }
+
+ @Override
+ public String postProcess(String s) {
+ return null;
+ }
+
+ @Override
+ public String evaluateSubTitle() {
+ return null;
+ }
+
+ @Override
+ public BaseKvpVisitAction.Status evaluateStatusOnPayload() {
+ if (StringUtils.isBlank(structural_services_provided))
+ return BaseKvpVisitAction.Status.PENDING;
+ else {
+ return BaseKvpVisitAction.Status.COMPLETED;
+ }
+ }
+
+ @Override
+ public void onPayloadReceived(BaseKvpVisitAction baseKvpVisitAction) {
+ //overridden
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPVisitTypeActionHelper.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPVisitTypeActionHelper.java
new file mode 100644
index 0000000000..e10f0f1d49
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/KvpPrEPVisitTypeActionHelper.java
@@ -0,0 +1,80 @@
+package org.smartregister.chw.actionhelper;
+
+import android.content.Context;
+
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.smartregister.chw.core.utils.CoreJsonFormUtils;
+import org.smartregister.chw.kvp.domain.VisitDetail;
+import org.smartregister.chw.kvp.model.BaseKvpVisitAction;
+
+import java.util.List;
+import java.util.Map;
+
+public class KvpPrEPVisitTypeActionHelper implements BaseKvpVisitAction.KvpVisitActionHelper {
+
+ private String jsonPayload;
+ private String visitType;
+
+ @Override
+ public void onJsonFormLoaded(String jsonPayload, Context context, Map> map) {
+ this.jsonPayload = jsonPayload;
+ }
+
+ @Override
+ public String getPreProcessed() {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ return jsonObject.toString();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ public void onPayloadReceived(String jsonPayload) {
+ try {
+ JSONObject jsonObject = new JSONObject(jsonPayload);
+ visitType = CoreJsonFormUtils.getValue(jsonObject, "visit_type");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public BaseKvpVisitAction.ScheduleStatus getPreProcessedStatus() {
+ return null;
+ }
+
+ @Override
+ public String getPreProcessedSubTitle() {
+ return null;
+ }
+
+ @Override
+ public String postProcess(String jsonPayload) {
+ return null;
+ }
+
+ @Override
+ public String evaluateSubTitle() {
+ return null;
+ }
+
+ @Override
+ public BaseKvpVisitAction.Status evaluateStatusOnPayload() {
+ if (StringUtils.isBlank(visitType))
+ return BaseKvpVisitAction.Status.PENDING;
+ else {
+ return BaseKvpVisitAction.Status.COMPLETED;
+ }
+ }
+
+ @Override
+ public void onPayloadReceived(BaseKvpVisitAction baseKvpVisitAction) {
+ //overridden
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWReportsActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWReportsActivity.java
new file mode 100644
index 0000000000..1560d122dd
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWReportsActivity.java
@@ -0,0 +1,22 @@
+package org.smartregister.chw.activity;
+import android.view.View;
+import android.widget.TextView;
+import org.smartregister.chw.R;
+
+public class AGYWReportsActivity extends CBHSReportsActivity{
+ @Override
+ public void onClick(View v) {
+ int id = v.getId();
+ if (id == R.id.cbhs_monthly_summary) {
+ AGYWReportsViewActivity.startMe(this, "agyw-report", reportPeriod);
+ }
+ }
+
+ @Override
+ public void setUpToolbar() {
+ super.setUpToolbar();
+ TextView title = findViewById(R.id.toolbar_title);
+ title.setText(R.string.agyw_reports);
+ }
+
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWReportsViewActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWReportsViewActivity.java
new file mode 100644
index 0000000000..68d539dda7
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWReportsViewActivity.java
@@ -0,0 +1,19 @@
+package org.smartregister.chw.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+
+import org.smartregister.chw.R;
+import org.smartregister.chw.util.Constants;
+
+
+public class AGYWReportsViewActivity extends ChwReportsViewActivity{
+ public static void startMe(Activity activity, String reportPath, String reportDate) {
+ Intent intent = new Intent(activity, AGYWReportsViewActivity.class);
+ intent.putExtra(ARG_REPORT_PATH, reportPath);
+ intent.putExtra(ARG_REPORT_DATE, reportDate);
+ intent.putExtra(ARG_REPORT_TITLE, R.string.agyw_reports);
+ intent.putExtra(ARG_REPORT_TYPE, Constants.ReportConstants.ReportTypes.AGYW_REPORT);
+ activity.startActivity(intent);
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWServicesActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWServicesActivity.java
new file mode 100644
index 0000000000..d4e82c2917
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AGYWServicesActivity.java
@@ -0,0 +1,22 @@
+package org.smartregister.chw.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+
+import org.smartregister.chw.agyw.activity.BaseAGYWServicesActivity;
+import org.smartregister.chw.agyw.handlers.BaseServiceActionHandler;
+import org.smartregister.chw.agyw.util.Constants;
+import org.smartregister.chw.listener.AgywServiceActionHandler;
+
+public class AGYWServicesActivity extends BaseAGYWServicesActivity {
+ public static void startMe(Activity activity, String baseEntityID) {
+ Intent intent = new Intent(activity, AGYWServicesActivity.class);
+ intent.putExtra(Constants.ACTIVITY_PAYLOAD.BASE_ENTITY_ID, baseEntityID);
+ activity.startActivity(intent);
+ }
+
+ @Override
+ public BaseServiceActionHandler getServiceHandler() {
+ return new AgywServiceActionHandler();
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java
index 229eb4e398..52b3614d9d 100644
--- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java
@@ -1,5 +1,7 @@
package org.smartregister.chw.activity;
+import static org.smartregister.chw.util.Constants.MALARIA_REFERRAL_FORM;
+
import android.app.Activity;
import android.content.Intent;
import android.view.Gravity;
@@ -18,14 +20,13 @@
import org.smartregister.chw.model.ReferralTypeModel;
import org.smartregister.chw.presenter.AboveFiveChildProfilePresenter;
import org.smartregister.chw.schedulers.ChwScheduleTaskExecutor;
+import org.smartregister.chw.util.UtilsFlv;
import org.smartregister.family.util.Constants;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import static org.smartregister.chw.util.Constants.MALARIA_REFERRAL_FORM;
-
public class AboveFiveChildProfileActivity extends CoreAboveFiveChildProfileActivity {
public FamilyMemberFloatingMenu familyFloatingMenu;
private List referralTypeModels = new ArrayList<>();
@@ -39,6 +40,8 @@ public List getReferralTypeModels() {
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.findItem(R.id.action_malaria_followup_visit).setVisible(false);
+ if (ChwApplication.getApplicationFlavor().hasMalaria())
+ UtilsFlv.updateMalariaMenuItems(memberObject.getBaseEntityId(), menu);
return true;
}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AgywMedicalHistoryActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AgywMedicalHistoryActivity.java
new file mode 100644
index 0000000000..e2bd927054
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AgywMedicalHistoryActivity.java
@@ -0,0 +1,61 @@
+package org.smartregister.chw.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.view.View;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+import org.smartregister.chw.R;
+import org.smartregister.chw.agyw.domain.MemberObject;
+import org.smartregister.chw.anc.domain.Visit;
+import org.smartregister.chw.anc.presenter.BaseAncMedicalHistoryPresenter;
+import org.smartregister.chw.core.activity.CoreAncMedicalHistoryActivity;
+import org.smartregister.chw.interactor.AgywMedicalHistoryInteractor;
+
+import java.util.List;
+
+public class AgywMedicalHistoryActivity extends CoreAncMedicalHistoryActivity {
+ private static MemberObject agywMemberObject;
+ private final Flavor flavor = new AgywMedicalHistoryActivityFlv();
+ private ProgressBar progressBar;
+
+ public static void startMe(Activity activity, MemberObject memberObject) {
+ Intent intent = new Intent(activity, AgywMedicalHistoryActivity.class);
+ agywMemberObject = memberObject;
+ activity.startActivity(intent);
+ }
+
+ @Override
+ public void initializePresenter() {
+ presenter = new BaseAncMedicalHistoryPresenter(new AgywMedicalHistoryInteractor(), this, agywMemberObject.getBaseEntityId());
+ }
+
+ @Override
+ public void setUpView() {
+ linearLayout = findViewById(org.smartregister.chw.opensrp_chw_anc.R.id.linearLayoutMedicalHistory);
+ progressBar = findViewById(org.smartregister.chw.opensrp_chw_anc.R.id.progressBarMedicalHistory);
+
+ TextView tvTitle = findViewById(org.smartregister.chw.opensrp_chw_anc.R.id.tvTitle);
+ tvTitle.setText(getString(org.smartregister.chw.opensrp_chw_anc.R.string.back_to, agywMemberObject.getFullName()));
+
+ ((TextView) findViewById(R.id.medical_history)).setText(getString(R.string.visits_history));
+ }
+
+ @Override
+ public View renderView(List visits) {
+ super.renderView(visits);
+ View view = flavor.bindViews(this);
+ displayLoadingState(true);
+ flavor.processViewData(visits, this);
+ displayLoadingState(false);
+ TextView agywVisitTitle = view.findViewById(org.smartregister.chw.core.R.id.customFontTextViewHealthFacilityVisitTitle);
+ agywVisitTitle.setText(R.string.agyw_visit);
+ return view;
+ }
+
+ @Override
+ public void displayLoadingState(boolean state) {
+ progressBar.setVisibility(state ? View.VISIBLE : View.GONE);
+ }
+}
diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AgywMedicalHistoryActivityFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AgywMedicalHistoryActivityFlv.java
new file mode 100644
index 0000000000..027fc7f578
--- /dev/null
+++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AgywMedicalHistoryActivityFlv.java
@@ -0,0 +1,211 @@
+package org.smartregister.chw.activity;
+
+import android.content.Context;
+import android.text.Spannable;
+import android.text.SpannableStringBuilder;
+import android.text.Spanned;
+import android.text.style.BulletSpan;
+import android.text.style.StyleSpan;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+import org.joda.time.Days;
+import org.smartregister.chw.R;
+import org.smartregister.chw.anc.domain.Visit;
+import org.smartregister.chw.anc.domain.VisitDetail;
+import org.smartregister.chw.core.activity.DefaultAncMedicalHistoryActivityFlv;
+import org.smartregister.chw.util.Constants;
+
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import timber.log.Timber;
+
+public class AgywMedicalHistoryActivityFlv extends DefaultAncMedicalHistoryActivityFlv {
+ private final StyleSpan boldSpan = new StyleSpan(android.graphics.Typeface.BOLD);
+ private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.getDefault());
+
+ @Override
+ protected void processAncCard(String has_card, Context context) {
+ // super.processAncCard(has_card, context);
+ linearLayoutAncCard.setVisibility(View.GONE);
+ }
+
+ @Override
+ protected void processHealthFacilityVisit(List