diff --git a/opensrp-anc/build.gradle b/opensrp-anc/build.gradle index 707793e7a..eb3939e19 100644 --- a/opensrp-anc/build.gradle +++ b/opensrp-anc/build.gradle @@ -178,7 +178,7 @@ tasks.withType(Test) { dependencies { implementation 'androidx.appcompat:appcompat:1.3.1' - implementation('org.smartregister:opensrp-client-native-form:2.1.18-PREVIEW-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-native-form:2.1.19-PREVIEW-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'recyclerview-v7' exclude group: 'com.android.support', module: 'appcompat-v7' @@ -205,7 +205,7 @@ dependencies { exclude group: 'org.smartregister', module: 'android-p2p-sync' } - api("org.smartregister:android-p2p-sync:0.3.8-aplha4-SNAPSHOT") { + api("org.smartregister:android-p2p-sync:0.3.9-SNAPSHOT") { transitive = true exclude group: 'org.smartregister', module: 'opensrp-client-core' exclude group: 'com.android.support', module: 'appcompat-v7' diff --git a/opensrp-anc/src/main/AndroidManifest.xml b/opensrp-anc/src/main/AndroidManifest.xml index 34526da7d..f0ce797f3 100644 --- a/opensrp-anc/src/main/AndroidManifest.xml +++ b/opensrp-anc/src/main/AndroidManifest.xml @@ -8,7 +8,8 @@ - + diff --git a/opensrp-anc/src/main/assets/config/profile-overview.yml b/opensrp-anc/src/main/assets/config/profile-overview.yml index d677ae47c..48bca0622 100644 --- a/opensrp-anc/src/main/assets/config/profile-overview.yml +++ b/opensrp-anc/src/main/assets/config/profile-overview.yml @@ -243,7 +243,7 @@ fields: relevance: "severe_preeclampsia == 1" isRedFont: "true" - - template: "Rh factor negative: {rh_factor}" + - template: "Rh factor : {rh_factor}" relevance: "rh_factor == 'negative'" isRedFont: "true" diff --git a/opensrp-anc/src/main/assets/json.form/anc_physical_exam.json b/opensrp-anc/src/main/assets/json.form/anc_physical_exam.json index 3a87dfdf6..fb0d0ca6a 100644 --- a/opensrp-anc/src/main/assets/json.form/anc_physical_exam.json +++ b/opensrp-anc/src/main/assets/json.form/anc_physical_exam.json @@ -106,11 +106,11 @@ }, "v_min": { "value": "100", - "err": "{{anc_physical_exam.step1.height.v_min.err}}" + "err": "Height must be equal or greater than 100" }, "v_max": { "value": "200", - "err": "{{anc_physical_exam.step1.height.v_max.err}}" + "err": "Height must be equal or less than 200" } }, { @@ -168,11 +168,11 @@ }, "v_min": { "value": "30", - "err": "{{anc_physical_exam.step1.pregest_weight.v_min.err}}" + "err": "Weight must be equal or greater than 30" }, "v_max": { "value": "180", - "err": "{{anc_physical_exam.step1.pregest_weight.v_max.err}}" + "err": "Weight must be equal or less than 180" }, "v_required": { "value": "true", @@ -228,11 +228,11 @@ }, "v_min": { "value": "30", - "err": "{{anc_physical_exam.step1.current_weight.v_min.err}}" + "err": "Weight must be equal or greater than 30" }, "v_max": { "value": "180", - "err": "{{anc_physical_exam.step1.current_weight.v_max.err}}" + "err": "Weight must be equal or less than 180" }, "v_required": { "value": "true", @@ -459,44 +459,6 @@ "title": "{{anc_physical_exam.step2.title}}", "next": "step3", "fields": [ - { - "key": "bp_measurement_method", - "openmrs_entity_parent": "", - "openmrs_entity": "concept", - "openmrs_entity_id": "", - "type": "check_box", - "label": "{{anc_physical_exam.step2.bp_measurement_method.label}}", - "label_text_style": "bold", - "text_color": "#000000", - "exclusive": [ - "optibp", - "manually" - ], - "options": [ - { - "key": "optibp", - "text": "{{anc_physical_exam.step2.bp_measurement_method.options.optibp.text}}", - "translation_text": "anc_physical_exam.step2.bp_measurement_method.options.optibp.text", - "value": false, - "openmrs_entity": "", - "openmrs_entity_id": "", - "openmrs_entity_parent": "" - }, - { - "key": "manually", - "text": "{{anc_physical_exam.step2.bp_measurement_method.options.manually.text}}", - "translation_text": "anc_physical_exam.step2.bp_measurement_method.options.manually.text", - "value": false, - "openmrs_entity": "", - "openmrs_entity_id": "", - "openmrs_entity_parent": "" - } - ], - "v_required": { - "value": "true", - "err": "{{anc_physical_exam.step2.bp_measurement_method.v_required.err}}" - } - }, { "key": "bp_systolic_label", "type": "label", @@ -507,10 +469,14 @@ "value": true }, "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } + "step2:cant_record_bp": { + "ex-checkbox": [ + { + "not": [ + "cant_record_bp" + ] + } + ] } } }, @@ -528,21 +494,25 @@ }, "v_min": { "value": "20", - "err": "{{anc_physical_exam.step2.bp_systolic.v_min.err}}" + "err": "SBP must be equal or greater than 20" }, "v_max": { "value": "260", - "err": "{{anc_physical_exam.step2.bp_systolic.v_max.err}}" + "err": "SBP must be equal or less than 260" }, "v_required": { "value": "true", "err": "{{anc_physical_exam.step2.bp_systolic.v_required.err}}" }, "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } + "step2:cant_record_bp": { + "ex-checkbox": [ + { + "not": [ + "cant_record_bp" + ] + } + ] } } }, @@ -554,10 +524,14 @@ "type": "spacer", "spacer_height": "10sp", "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } + "step2:cant_record_bp": { + "ex-checkbox": [ + { + "not": [ + "cant_record_bp" + ] + } + ] } } }, @@ -571,10 +545,14 @@ "value": true }, "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } + "step2:cant_record_bp": { + "ex-checkbox": [ + { + "not": [ + "cant_record_bp" + ] + } + ] } } }, @@ -592,21 +570,25 @@ }, "v_min": { "value": "20", - "err": "{{anc_physical_exam.step2.bp_diastolic.v_min.err}}" + "err": "DBP must be equal to or greater than 20" }, "v_max": { "value": "260", - "err": "{{anc_physical_exam.step2.bp_diastolic.v_max.err}}" + "err": "DBP must be equal to or less than 260" }, "v_required": { "value": "true", "err": "{{anc_physical_exam.step2.bp_diastolic.v_required.err}}" }, "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } + "step2:cant_record_bp": { + "ex-checkbox": [ + { + "not": [ + "cant_record_bp" + ] + } + ] } } }, @@ -625,14 +607,7 @@ "openmrs_entity": "", "openmrs_entity_id": "" } - ], - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } - } - } + ] }, { "key": "cant_record_bp_reason", @@ -671,54 +646,14 @@ "err": "{{anc_physical_exam.step2.cant_record_bp_reason.v_required.err}}" }, "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } - } - } - }, - { - "key": "cant_record_bp_reason_opt", - "openmrs_entity_parent": "", - "openmrs_entity": "concept", - "openmrs_entity_id": "165428AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "label": "{{anc_physical_exam.step2.cant_record_bp_reason_opt.label}}", - "type": "check_box", - "label_text_style": "bold", - "text_color": "#000000", - "options": [ - { - "key": "optibp_didnt_load", - "text": "{{anc_physical_exam.step2.cant_record_bp_reason_opt.options.optibp_didnt_load.text}}", - "openmrs_entity_parent": "", - "openmrs_entity": "concept", - "openmrs_entity_id": "165386AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - { - "key": "optibp_returned_error", - "text": "{{anc_physical_exam.step2.cant_record_bp_reason_opt.options.optibp_returned_error.text}}", - "openmrs_entity_parent": "", - "openmrs_entity": "concept", - "openmrs_entity_id": "165179AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - { - "key": "other", - "text": "{{anc_physical_exam.step2.cant_record_bp_reason.options.other.text}}", - "openmrs_entity_parent": "", - "openmrs_entity": "concept", - "openmrs_entity_id": "5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - ], - "v_required": { - "value": "true", - "err": "{{anc_physical_exam.step2.cant_record_bp_reason.v_required.err}}" - }, - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } + "step2:cant_record_bp": { + "ex-checkbox": [ + { + "or": [ + "cant_record_bp" + ] + } + ] } } }, @@ -730,32 +665,6 @@ "type": "spacer", "spacer_height": "10sp" }, - { - "key": "record_bp_using_optibp_button", - "openmrs_entity_parent": "", - "openmrs_entity": "concept", - "openmrs_entity_id": "", - "type": "optibp", - "label": "{{anc_physical_exam.step2.record_bp_using_optibp_button.label}}", - "optibp_button_bg_color": "#EB5281", - "optibp_button_text_color": "#FFFFFF", - "read_only": false, - "optibp_data": { - "clientId": "", - "clientOpenSRPId": "" - }, - "fields_to_use_value": [ - "bp_systolic", - "bp_diastolic" - ], - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } - } - } - }, { "key": "toaster7", "openmrs_entity_parent": "", @@ -812,11 +721,11 @@ }, "v_min": { "value": "20", - "err": "{{anc_physical_exam.step2.bp_systolic_repeat.v_min.err}}" + "err": "SBP must be equal or greater than 20" }, "v_max": { "value": "260", - "err": "{{anc_physical_exam.step2.bp_systolic_repeat.v_max.err}}" + "err": "SBP must be equal or less than 260" }, "v_required": { "value": "true", @@ -869,11 +778,11 @@ }, "v_min": { "value": "20", - "err": "{{anc_physical_exam.step2.bp_diastolic_repeat.v_min.err}}" + "err": "DBP must be equal or greater than 20" }, "v_max": { "value": "260", - "err": "{{anc_physical_exam.step2.bp_diastolic_repeat.v_max.err}}" + "err": "DBP must be equal or less than 260" }, "v_required": { "value": "true", @@ -887,33 +796,6 @@ } } }, - { - "key": "record_bp_using_optibp_2nd_reading_button", - "openmrs_entity_parent": "", - "openmrs_entity": "concept", - "openmrs_entity_id": "", - "type": "optibp", - "label": "{{anc_physical_exam.step2.record_bp_using_optibp_2nd_reading_button.label}}", - "optibp_button_bg_color": "#EB5281", - "optibp_button_text_color": "#FFFFFF", - "optibp_button_text": "{{anc_physical_exam.step2.record_bp_using_optibp_2nd_reading_button.text}}", - "read_only": false, - "optibp_data": { - "clientId": "", - "clientOpenSRPId": "" - }, - "fields_to_use_value": [ - "bp_systolic_repeat", - "bp_diastolic_repeat" - ], - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "physical-exam-relevance-rules.yml" - } - } - } - }, { "key": "toaster8", "openmrs_entity_parent": "", @@ -1257,11 +1139,11 @@ }, "v_min": { "value": "35", - "err": "{{anc_physical_exam.step3.body_temp.v_min.err}}" + "err": "Temperature must be equal to or greater than 35" }, "v_max": { "value": "42", - "err": "{{anc_physical_exam.step3.body_temp.v_max.err}}" + "err": "Temperature must be equal to or less than 42" } }, { @@ -1329,11 +1211,11 @@ }, "v_min": { "value": "35", - "err": "{{anc_physical_exam.step3.body_temp_repeat.v_min.err}}" + "err": "Temperature must be equal to or greater than 35" }, "v_max": { "value": "42", - "err": "{{anc_physical_exam.step3.body_temp_repeat.v_max.err}}" + "err": "Temperature must be equal to or less than 42" } }, { @@ -1389,11 +1271,11 @@ }, "v_min": { "value": "20", - "err": "{{anc_physical_exam.step3.pulse_rate.v_min.err}}" + "err": "Pulse rate must be equal to or greater than 20" }, "v_max": { "value": "200", - "err": "{{anc_physical_exam.step3.pulse_rate.v_max.err}}" + "err": "Pulse rate must be equal to or less than 200" } }, { @@ -1453,11 +1335,11 @@ }, "v_min": { "value": "20", - "err": "{{anc_physical_exam.step3.pulse_rate_repeat.v_min.err}}" + "err": "Pulse rate must be equal to or greater than 20" }, "v_max": { "value": "200", - "err": "{{anc_physical_exam.step3.pulse_rate_repeat.v_max.err}}" + "err": "Pulse rate must be equal to or less than 200" }, "v_required": { "value": "true", @@ -2100,7 +1982,6 @@ { "key": "none", "text": "{{anc_physical_exam.step3.ipv_physical_signs_symptoms.options.none.text}}", - "translation_text": "anc_physical_exam.step3.ipv_physical_signs_symptoms.options.none.text", "value": false, "openmrs_entity": "concept", "openmrs_entity_id": "", @@ -2109,7 +1990,6 @@ { "key": "abdomen_injury", "text": "{{anc_physical_exam.step3.ipv_physical_signs_symptoms.options.abdomen_injury.text}}", - "translation_text": "anc_physical_exam.step3.ipv_physical_signs_symptoms.options.abdomen_injury.text", "value": false, "openmrs_entity": "concept", "openmrs_entity_id": "", @@ -2118,7 +1998,6 @@ { "key": "other_injury", "text": "{{anc_physical_exam.step3.ipv_physical_signs_symptoms.options.other_injury.text}}", - "translation_text": "anc_physical_exam.step3.ipv_physical_signs_symptoms.other_injury.none.text", "value": false, "openmrs_entity": "concept", "openmrs_entity_id": "", @@ -2127,7 +2006,6 @@ { "key": "other", "text": "{{anc_physical_exam.step3.ipv_physical_signs_symptoms.options.other.text}}", - "translation_text": "anc_physical_exam.step3.ipv_physical_signs_symptoms.options.other.text", "value": false, "openmrs_entity": "concept", "openmrs_entity_id": "", @@ -2441,15 +2319,15 @@ "edit_type": "number", "v_min": { "value": "0.1", - "err": "{{anc_physical_exam.step4.sfh.v_min.err}}" + "err": "SFH must be greater than 0" }, "v_max": { "value": "44", - "err": "{{anc_physical_exam.step4.sfh.v_max.err}}" + "err": "SFH must be less than or equal to 44" }, "v_numeric_integer": { "value": "true", - "err": "{{anc_physical_exam.step4.sfh.v_numeric_integer.err}}" + "err": "Enter a valid sfh" }, "v_required": { "value": "false", @@ -2562,15 +2440,15 @@ "edit_type": "number", "v_min": { "value": "80", - "err": "{{anc_physical_exam.step4.fetal_heart_rate.v_min.err}}" + "err": "Fetal heartbeat must be equal or greater than 80" }, "v_max": { "value": "200", - "err": "{{anc_physical_exam.step4.fetal_heart_rate.v_max.err}}" + "err": "Fetal heartbeat must be less than or equal to 200" }, "v_numeric_integer": { "value": "true", - "err": "{{anc_physical_exam.step4.fetal_heart_rate.v_numeric_integer.err}}" + "err": "Enter a valid number" }, "relevance": { "step4:fetal_heartbeat": { diff --git a/opensrp-anc/src/main/java/org/smartregister/anc/library/util/ANCFailSafeRecalledID.java b/opensrp-anc/src/main/java/org/smartregister/anc/library/util/ANCFailSafeRecalledID.java new file mode 100644 index 000000000..928a7dbd1 --- /dev/null +++ b/opensrp-anc/src/main/java/org/smartregister/anc/library/util/ANCFailSafeRecalledID.java @@ -0,0 +1,32 @@ +package org.smartregister.anc.library.util; + + +import android.content.Context; +import android.content.SharedPreferences; + +import androidx.annotation.NonNull; + +import org.smartregister.p2p.contract.RecalledIdentifier; +import org.smartregister.p2p.util.Constants; +import org.smartregister.p2p.util.Device; + +import java.util.UUID; + +public class ANCFailSafeRecalledID implements RecalledIdentifier { + private static final String FAIL_SAFE_ID = "P2P_FAIL_SAFE_ID"; + + @NonNull + @Override + public String getUniqueID(Context context) { + String uniqueAddress = Device.getMacAddress(); + if (uniqueAddress == null) { + SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.Prefs.NAME, Context.MODE_PRIVATE); + uniqueAddress = sharedPreferences.getString(FAIL_SAFE_ID, null); + if (uniqueAddress == null) { + uniqueAddress = UUID.randomUUID().toString(); + sharedPreferences.edit().putString(FAIL_SAFE_ID, uniqueAddress).apply(); + } + } + return uniqueAddress; + } +} diff --git a/opensrp-anc/src/main/resources/anc_physical_exam.properties b/opensrp-anc/src/main/resources/anc_physical_exam.properties index b7e1d45fc..83842dc53 100644 --- a/opensrp-anc/src/main/resources/anc_physical_exam.properties +++ b/opensrp-anc/src/main/resources/anc_physical_exam.properties @@ -88,7 +88,7 @@ anc_physical_exam.step3.toaster17.text = Abnormal pulse rate. Check again after anc_physical_exam.step1.toaster5.text = Increase daily energy and protein intake counseling anc_physical_exam.step2.urine_protein.options.none.text = None anc_physical_exam.step2.cant_record_bp_reason.label = Reason -anc_physical_exam.step2.toaster13.text = Severe pre-eclampsia diagnosis! Provide urgent treatment and refer to hospital! +anc_physical_exam.step2.toaster13.text = "Woman has severe pre-eclampsia - SBP of 160 mmHg or above and/or DBP of 110 mmHg or above and proteinuria 23+ OR woman has SBP of 140 mmHg or above and/or DBP of 90 mmHg or above and proteinuria 2+ with at least one symptom of severe pre-eclampsia.\n\nProcedure: \n- Give magnesium sulphate \n- Give appropriate anti-hypertensives \n- Revise the birth plan \n- Refer urgently to hospital!" anc_physical_exam.step3.pallor.label = Pallor present? anc_physical_exam.step4.fetal_movement.v_required.err = Please this field is required. anc_physical_exam.step4.title = Fetal Assessment @@ -182,4 +182,42 @@ anc_physical_exam.step3.ipv_subject_violence_types.label_info_text = What type(s anc_physical_exam.step3.ipv_subject_violence_types.options.phys_violence.text = Physical violence (e.g. slapping, kicking, burning) anc_physical_exam.step3.ipv_subject_violence_types.options.sexual_violence.text = Sexual violence anc_physical_exam.step3.ipv_subject_violence_types.options.emotional_abuse.text = Psychological or emotional abuse (e.g. being threatened or intimidated, controlling behaviors, such as taking away money) +anc_physical_exam.step1.height.v_min.err = Height must be equal or greater than 100 +anc_physical_exam.step1.pregest_weight.v_min.err = Weight must be equal or greater than 30 +anc_physical_exam.step1.current_weight.v_max.err = Weight must be equal or less than 180 +anc_physical_exam.step2.bp_systolic.v_max.err = SBP must be equal or less than 260 +anc_physical_exam.step2.cant_record_bp_reason_opt.options.optibp_didnt_load.text = OptiBP didn't load/respond +anc_physical_exam.step3.pulse_rate.v_min.err = Pulse rate must be equal to or greater than 20 +anc_physical_exam.step2.cant_record_bp_reason_opt.options.optibp_returned_error.text = OptiBP returned an error/message +anc_physical_exam.step4.fetal_heart_rate.v_min.err = Fetal heartbeat must be equal or greater than 80 +anc_physical_exam.step4.sfh.v_min.err = SFH must be greater than 0 +anc_physical_exam.step2.bp_diastolic_repeat.v_min.err = DBP must be equal or greater than 20 +anc_physical_exam.step3.body_temp.v_max.err = Temperature must be equal to or less than 42 +anc_physical_exam.step2.bp_measurement_method.options.manually.text = Manually +anc_physical_exam.step2.bp_measurement_method.label = Which BP measurement method are you using? +anc_physical_exam.step2.cant_record_bp_reason_opt.label = Reason blood pressure not taken +anc_physical_exam.step2.bp_diastolic.v_max.err = DBP must be equal to or less than 260 +anc_physical_exam.step1.height.v_max.err = Height must be equal or less than 200 +anc_physical_exam.step3.pulse_rate_repeat.v_min.err = Pulse rate must be equal to or greater than 20 +anc_physical_exam.step2.bp_systolic_repeat.v_max.err = SBP must be equal or less than 260 +anc_physical_exam.step3.pulse_rate.v_max.err = Pulse rate must be equal to or less than 200 +anc_physical_exam.step2.record_bp_using_optibp_button.label = Measure woman blood pressure using OptiBP +anc_physical_exam.step2.bp_measurement_method.options.optibp.text = OptiBP +anc_physical_exam.step4.fetal_heart_rate.v_numeric_integer.err = Enter a valid number +anc_physical_exam.step2.bp_systolic.v_min.err = SBP must be equal or greater than 20 +anc_physical_exam.step1.current_weight.v_min.err = Weight must be equal or greater than 30 +anc_physical_exam.step4.fetal_heart_rate.v_max.err = Fetal heartbeat must be less than or equal to 200 +anc_physical_exam.step1.pregest_weight.v_max.err = Weight must be equal or less than 180 +anc_physical_exam.step4.sfh.v_numeric_integer.err = Enter a valid sfh +anc_physical_exam.step2.bp_diastolic.v_min.err = DBP must be equal to or greater than 20 +anc_physical_exam.step3.body_temp_repeat.v_max.err = Temperature must be equal to or greater than 35 +anc_physical_exam.step4.sfh.v_max.err = SFH must be less than or equal to 44 +anc_physical_exam.step3.body_temp.v_min.err = Temperature must be equal to or greater than 35 +anc_physical_exam.step2.bp_diastolic_repeat.v_max.err = DBP must be equal or less than 260 +anc_physical_exam.step2.bp_systolic_repeat.v_min.err = SBP must be equal or greater than 20 +anc_physical_exam.step3.pulse_rate_repeat.v_max.err = Pulse rate must be equal to or less than 200 +anc_physical_exam.step2.bp_measurement_method.v_required.err = Please select measurement method +anc_physical_exam.step2.record_bp_using_optibp_2nd_reading_button.label = Remeasure woman blood pressure using OptiBP +anc_physical_exam.step2.record_bp_using_optibp_2nd_reading_button.text = Remeasure +anc_physical_exam.step3.body_temp_repeat.v_min.err = Temperature must be equal to or greater than 35 anc_physical_exam.step3.ipv_subject_violence_types.options.family_member_violence.text = Violence by other family members (not intimate partner) \ No newline at end of file diff --git a/opensrp-anc/src/main/resources/profile_overview.properties b/opensrp-anc/src/main/resources/profile_overview.properties index 63cc84f68..018dcf3f4 100644 --- a/opensrp-anc/src/main/resources/profile_overview.properties +++ b/opensrp-anc/src/main/resources/profile_overview.properties @@ -59,4 +59,6 @@ profile_overview.immunisation_status.tt_immunisation_status = TTCV immunisation profile_overview.immunisation_status.tt_dose_1 = TTCV dose #1 profile_overview.immunisation_status.tt_dose_2 = TTCV dose #2 profile_overview.immunisation_status.flu_immunisation_status = Flu immunisation status -profile_overview.immunisation_status.flu_dose = Flu dose \ No newline at end of file +profile_overview.immunisation_status.flu_dose = Flu dose +profile_overview.immunisation_status.hiv_positive = Positive +profile_overview.immunisation_status.hiv_negative = Negative diff --git a/reference-app/build.gradle b/reference-app/build.gradle index d219f96e6..af291682e 100644 --- a/reference-app/build.gradle +++ b/reference-app/build.gradle @@ -230,7 +230,7 @@ dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' def powerMockVersion = '2.0.7' implementation project(":opensrp-anc") - implementation('org.smartregister:opensrp-client-native-form:2.1.18-PREVIEW-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-native-form:2.1.19-PREVIEW-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'recyclerview-v7' exclude group: 'com.android.support', module: 'appcompat-v7' @@ -258,7 +258,7 @@ dependencies { exclude group: 'org.smartregister', module: 'android-p2p-sync' } - api("org.smartregister:android-p2p-sync:0.3.8-aplha4-SNAPSHOT") { + api("org.smartregister:android-p2p-sync:0.3.9-SNAPSHOT") { transitive = true exclude group: 'org.smartregister', module: 'opensrp-client-core' exclude group: 'com.android.support', module: 'appcompat-v7' diff --git a/reference-app/src/main/java/org/smartregister/anc/application/AncApplication.java b/reference-app/src/main/java/org/smartregister/anc/application/AncApplication.java index 8bf1ebf73..b63eb5ecf 100644 --- a/reference-app/src/main/java/org/smartregister/anc/application/AncApplication.java +++ b/reference-app/src/main/java/org/smartregister/anc/application/AncApplication.java @@ -25,6 +25,7 @@ import org.smartregister.anc.library.auth.AncCoreAuthorizationService; import org.smartregister.anc.library.sync.BaseAncClientProcessorForJava; import org.smartregister.anc.library.util.DBConstantsUtils; +import org.smartregister.anc.library.util.ANCFailSafeRecalledID; import org.smartregister.anc.library.util.Utils; import org.smartregister.anc.repository.AncRepository; import org.smartregister.commonregistry.CommonFtsObject; @@ -37,8 +38,6 @@ import org.smartregister.view.activity.DrishtiApplication; import org.smartregister.view.receiver.TimeChangedBroadcastReceiver; -import java.io.FileNotFoundException; - import io.fabric.sdk.android.Fabric; import timber.log.Timber; @@ -48,6 +47,47 @@ public class AncApplication extends DrishtiApplication implements TimeChangedBroadcastReceiver.OnTimeChangedListener { private static CommonFtsObject commonFtsObject; + public static CommonFtsObject createCommonFtsObject() { + if (commonFtsObject == null) { + commonFtsObject = new CommonFtsObject(getFtsTables()); + for (String ftsTable : commonFtsObject.getTables()) { + commonFtsObject.updateSearchFields(ftsTable, getFtsSearchFields(ftsTable)); + commonFtsObject.updateSortFields(ftsTable, getFtsSortFields(ftsTable)); + } + } + return commonFtsObject; + } + + private static String[] getFtsTables() { + return new String[]{DBConstantsUtils.DEMOGRAPHIC_TABLE_NAME, DBConstantsUtils.WOMAN_DETAILS_TABLE_NAME}; + } + + private static String[] getFtsSearchFields(String tableName) { + if (tableName.equals(DBConstantsUtils.DEMOGRAPHIC_TABLE_NAME)) { + return new String[]{DBConstantsUtils.KeyUtils.FIRST_NAME, DBConstantsUtils.KeyUtils.LAST_NAME, DBConstantsUtils.KeyUtils.ANC_ID}; + } else if (tableName.equals(DBConstantsUtils.WOMAN_DETAILS_TABLE_NAME)) { + return new String[]{DBConstantsUtils.KeyUtils.NEXT_CONTACT}; + } else { + return null; + } + + } + + private static String[] getFtsSortFields(String tableName) { + if (tableName.equals(DBConstantsUtils.DEMOGRAPHIC_TABLE_NAME)) { + return new String[]{DBConstantsUtils.KeyUtils.BASE_ENTITY_ID, DBConstantsUtils.KeyUtils.FIRST_NAME, DBConstantsUtils.KeyUtils.LAST_NAME, + DBConstantsUtils.KeyUtils.LAST_INTERACTED_WITH, DBConstantsUtils.KeyUtils.DATE_REMOVED}; + } else if (tableName.equals(DBConstantsUtils.WOMAN_DETAILS_TABLE_NAME)) { + return new String[]{DBConstantsUtils.KeyUtils.NEXT_CONTACT}; + } else { + return null; + } + } + + public static synchronized AncApplication getInstance() { + return (AncApplication) DrishtiApplication.mInstance; + } + @Override public void onCreate() { super.onCreate(); @@ -60,6 +100,8 @@ public void onCreate() { //Initialize Modules P2POptions p2POptions = new P2POptions(true); p2POptions.setAuthorizationService(new AncCoreAuthorizationService()); + ANCFailSafeRecalledID recalledID = new ANCFailSafeRecalledID(); + p2POptions.setRecalledIdentifier(recalledID); CoreLibrary.init(context, new AncSyncConfiguration(), BuildConfig.BUILD_TIMESTAMP, p2POptions); AncLibrary.init(context, BuildConfig.DATABASE_VERSION, new ANCEventBusIndex()); ConfigurableViewsLibrary.init(context); @@ -96,43 +138,6 @@ private void setDefaultLanguage() { } } - public static CommonFtsObject createCommonFtsObject() { - if (commonFtsObject == null) { - commonFtsObject = new CommonFtsObject(getFtsTables()); - for (String ftsTable : commonFtsObject.getTables()) { - commonFtsObject.updateSearchFields(ftsTable, getFtsSearchFields(ftsTable)); - commonFtsObject.updateSortFields(ftsTable, getFtsSortFields(ftsTable)); - } - } - return commonFtsObject; - } - - private static String[] getFtsTables() { - return new String[]{DBConstantsUtils.DEMOGRAPHIC_TABLE_NAME, DBConstantsUtils.WOMAN_DETAILS_TABLE_NAME}; - } - - private static String[] getFtsSearchFields(String tableName) { - if (tableName.equals(DBConstantsUtils.DEMOGRAPHIC_TABLE_NAME)) { - return new String[]{DBConstantsUtils.KeyUtils.FIRST_NAME, DBConstantsUtils.KeyUtils.LAST_NAME, DBConstantsUtils.KeyUtils.ANC_ID}; - } else if (tableName.equals(DBConstantsUtils.WOMAN_DETAILS_TABLE_NAME)) { - return new String[]{DBConstantsUtils.KeyUtils.NEXT_CONTACT}; - } else { - return null; - } - - } - - private static String[] getFtsSortFields(String tableName) { - if (tableName.equals(DBConstantsUtils.DEMOGRAPHIC_TABLE_NAME)) { - return new String[]{DBConstantsUtils.KeyUtils.BASE_ENTITY_ID, DBConstantsUtils.KeyUtils.FIRST_NAME, DBConstantsUtils.KeyUtils.LAST_NAME, - DBConstantsUtils.KeyUtils.LAST_INTERACTED_WITH, DBConstantsUtils.KeyUtils.DATE_REMOVED}; - } else if (tableName.equals(DBConstantsUtils.WOMAN_DETAILS_TABLE_NAME)) { - return new String[]{DBConstantsUtils.KeyUtils.NEXT_CONTACT}; - } else { - return null; - } - } - @Override public void logoutCurrentUser() { Intent intent = new Intent(getApplicationContext(), LoginActivity.class); @@ -162,10 +167,6 @@ public Repository getRepository() { return repository; } - public static synchronized AncApplication getInstance() { - return (AncApplication) DrishtiApplication.mInstance; - } - @NonNull @Override public ClientProcessorForJava getClientProcessor() {