diff --git a/build.gradle b/build.gradle index bd2b1c6..c04486d 100644 --- a/build.gradle +++ b/build.gradle @@ -77,9 +77,12 @@ subprojects { ext.androidToolsBuildGradle = '30.0.3' ext.androidBuildToolsVersion = '30.0.3' +// ext.androidMinSdkVersion = 21 +// ext.androidCompileSdkVersion = 31 +// ext.androidTargetSdkVersion = 31 ext.androidMinSdkVersion = 21 - ext.androidCompileSdkVersion = 31 - ext.androidTargetSdkVersion = 31 + ext.androidCompileSdkVersion = 33 + ext.androidTargetSdkVersion = 33 ext.androidAnnotationsVersion = '3.0.1' ext.androidAnnotationsAPIVersion = '3.0.1' ext.jacocoVersion = "0.7.9" diff --git a/opensrp-anc/build.gradle b/opensrp-anc/build.gradle index 7e362d4..74142a1 100644 --- a/opensrp-anc/build.gradle +++ b/opensrp-anc/build.gradle @@ -4,8 +4,9 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' -// classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.3' + // classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:7.0.0' + //classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.3' classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.10.2' classpath 'com.google.gms:google-services:4.3.10' } @@ -179,7 +180,7 @@ tasks.withType(Test) { dependencies { implementation 'androidx.appcompat:appcompat:1.3.1' - implementation('org.smartregister:opensrp-client-native-form:3.1.1-PREVIEW-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-native-form:3.1.2-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'recyclerview-v7' exclude group: 'com.android.support', module: 'appcompat-v7' @@ -190,7 +191,7 @@ dependencies { exclude group: 'org.yaml', module: 'snakeyaml' exclude group: 'io.ona.rdt-capture', module: 'lib' } - implementation('org.smartregister:opensrp-client-core:6.0.0-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-core:6.1.2-SNAPSHOT@aar') { transitive = true exclude group: 'com.github.bmelnychuk', module: 'atv' exclude group: 'com.google.guava', module: 'guava' diff --git a/opensrp-anc/src/main/assets/json.form/anc_counselling_treatment.json b/opensrp-anc/src/main/assets/json.form/anc_counselling_treatment.json index addef67..ad3977f 100644 --- a/opensrp-anc/src/main/assets/json.form/anc_counselling_treatment.json +++ b/opensrp-anc/src/main/assets/json.form/anc_counselling_treatment.json @@ -6484,6 +6484,26 @@ "err": "{{anc_counselling_treatment.step12.prevention_measures.v_required.err}}" } }, + { + "key": "total_treatment_received", + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_entity_id": "", + "type": "edit_text", + "hint": "{{anc_counselling_treatment.step12.total_treatment_received.hint}}", + "edit_type": "name", + "relevance": { + "step12:prevention_measures": { + "ex-checkbox": [ + { + "or": [ + "iron_and_foric_acid" + ] + } + ] + } + } + }, { "key": "prevention_measures_other", "openmrs_entity_parent": "", @@ -6655,11 +6675,24 @@ "hint": "{{anc_counselling_treatment.step12.next_visit_date.hint}}", "expanded": "false", "max_date": "today+280d", - "min_date": "today", + "v_required": { "value": true, "err": "{{anc_counselling_treatment.step12.next_visit_date.v_required.err}}" } + },{ + "key": "lst_visit_date", + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_entity_id": "", + "type": "date_picker", + "hint": "Date of Contact", + "expanded": "false", + "max_date": "today", + "v_required": { + "value": true, + "err": "Date of contact required" + } }, { "key": "prep_toaster", diff --git a/opensrp-anc/src/main/assets/json.form/anc_profile.json b/opensrp-anc/src/main/assets/json.form/anc_profile.json index 2d809ea..4d3f49c 100644 --- a/opensrp-anc/src/main/assets/json.form/anc_profile.json +++ b/opensrp-anc/src/main/assets/json.form/anc_profile.json @@ -549,7 +549,7 @@ "specify_info": "{{anc_profile.step2.lmp_known.options.yes.specify_info}}", "specify_widget": "date_picker", "max_date": "today-14d", - "min_date": "today-280d", + "default": "today" }, { @@ -642,7 +642,7 @@ "specify_info": "{{anc_profile.step2.ultrasound_done.options.yes.specify_info}}", "specify_widget": "date_picker", "max_date": "today", - "min_date": "today-9m", + "default": "today" }, { @@ -780,7 +780,7 @@ "openmrs_entity_id": "", "type": "date_picker", "expanded": "false", - "min_date": "today", + "max_date": "today+10m", "hint": "{{anc_profile.step2.edd_from_ultrasound.hint}}", "relevance": { diff --git a/opensrp-anc/src/main/assets/json.form/anc_register.json b/opensrp-anc/src/main/assets/json.form/anc_register.json index 448c122..f4e50fc 100644 --- a/opensrp-anc/src/main/assets/json.form/anc_register.json +++ b/opensrp-anc/src/main/assets/json.form/anc_register.json @@ -286,7 +286,7 @@ "duration": { "label": "{{anc_register.step1.dob_entered.duration.label}}" }, - "min_date": "today-49y", + "min_date": "today-60y", "max_date": "today-10y", "v_required": { "value": "true", @@ -393,7 +393,7 @@ "openmrs_entity": "", "openmrs_entity_id": "", "openmrs_data_type": "select one", - "type": "spinner", + "type": "hidden", "hint": "{{anc_register.step1.ubudehe_category.hint}}", "values": [ "1", @@ -588,7 +588,7 @@ "openmrs_entity_parent": "", "openmrs_entity": "concept", "openmrs_entity_id": "163164AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "type": "native_radio", + "type": "hidden", "label": "{{anc_register.step1.reminders.label}}", "label_info_text": "{{anc_register.step1.reminders.label_info_text}}", "label_text_style": "normal", diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_glucose_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_glucose_sub_form.json index 93458b7..dbc5b81 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_glucose_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_glucose_sub_form.json @@ -153,7 +153,7 @@ "hint": "{{tests_blood_glucose_sub_form.step1.glucose_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_haemoglobin_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_haemoglobin_sub_form.json index 1af5cc6..f48d4a8 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_haemoglobin_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_haemoglobin_sub_form.json @@ -150,7 +150,7 @@ "hint": "{{tests_blood_haemoglobin_sub_form.step1.hb_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { @@ -247,14 +247,7 @@ "type": "edit_text", "hint": "{{tests_blood_haemoglobin_sub_form.step1.cbc.hint}}", "edit_type": "number", - "v_min": { - "value": "0", - "err": "{{tests_blood_haemoglobin_sub_form.step1.cbc.v_min.err}}" - }, - "v_max": { - "value": "25", - "err": "{{tests_blood_haemoglobin_sub_form.step1.cbc.v_max.err}}" - }, + "v_numeric": { "value": "true", "err": "{{tests_blood_haemoglobin_sub_form.step1.cbc.v_numeric.err}}" @@ -283,14 +276,7 @@ "value": "0", "err": "{{tests_blood_haemoglobin_sub_form.step1.hb_gmeter.v_min.err}}" }, - "v_max": { - "value": "25", - "err": "{{tests_blood_haemoglobin_sub_form.step1.hb_gmeter.v_max.err}}" - }, - "v_numeric": { - "value": "true", - "err": "{{tests_blood_haemoglobin_sub_form.step1.hb_gmeter.v_numeric.err}}" - }, + "v_required": { "value": true, "err": "{{tests_blood_haemoglobin_sub_form.step1.hb_gmeter.v_required.err}}" @@ -311,14 +297,7 @@ "type": "edit_text", "hint": "{{tests_blood_haemoglobin_sub_form.step1.hb_colour.hint}}", "edit_type": "number", - "v_min": { - "value": "0", - "err": "{{tests_blood_haemoglobin_sub_form.step1.hb_colour.v_min.err}}" - }, - "v_max": { - "value": "25", - "err": "{{tests_blood_haemoglobin_sub_form.step1.hb_colour.v_max.err}}" - }, + "v_numeric": { "value": "true", "err": "{{tests_blood_haemoglobin_sub_form.step1.hb_colour.v_numeric.err}}" @@ -364,24 +343,7 @@ } } }, - { - "key": "anaemia_diagnosis_danger_toaster", - "openmrs_entity_parent": "", - "openmrs_entity": "", - "openmrs_entity_id": "", - "type": "toaster_notes", - "text": "{{tests_blood_haemoglobin_sub_form.step1.anaemia_diagnosis_danger_toaster.text}}", - "toaster_info_text": "{{tests_blood_haemoglobin_sub_form.step1.anaemia_diagnosis_danger_toaster.toaster_info_text}}", - "toaster_info_title": "{{tests_blood_haemoglobin_sub_form.step1.anaemia_diagnosis_danger_toaster.toaster_info_title}}", - "toaster_type": "problem", - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "tests_relevance_rules.yml" - } - } - } - }, + { "key": "ht", "openmrs_entity_parent": "", @@ -406,24 +368,7 @@ } } }, - { - "key": "hematocrit_danger_toaster", - "openmrs_entity_parent": "", - "openmrs_entity": "", - "openmrs_entity_id": "", - "type": "toaster_notes", - "text": "{{tests_blood_haemoglobin_sub_form.step1.hematocrit_danger_toaster.text}}", - "toaster_info_text": "{{tests_blood_haemoglobin_sub_form.step1.hematocrit_danger_toaster.toaster_info_text}}", - "toaster_info_title": "{{tests_blood_haemoglobin_sub_form.step1.hematocrit_danger_toaster.toaster_info_title}}", - "toaster_type": "problem", - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "tests_relevance_rules.yml" - } - } - } - }, + { "key": "wbc", "openmrs_entity_parent": "", @@ -449,24 +394,6 @@ } } }, - { - "key": "wbc_danger_toaster", - "openmrs_entity_parent": "", - "openmrs_entity": "", - "openmrs_entity_id": "", - "type": "toaster_notes", - "text": "{{tests_blood_haemoglobin_sub_form.step1.wbc_danger_toaster.text}}", - "toaster_info_text": "{{tests_blood_haemoglobin_sub_form.step1.wbc_danger_toaster.toaster_info_text}}", - "toaster_info_title": "{{tests_blood_haemoglobin_sub_form.step1.wbc_danger_toaster.toaster_info_title}}", - "toaster_type": "problem", - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "tests_relevance_rules.yml" - } - } - } - }, { "key": "platelets", "openmrs_entity_parent": "", @@ -491,24 +418,6 @@ } } } - }, - { - "key": "paltelets_danger_toaster", - "openmrs_entity_parent": "", - "openmrs_entity": "", - "openmrs_entity_id": "", - "type": "toaster_notes", - "text": "{{tests_blood_haemoglobin_sub_form.step1.paltelets_danger_toaster.text}}", - "toaster_info_text": "{{tests_blood_haemoglobin_sub_form.step1.paltelets_danger_toaster.toaster_info_text}}", - "toaster_info_title": "{{tests_blood_haemoglobin_sub_form.step1.paltelets_danger_toaster.toaster_info_title}}", - "toaster_type": "problem", - "relevance": { - "rules-engine": { - "ex-rules": { - "rules-file": "tests_relevance_rules.yml" - } - } - } } ], "count": 1, diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_type_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_type_sub_form.json index 6288ffb..15213db 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_type_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_blood_type_sub_form.json @@ -114,7 +114,7 @@ "hint": "{{tests_blood_type_sub_form.step1.blood_type_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_b_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_b_sub_form.json index ec143c0..b9fccad 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_b_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_b_sub_form.json @@ -115,7 +115,7 @@ "hint": "{{tests_hepatitis_b_sub_form.step1.hepb_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_c_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_c_sub_form.json index d1c03db..388c4d3 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_c_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_hepatitis_c_sub_form.json @@ -173,7 +173,7 @@ "hint": "{{tests_hepatitis_c_sub_form.step1.hepc_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_hiv_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_hiv_sub_form.json index b43f38c..63275fe 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_hiv_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_hiv_sub_form.json @@ -176,7 +176,7 @@ "hint": "{{tests_hiv_sub_form.step1.hiv_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_hiv_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_hiv_sub_form.json index caf94c4..a0bd508 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_hiv_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_hiv_sub_form.json @@ -113,7 +113,7 @@ "hint": "{{tests_partner_hiv_sub_form.step1.hiv_test_partner_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_rpr_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_rpr_sub_form.json index bdb7266..8620c71 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_rpr_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_partner_rpr_sub_form.json @@ -175,7 +175,7 @@ "hint": "{{tests_partner_rpr_sub_form.step1.partner_rpr_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_syphilis_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_syphilis_sub_form.json index 5ed7906..55c2b51 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_syphilis_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_syphilis_sub_form.json @@ -104,7 +104,7 @@ "hint": "{{tests_syphilis_sub_form.step1.syph_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_tb_screening_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_tb_screening_sub_form.json index d5a40d1..17727e1 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_tb_screening_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_tb_screening_sub_form.json @@ -155,7 +155,7 @@ "hint": "{{tests_tb_screening_sub_form.step1.tb_screening_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_ultrasound_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_ultrasound_sub_form.json index 62ab6d7..9d43651 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_ultrasound_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_ultrasound_sub_form.json @@ -106,7 +106,7 @@ "hint": "{{tests_ultrasound_sub_form.step1.ultrasound_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { @@ -164,7 +164,7 @@ "hint": "{{tests_ultrasound_sub_form.step1.ultrasound_date.hint}}", "expanded": "false", "max_date": "today", - "min_date": "today-9m", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/json.form/sub_form/tests_urine_sub_form.json b/opensrp-anc/src/main/assets/json.form/sub_form/tests_urine_sub_form.json index 3103ae4..52e4d41 100644 --- a/opensrp-anc/src/main/assets/json.form/sub_form/tests_urine_sub_form.json +++ b/opensrp-anc/src/main/assets/json.form/sub_form/tests_urine_sub_form.json @@ -131,7 +131,7 @@ "hint": "{{tests_urine_sub_form.step1.urine_test_scheduled_date.hint}}", "expanded": "false", "max_date": "today+10m", - "min_date": "today", + "relevance": { "rules-engine": { "ex-rules": { diff --git a/opensrp-anc/src/main/assets/rule/profile_relevance_rules.yml b/opensrp-anc/src/main/assets/rule/profile_relevance_rules.yml index 765c9c2..90f17c3 100644 --- a/opensrp-anc/src/main/assets/rule/profile_relevance_rules.yml +++ b/opensrp-anc/src/main/assets/rule/profile_relevance_rules.yml @@ -65,28 +65,28 @@ actions: name: step3_miscarriages_abortions_label description: Miscarrige abortions label priority: 1 -condition: "step3_previous_pregnancies > 0 " +condition: "(step3_gravida - 1) > 0 " actions: - "isRelevant = true" --- name: step3_miscarriages_abortions description: Miscarrige abortions priority: 1 -condition: "step3_previous_pregnancies > 0 " +condition: "(step3_gravida - 1) > 0 " actions: - "isRelevant = true" --- name: step3_live_births_label description: Live births label priority: 1 -condition: "((step3_previous_pregnancies - step3_miscarriages_abortions) > 0)" +condition: "(((step3_gravida - 1) - step3_miscarriages_abortions) > 0)" actions: - "isRelevant = true" --- name: step3_live_births description: Live births priority: 1 -condition: "((step3_previous_pregnancies - step3_miscarriages_abortions) > 0)" +condition: "(((step3_gravida - 1) - step3_miscarriages_abortions) > 0)" actions: - "isRelevant = true" --- @@ -100,7 +100,7 @@ actions: name: step3_stillbirths_label description: Still births label priority: 1 -condition: "((step3_previous_pregnancies - step3_miscarriages_abortions - step3_live_births) > 0)" +condition: "(((step3_gravida - 1 ) - step3_miscarriages_abortions - step3_live_births) > 0)" actions: - "isRelevant = true" --- @@ -114,28 +114,28 @@ actions: name: step3_stillbirths description: Slill births priority: 1 -condition: "((step3_previous_pregnancies - step3_miscarriages_abortions - step3_live_births) > 0) " +condition: "(((step3_gravida - 1 ) - step3_miscarriages_abortions - step3_live_births) > 0) " actions: - "isRelevant = true" --- name: step3_prev_preg_comps description: Previous pregnancy complications priority: 1 -condition: "step3_previous_pregnancies > 0 " +condition: "(step3_gravida - 1 ) > 0 " actions: - "isRelevant = true" --- name: step3_c_sections_label description: C-sections label priority: 1 -condition: "step3_parity > 0 " +condition: "(step3_live_births + ((step3_gravida - 1) - step3_miscarriages_abortions- step3_live_births ) ) > 0 " actions: - "isRelevant = true" --- name: step3_c_sections description: C-sections label priority: 1 -condition: "step3_parity > 0 " +condition: "(step3_live_births + ((step3_gravida - 1) - step3_miscarriages_abortions- step3_live_births ) ) > 0 " actions: - "isRelevant = true" --- @@ -191,14 +191,14 @@ actions: name: step3_date_last_born description: Date of Birth for last born priority: 1 -condition: "((step3_previous_pregnancies - step3_miscarriages_abortions) > 0)" +condition: "(((step3_gravida - 1 ) - step3_miscarriages_abortions) > 0)" actions: - "isRelevant = true" --- name: step3_last_born_status description: Last born status priority: 1 -condition: "(step3_children_live > 0)" +condition: "(step3_children_live > 0 && step3_children_live < step3_live_births)" actions: - "isRelevant = true" --- @@ -366,7 +366,7 @@ actions: name: step3_multiple_pregnancy description: multiple_pregnancy priority: 1 -condition: "step3_previous_pregnancies > 0 " +condition: "(step3_gravida - 1 ) > 0 " actions: - "isRelevant = true" --- diff --git a/opensrp-anc/src/main/java/org/smartregister/anc/library/activity/UkudoxActivity.java b/opensrp-anc/src/main/java/org/smartregister/anc/library/activity/UkudoxActivity.java index 4fc5ec3..30f4236 100644 --- a/opensrp-anc/src/main/java/org/smartregister/anc/library/activity/UkudoxActivity.java +++ b/opensrp-anc/src/main/java/org/smartregister/anc/library/activity/UkudoxActivity.java @@ -134,7 +134,8 @@ private List getHomeContent(){ expected_deliveries.setEndDate(dateButton2.getText().toString()); expected_deliveries.setStartDate(dateButton.getText().toString()); - expected_deliveries.setNumber((int) DashboardRepository.getExpectedDeliveries(dateButton.getText().toString(),dateButton2.getText().toString())); + expected_deliveries.setNumber(0); + // expected_deliveries.setNumber((int) DashboardRepository.getExpectedDeliveries(dateButton.getText().toString(),dateButton2.getText().toString())); expected_deliveries.setBackground(getResources().getColor(R.color.vaccine_blue_bg_stk)); homeItems.add(expected_deliveries); diff --git a/opensrp-anc/src/main/java/org/smartregister/anc/library/repository/PatientRepository.java b/opensrp-anc/src/main/java/org/smartregister/anc/library/repository/PatientRepository.java index 15dd3c1..596d0ad 100644 --- a/opensrp-anc/src/main/java/org/smartregister/anc/library/repository/PatientRepository.java +++ b/opensrp-anc/src/main/java/org/smartregister/anc/library/repository/PatientRepository.java @@ -192,5 +192,16 @@ public static void updateContactVisitStartDate(String baseEntityId, String conta } updatePatient(baseEntityId, contentValues, getRegisterQueryProvider().getDetailsTable()); } + public static void updateLastContactDate(String baseEntityId, String edd) { + ContentValues contentValues = new ContentValues(); + if (edd != null) { + contentValues.put(DBConstantsUtils.KeyUtils.LAST_CONTACT_RECORD_DATE, edd); +// contentValues.put(DBConstantsUtils.KeyUtils.CONTACT_STATUS, patientDetail.getPreviousContactStatus()) + } +// else { +// contentValues.putNull(DBConstantsUtils.KeyUtils.EDD); +// } + updatePatient(baseEntityId, contentValues, getRegisterQueryProvider().getDetailsTable()); + } } diff --git a/opensrp-anc/src/main/java/org/smartregister/anc/library/task/LoadContactSummaryDataTask.java b/opensrp-anc/src/main/java/org/smartregister/anc/library/task/LoadContactSummaryDataTask.java index 75e1920..52702e5 100644 --- a/opensrp-anc/src/main/java/org/smartregister/anc/library/task/LoadContactSummaryDataTask.java +++ b/opensrp-anc/src/main/java/org/smartregister/anc/library/task/LoadContactSummaryDataTask.java @@ -18,6 +18,9 @@ import org.smartregister.anc.library.util.DBConstantsUtils; import org.smartregister.anc.library.util.Utils; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.HashMap; import timber.log.Timber; @@ -75,7 +78,21 @@ protected void onPostExecute(Void result) { } else if (edd == null && contactNo.contains("-")) { ((ContactSummaryFinishActivity) context).saveFinishMenuItem.setEnabled(true); } + //hardcoing next visit + String lstVisitDate=facts.get("lst_visit_date"); + SimpleDateFormat inputFormat = new SimpleDateFormat("dd-MM-yyyy"); + Date date = null; + try { + date = inputFormat.parse(lstVisitDate); + } catch (ParseException e) { + throw new RuntimeException(e); + } + String formattedDate = Utils.DB_DF.format(date); + if (formattedDate != null && ((ContactSummaryFinishActivity) context).saveFinishMenuItem != null) { + PatientRepository.updateLastContactDate(baseEntityId, formattedDate); + ((ContactSummaryFinishActivity) context).saveFinishMenuItem.setEnabled(true); + } ContactSummaryFinishAdapter adapter = new ContactSummaryFinishAdapter(context, ((ContactSummaryFinishActivity) context).getYamlConfigList(), facts); adapter.notifyDataSetChanged(); diff --git a/opensrp-anc/src/main/res/values/strings.xml b/opensrp-anc/src/main/res/values/strings.xml index 05725c8..45981dd 100644 --- a/opensrp-anc/src/main/res/values/strings.xml +++ b/opensrp-anc/src/main/res/values/strings.xml @@ -113,7 +113,8 @@ Sync data Close navigation drawer Open navigation drawer - Antenatal Care \n Module + + MAMAI ANC DIGITAL \n MODULE ID: %1$s Age: %1$s GA: %1$d weeks diff --git a/opensrp-anc/src/main/resources/anc_counselling_treatment.properties b/opensrp-anc/src/main/resources/anc_counselling_treatment.properties index ff3312f..2d73d90 100644 --- a/opensrp-anc/src/main/resources/anc_counselling_treatment.properties +++ b/opensrp-anc/src/main/resources/anc_counselling_treatment.properties @@ -705,4 +705,6 @@ anc_counselling_treatment.step12.hepatite_b_treatment.hint = Hepatite b treatmen anc_counselling_treatment.step12.syphilis_treatment_toaster.text = Woman syphilis tests indicate a positive result. she needs treatment. anc_counselling_treatment.step12.infection_urinaire_toaster.text =Woman urine tests indicate a Urinary tract infection result. she needs treatment. anc_counselling_treatment.step12.hepatite_b_treatment_toaster.text = Woman hepatitis b tests indicate a positive result. she needs treatment. -anc_counselling_treatment.step12.hepatite_c_treatment_toaster.text = Woman hepatitis c tests indicate a positive result. she needs treatment. \ No newline at end of file +anc_counselling_treatment.step12.hepatite_c_treatment_toaster.text = Woman hepatitis c tests indicate a positive result. she needs treatment. +anc_counselling_treatment.step12.total_treatment_received.hint = How many treatments has she received? +anc_counselling_treatment.step12.total_treatment_received.v_required.err = This field is required \ No newline at end of file diff --git a/opensrp-anc/src/main/resources/anc_counselling_treatment_fr.properties b/opensrp-anc/src/main/resources/anc_counselling_treatment_fr.properties index 523cdbd..5305101 100644 --- a/opensrp-anc/src/main/resources/anc_counselling_treatment_fr.properties +++ b/opensrp-anc/src/main/resources/anc_counselling_treatment_fr.properties @@ -705,4 +705,6 @@ anc_counselling_treatment.step12.hepatite_b_treatment.hint=Traitement de l'hépa anc_counselling_treatment.step12.syphilis_treatment_toaster.text=Les examens de syphilis chez la femme indiquent un résultat positif. elle a besoin d'un traitement. anc_counselling_treatment.step12.infection_urinaire_toaster.text=Les examen d'urine de femme indiquent un résultat d'infection des voies urinaires. elle a besoin d'un traitement anc_counselling_treatment.step12.hepatite_b_treatment_toaster.text=Les examen d'hépatite b chez la femme indiquent un résultat positif. elle a besoin d'un traitement. -anc_counselling_treatment.step12.hepatite_c_treatment_toaster.text=Les examen d'hépatite c chez la femme indiquent un résultat positif. elle a besoin d'un traitement. \ No newline at end of file +anc_counselling_treatment.step12.hepatite_c_treatment_toaster.text=Les examen d'hépatite c chez la femme indiquent un résultat positif. elle a besoin d'un traitement. +anc_counselling_treatment.step12.total_treatment_received.hint = How many treatments has she received? +anc_counselling_treatment.step12.total_treatment_received.v_required.err = This field is required \ No newline at end of file diff --git a/opensrp-anc/src/main/resources/anc_test.properties b/opensrp-anc/src/main/resources/anc_test.properties index 79c913d..3d4fc35 100644 --- a/opensrp-anc/src/main/resources/anc_test.properties +++ b/opensrp-anc/src/main/resources/anc_test.properties @@ -23,7 +23,7 @@ anc_test.step2.accordion_partner_hiv.text = Partner HIV test anc_test.step1.accordion_syphilis.text = Syphilis test anc_test.step1.accordion_blood_haemoglobin.text = Blood Haemoglobin test anc_test.step2.accordion_hepatitis_c.accordion_info_text = In settings where the proportion of HCV antibody seroprevalence in the general population is 2% or higher, or the woman is HIV positive, injects drugs, or is a sex worker, then a Hep C test is required. -anc_test.step1.accordion_ultrasound.text = Ultrasound test +anc_test.step1.accordion_ultrasound.text = Ultrasound Scan anc_test.step1.accordion_hepatitis_c.accordion_info_text = In settings where the proportion of HCV antibody seroprevalence in the general population is 2% or higher, or the woman is HIV positive, injects drugs, or is a sex worker, then a Hep C test is required. anc_test.step1.title = Due anc_test.step2.accordion_hepatitis_c.text = Hepatitis C test diff --git a/reference-app/build.gradle b/reference-app/build.gradle index 82add90..b14ebda 100644 --- a/reference-app/build.gradle +++ b/reference-app/build.gradle @@ -4,7 +4,8 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + //classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:7.0.0' classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.3' classpath 'com.google.gms:google-services:4.3.9' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' @@ -234,7 +235,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:3.1.1-PREVIEW-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-native-form:3.1.2-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'recyclerview-v7' exclude group: 'com.android.support', module: 'appcompat-v7' @@ -246,7 +247,7 @@ dependencies { exclude group: 'io.ona.rdt-capture', module: 'lib' } - implementation('org.smartregister:opensrp-client-core:6.0.0-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-core:6.1.2-SNAPSHOT@aar') { transitive = true exclude group: 'com.github.bmelnychuk', module: 'atv' exclude group: 'com.google.guava', module: 'guava' diff --git a/reference-app/debug/output-metadata.json b/reference-app/debug/output-metadata.json deleted file mode 100644 index bf91984..0000000 --- a/reference-app/debug/output-metadata.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "version": 2, - "artifactType": { - "type": "APK", - "kind": "Directory" - }, - "applicationId": "org.smartregister.anc", - "variantName": "processDebugResources", - "elements": [ - { - "type": "SINGLE", - "filters": [], - "versionCode": 10610, - "versionName": "1.6.10", - "outputFile": "reference-app-debug.apk" - } - ] -} \ No newline at end of file diff --git a/reference-app/debug/reference-app-debug.apk b/reference-app/debug/reference-app-debug.apk deleted file mode 100644 index 59ee08a..0000000 Binary files a/reference-app/debug/reference-app-debug.apk and /dev/null differ diff --git a/reference-app/src/main/AndroidManifest.xml b/reference-app/src/main/AndroidManifest.xml index 46844fa..6ec0e64 100644 --- a/reference-app/src/main/AndroidManifest.xml +++ b/reference-app/src/main/AndroidManifest.xml @@ -31,7 +31,8 @@ android:name=".activity.LoginActivity" android:screenOrientation="portrait" android:theme="@style/AncAppTheme.Login" - android:windowSoftInputMode="stateAlwaysHidden|adjustResize"> + android:windowSoftInputMode="stateAlwaysHidden|adjustResize" + android:exported="true"> diff --git a/reference-app/src/main/java/org/smartregister/anc/activity/LoginActivity.java b/reference-app/src/main/java/org/smartregister/anc/activity/LoginActivity.java index 07b4648..c734fe5 100644 --- a/reference-app/src/main/java/org/smartregister/anc/activity/LoginActivity.java +++ b/reference-app/src/main/java/org/smartregister/anc/activity/LoginActivity.java @@ -1,9 +1,15 @@ package org.smartregister.anc.activity; +import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.os.Bundle; +import android.util.Log; import android.view.View; +import android.widget.Button; +import android.widget.EditText; import android.widget.TextView; +import android.widget.Toast; import org.apache.commons.lang3.StringUtils; import org.greenrobot.eventbus.Subscribe; @@ -16,17 +22,22 @@ import org.smartregister.anc.library.util.ConstantsUtils; import org.smartregister.anc.library.util.Utils; import org.smartregister.anc.presenter.LoginPresenter; +import org.smartregister.repository.dao.LocationDaoImpl; +import org.smartregister.security.SecurityHelper; import org.smartregister.task.SaveTeamLocationsTask; import org.smartregister.view.activity.BaseLoginActivity; import org.smartregister.view.contract.BaseLoginContract; +import java.util.Locale; + import timber.log.Timber; /** * Created by ndegwamartin on 21/06/2018. */ public class LoginActivity extends BaseLoginActivity implements BaseLoginContract.View { - + EditText usernameField,passwordField; + Button loginBtn; @Override protected void onResume() { super.onResume(); @@ -40,15 +51,39 @@ protected void onResume() { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpViews(); + } +// +// @Override +// protected void onStart() { +// super.onStart(); +// if(!getUsername().equals("")){ +// loginBtn.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// if(validateCredentials(usernameField.getText().toString(),passwordField.getText().toString()) ){ +// Log.d("CLICKED","MY BUTTON"); +// gotToHomeRegister(false); +// +// } +// } +// }); +// }else{ +// Log.d("UKUDOX","NOT FROM LOCAL 11"); +//// } +// } private void setUpViews() { TextView formReleaseTextView = findViewById(R.id.manifest_text_view); + usernameField= findViewById(R.id.login_user_name_edit_text); + passwordField= findViewById(R.id.login_password_edit_text); + loginBtn= findViewById(R.id.login_login_btn); if (StringUtils.isNotBlank(new Utils().getManifestVersion(this))) { formReleaseTextView.setText(new Utils().getManifestVersion(this)); } else { formReleaseTextView.setVisibility(View.GONE); } + } @Override @@ -58,8 +93,8 @@ protected int getContentView() { @Override protected void initializePresenter() { - mLoginPresenter = new LoginPresenter(this); - } + mLoginPresenter = new LoginPresenter(this); + } @Override public void goToHome(boolean remote) { @@ -67,8 +102,9 @@ public void goToHome(boolean remote) { // Utils.startAsyncTask(new SaveTeamLocationsTask(), null); new SaveTeamLocationsTask().execute(); } - - if (mLoginPresenter.isServerSettingsSet()) { + if (mLoginPresenter.isServerSettingsSet()) { + Log.d("UKUDOX","FROM REMOTE"); + setCredentials(usernameField.getText().toString(),passwordField.getText().toString()); gotToHomeRegister(remote); } else { goToSiteCharacteristics(remote); @@ -78,7 +114,7 @@ public void goToHome(boolean remote) { } private void gotToHomeRegister(boolean remote) { -// Intent intent = new Intent(this, BaseHomeRegisterActivity.class); + //Intent intent = new Intent(this, BaseHomeRegisterActivity.class); //ukudox stuff Intent intent = new Intent(this, UkudoxActivity.class); intent.putExtra(ConstantsUtils.IntentKeyUtils.IS_REMOTE_LOGIN, remote); @@ -99,4 +135,34 @@ public void refreshViews(ViewConfigurationSyncCompleteEvent syncCompleteEvent) { } } + public void setCredentials(String username,String password){ + SharedPreferences sharedPreferences=getSharedPreferences("credentials", Context.MODE_PRIVATE); + SharedPreferences.Editor editor=sharedPreferences.edit(); + editor.putString("username",username); + editor.putString("password",password); + editor.commit(); + } + public boolean validateCredentials(String newUsername,String newPassword){ + SharedPreferences sharedPreferences=getSharedPreferences("credentials",Context.MODE_PRIVATE); + String username=""; + String password=""; + if(sharedPreferences.contains("username")&&(sharedPreferences.contains("password"))){ + username=sharedPreferences.getString("username",""); + password=sharedPreferences.getString("password",""); + Log.d("CRED",username+" "+password); + }else{ + Log.d("CRED","Nothing saved "+username+" PASS "+password); + } + return newUsername.equals(username)&&newPassword.equals(password); + } + public String getUsername(){ + SharedPreferences sharedPreferences=getSharedPreferences("credentials",Context.MODE_PRIVATE); + String username=""; + if(sharedPreferences.contains("username")){ + username=sharedPreferences.getString("username",""); + }else{ + Log.d("USERNAME","Nothing saved "+username); + } + return username; + } } \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 293a6ee..b0816ad 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 31 - + //compileSdkVersion 31 + compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -11,7 +11,8 @@ android { defaultConfig { applicationId "org.smartregister.sample.anc" minSdkVersion 25 - targetSdkVersion 31 + //targetSdkVersion 31 + targetSdkVersion 33 versionCode 1 versionName "1.0"