diff --git a/opensrp-chw-hf/src/main/assets/ec_client_classification.json b/opensrp-chw-hf/src/main/assets/ec_client_classification.json index 0f9470f9a..415c05a6f 100644 --- a/opensrp-chw-hf/src/main/assets/ec_client_classification.json +++ b/opensrp-chw-hf/src/main/assets/ec_client_classification.json @@ -185,6 +185,20 @@ "creates_case": [ "ec_pnc_referral" ] + }, + { + "field": "eventType", + "field_value": "Sick Child Follow-up", + "creates_case": [ + "ec_sick_child_followup" + ] + }, + { + "field": "eventType", + "field_value": "ANC Danger Signs Outcome", + "creates_case": [ + "ec_anc_danger_signs_outcome" + ] } ] } diff --git a/opensrp-chw-hf/src/main/assets/ec_client_fields.json b/opensrp-chw-hf/src/main/assets/ec_client_fields.json index 80fa56088..c4298ee74 100644 --- a/opensrp-chw-hf/src/main/assets/ec_client_fields.json +++ b/opensrp-chw-hf/src/main/assets/ec_client_fields.json @@ -1712,6 +1712,235 @@ } } ] + }, + { + "name": "ec_sick_child_followup", + "columns": [ + { + "column_name": "base_entity_id", + "type": "Event", + "json_mapping": { + "field": "baseEntityId" + } + }, + { + "column_name": "visit_date", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "date_sickchild" + } + }, + { + "column_name": "weight", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "height", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "has_diarrhea", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "142412AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "diarrhea_duration", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "5984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "dehydration_status", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "1497AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "other_symptoms", + "type": "Event", + "save_format": "json_array", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "other_sympt_sick_child" + } + }, + { + "column_name": "test_ordered", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "1271AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "other_test_ordered", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "test_results", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "161577AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "diagnosis", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "161602AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "diarrhea_treatment", + "type": "Event", + "save_format": "json_array", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "diarrhea_treat" + } + }, + { + "column_name": "amount_of_ors", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "diarrhea_treat_ors" + } + }, + { + "column_name": "amount_rehydration_infusion", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "diarrhea_treat_rehydration" + } + }, + { + "column_name": "amount_zinc", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "diarrhea_treat_zinc" + } + }, + { + "column_name": "drugs_taken_home", + "type": "Event", + "save_format": "json_array", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "diarrhea_treat_walkaway" + } + }, + { + "column_name": "non_diarrhea_treatment", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "dtc_period", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "1785AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "results", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "160433AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + } + ] + }, + { + "name": "ec_anc_danger_signs_outcome", + "columns": [ + { + "column_name": "base_entity_id", + "type": "Event", + "json_mapping": { + "field": "baseEntityId" + } + }, + { + "column_name": "visit_date", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "anc_danger_signs_visitdate" + } + }, + { + "column_name": "danger_signs_present", + "type": "Event", + "save_format": "json_array", + "json_mapping": { + "field": "obs.fieldCode", + "formSubmissionField": "danger_signs_present" + } + }, + { + "column_name": "other_danger_signs", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + } + }, + { + "column_name": "action_taken", + "type": "Event", + "save_format": "json_array", + "json_mapping": { + "field": "obs.fieldCode", + "formSubmissionField": "action_taken_anc_danger_signs" + } + }, + { + "column_name": "managed_signs", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "managed_signs" + } + }, + { + "column_name": "comment", + "type": "Event", + "json_mapping": { + "field": "obs.fieldCode", + "concept": "comment_anc_danger_signs" + } + } + ] } ] } \ No newline at end of file diff --git a/opensrp-chw-hf/src/main/assets/json.form/anc_danger_signs_outcome.json b/opensrp-chw-hf/src/main/assets/json.form/anc_danger_signs_outcome.json new file mode 100644 index 000000000..a70238b8b --- /dev/null +++ b/opensrp-chw-hf/src/main/assets/json.form/anc_danger_signs_outcome.json @@ -0,0 +1,288 @@ +{ + "validate_on_submit": true, + "show_errors_on_submit": false, + "count": "1", + "encounter_type": "ANC Danger Signs Outcome", + "entity_id": "", + "relational_id": "", + "metadata": { + "start": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "start", + "openmrs_entity_id": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "end": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "end", + "openmrs_entity_id": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "today": { + "openmrs_entity_parent": "", + "openmrs_entity": "encounter", + "openmrs_entity_id": "encounter_date" + }, + "deviceid": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "deviceid", + "openmrs_entity_id": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "subscriberid": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "subscriberid", + "openmrs_entity_id": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "simserial": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "simserial", + "openmrs_entity_id": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "phonenumber": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "phonenumber", + "openmrs_entity_id": "163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "encounter_location": "", + "look_up": { + "entity_id": "", + "value": "" + } + }, + "step1": { + "title": "ANC danger signs", + "fields": [ + { + "key": "anc_danger_signs_visitdate", + "openmrs_entity": "concept", + "openmrs_entity_id": "anc_danger_signs_visitdate", + "openmrs_entity_parent": "", + "type": "hidden", + "calculation": { + "rules-engine": { + "ex-rules": { + "rules-file": "anc_danger_signs_outcome_calculation.yml" + } + } + } + }, + { + "key": "lmp", + "openmrs_entity": "", + "openmrs_entity_id": "lmp", + "openmrs_entity_parent": "", + "type": "hidden" + }, + { + "key": "gest_age", + "openmrs_entity": "", + "openmrs_entity_id": "gest_age", + "openmrs_entity_parent": "", + "type": "hidden" + }, + { + "key": "edd", + "openmrs_entity": "", + "openmrs_entity_id": "edd", + "openmrs_entity_parent": "", + "type": "hidden" + }, + { + "key": "anc_key_info", + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_entity_id": "anc_key_info", + "type": "toaster_notes", + "text": "Key information for health facility:\nLast menstrual period: (LNMP)\nGestational age: {gest_age}\nEDD: {edd}", + "toaster_type": "info", + "calculation": { + "rules-engine": { + "ex-rules": { + "rules-file": "anc_danger_signs_outcome_calculation.yml" + } + } + } + }, + { + "key": "danger_signs_present", + "type": "check_box", + "openmrs_entity": "concept", + "openmrs_entity_id": "160939AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "What dangers sign did the woman have?", + "combine_checkbox_option_values": "true", + "options": [ + { + "key": "Fever", + "openmrs_choice_id": "140238AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Fever", + "value": false + }, + { + "key": "Bleeding_vaginally", + "openmrs_choice_id": "150802AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Bleeding vaginally", + "value": false + }, + { + "key": "Severe_headache", + "openmrs_choice_id": "139081AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Severe headache", + "value": false + }, + { + "key": "Convulsions", + "openmrs_choice_id": "164483AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Convulsions", + "value": false + }, + { + "key": "Difficulty_breathing", + "openmrs_choice_id": "142373AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Difficulty breathing", + "value": false + }, + { + "key": "Severe_abdominal_pain", + "openmrs_choice_id": "165271AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Severe abdominal pain", + "value": false + }, + { + "key": "Swelling_of_the_face_and/or_hands", + "openmrs_choice_id": "460AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Swelling of the face and/or hands", + "value": false + }, + { + "key": "Discoloured_or_watery_liquid_vaginal_discharge_with_a_bad_smell", + "openmrs_choice_id": "123395AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Discoloured or watery, liquid vaginal discharge with a bad smell", + "value": false + }, + { + "key": "No_movement_unusual_movement_for_a_child_in_the_womb", + "openmrs_choice_id": "113377AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "No movement / unusual movement for a child in the womb", + "value": false + }, + { + "key": "Other", + "openmrs_choice_id": "5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Other", + "value": false + } + ], + "v_required": { + "value": "true", + "err": "Please select a danger sign" + } + }, + { + "key": "other_anc_danger_signs", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "name", + "hint": "Other danger sign", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "anc_danger_signs_outcome_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please enter other danger sign" + } + }, + { + "key": "action_taken_anc_danger_signs", + "type": "check_box", + "openmrs_entity": "concept", + "openmrs_entity_id": "164378AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Action taken by health facility", + "combine_checkbox_option_values": "true", + "exclusive": [ + "No_action_taken" + ], + "options": [ + { + "key": "No_action_taken", + "openmrs_choice_id": "1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "No action taken", + "value": false + }, + { + "key": "Managed", + "openmrs_choice_id": "1692AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Managed", + "value": false + }, + { + "key": "Referred", + "openmrs_choice_id": "1648AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Referred", + "value": false + }, + { + "key": "Discharged", + "openmrs_choice_id": "1654AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Discharged", + "value": false + }, + { + "key": "Died", + "openmrs_choice_id": "159AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Died", + "value": false + } + ], + "v_required": { + "value": "true", + "err": "Please select action taken" + } + }, + { + "key": "managed_signs", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "managed_signs", + "openmrs_entity_parent": "", + "edit_type": "name", + "hint": "How did the health facility manage the mother's condition?", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "anc_danger_signs_outcome_relevance.yml" + } + } + }, + "v_required": { + "value": "false", + "err": null + } + }, + { + "key": "comment_anc_danger_signs", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "comment_anc_danger_signs", + "openmrs_entity_parent": "", + "edit_type": "name", + "hint": "Remarks/Comments", + "v_required": { + "value": "false", + "err": null + } + } + ] + } +} diff --git a/opensrp-chw-hf/src/main/assets/json.form/child_sick_form.json b/opensrp-chw-hf/src/main/assets/json.form/child_sick_form.json new file mode 100644 index 000000000..685882890 --- /dev/null +++ b/opensrp-chw-hf/src/main/assets/json.form/child_sick_form.json @@ -0,0 +1,579 @@ +{ + "validate_on_submit": true, + "show_errors_on_submit": false, + "count": "1", + "encounter_type": "Sick Child Follow-up", + "entity_id": "", + "relational_id": "", + "metadata": { + "start": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "start", + "openmrs_entity_id": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "end": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "end", + "openmrs_entity_id": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "today": { + "openmrs_entity_parent": "", + "openmrs_entity": "encounter", + "openmrs_entity_id": "encounter_date" + }, + "deviceid": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "deviceid", + "openmrs_entity_id": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "subscriberid": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "subscriberid", + "openmrs_entity_id": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "simserial": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "simserial", + "openmrs_entity_id": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "phonenumber": { + "openmrs_entity_parent": "", + "openmrs_entity": "concept", + "openmrs_data_type": "phonenumber", + "openmrs_entity_id": "163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "encounter_location": "", + "look_up": { + "entity_id": "", + "value": "" + } + }, + "step1": { + "title": "Sick Child Follow-up", + "fields": [ + { + "key": "date_sickchild", + "openmrs_entity": "", + "openmrs_entity_id": "date_sickchild", + "openmrs_entity_parent": "", + "type": "hidden", + "calculation": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_calculation.yml" + } + } + } + }, + { + "key": "weight_sickchild", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "number", + "hint": "Weight (kg)", + "v_required": { + "value": "true", + "err": "Please enter the child's weight" + } + }, + { + "key": "height_sickchild", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "number", + "hint": "Height (cm)", + "v_required": { + "value": "true", + "err": "Please enter the child's height" + } + }, + { + "key": "diarrhea_sickchild", + "type": "native_radio", + "openmrs_entity": "concept", + "openmrs_entity_id": "142412AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Does the child have diarrhoea?", + "options": [ + { + "key": "Yes", + "openmrs_entity": "", + "openmrs_entity_id": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Yes" + }, + { + "key": "No", + "openmrs_entity": "", + "openmrs_entity_id": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "No" + } + ], + "v_required": { + "value": "true", + "err": "Please indicate whether the child has diarrhoea" + } + }, + { + "key": "diarrhea_time_sick_child", + "type": "native_radio", + "openmrs_entity": "concept", + "openmrs_entity_id": "5984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Diarrhoea duration?", + "options": [ + { + "key": "Less_than_24_hours", + "openmrs_entity": "", + "openmrs_entity_id": "164449AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Less than 24 hours" + }, + { + "key": "Days", + "openmrs_entity": "", + "openmrs_entity_id": "1072AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Days" + } + ], + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please select the duration" + } + }, + { + "key": "dehydration_sick_child", + "type": "native_radio", + "openmrs_entity": "concept", + "openmrs_entity_id": "1497AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Dehydration status", + "options": [ + { + "key": "No_dehydration", + "openmrs_entity": "", + "openmrs_entity_id": "1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "No dehydration" + }, + { + "key": "Some_dehydration", + "openmrs_entity": "", + "openmrs_entity_id": "1499AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Some dehydration" + }, + { + "key": "Severe_dehydration", + "openmrs_entity": "", + "openmrs_entity_id": "1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Severe dehydration" + } + ], + "v_required": { + "value": "true", + "err": "Please select the child's dehydration status" + } + }, + { + "key": "other_sympt_sick_child", + "type": "check_box", + "openmrs_entity": "concept", + "openmrs_entity_id": "1729AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Other symptoms related to diarrhoea", + "combine_checkbox_option_values": "true", + "options": [ + { + "key": "Bloody_diarrhoea", + "openmrs_choice_id": "138868AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Bloody diarrhoea", + "value": false + }, + { + "key": "Fever", + "openmrs_choice_id": "140238AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Fever", + "value": false + }, + { + "key": "Vomiting", + "openmrs_choice_id": "122983AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Vomiting", + "value": false + }, + { + "key": "Other", + "openmrs_choice_id": "5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Other", + "value": false + }, + { + "key": "None", + "openmrs_choice_id": "164369AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "None", + "value": false + } + ], + "exclusive": [ + "None" + ], + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please select other symptoms" + } + }, + { + "key": "test_ordered_sickchild", + "type": "native_radio", + "openmrs_entity": "concept", + "openmrs_entity_id": "1271AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Investigations ordered", + "options": [ + { + "key": "Blood_test", + "openmrs_entity": "", + "openmrs_entity_id": "1019AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Blood test" + }, + { + "key": "Stool_test", + "openmrs_entity": "", + "openmrs_entity_id": "161451AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Stool test" + }, + { + "key": "Other_investigation", + "openmrs_entity": "", + "openmrs_entity_id": "5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Other investigation" + }, + { + "key": "None", + "openmrs_entity": "", + "openmrs_entity_id": "164369AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "None" + } + ], + "v_required": { + "value": "true", + "err": "Please select investigation ordered" + } + }, + { + "key": "other_test_ordered_sickchild", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "name", + "hint": "Other investigations ordered", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please enter other investigations ordered" + } + }, + { + "key": "test_results_sick_child", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "161577AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "name", + "hint": "Investigation results", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please enter investigation results" + } + }, + { + "key": "diagnosis_sick_child", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "161602AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "name", + "hint": "Diagnosis", + "v_required": { + "value": "true", + "err": "Please enter the diagnosis" + } + }, + { + "key": "diarrhea_treat", + "type": "check_box", + "openmrs_entity": "concept", + "openmrs_entity_id": "1767AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Treatment for diarrhea", + "combine_checkbox_option_values": "true", + "options": [ + { + "key": "ORS_solution", + "openmrs_choice_id": "351AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "ORS solution", + "value": false + }, + { + "key": "IV_infusion_drip", + "openmrs_choice_id": "162651AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "IV infusion (drip)", + "value": false + }, + { + "key": "Zinc", + "openmrs_choice_id": "86672AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Zinc", + "value": false + }, + { + "key": "Other_treatments", + "openmrs_choice_id": "5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Other treatments", + "value": false + }, + { + "key": "None", + "openmrs_choice_id": "164369AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "None", + "value": false + } + ], + "exclusive": [ + "none" + ], + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please indicate treatment given" + } + }, + { + "key": "diarrhea_treat_ors", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "diarrhea_treat_ors", + "openmrs_entity_parent": "", + "edit_type": "number", + "hint": "Amount of ORS solution (ml)", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please enter amount of ORS solution given" + } + }, + { + "key": "diarrhea_treat_rehydration", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "diarrhea_treat_rehydration", + "openmrs_entity_parent": "", + "edit_type": "number", + "hint": "IV infusion (mls)", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please enter amount of IV infusion" + } + }, + { + "key": "diarrhea_treat_zinc", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "diarrhea_treat_zinc", + "openmrs_entity_parent": "", + "edit_type": "number", + "hint": "Zinc (mg)", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please enter amount of Zinc given" + } + }, + { + "key": "diarrhea_treat_walkaway", + "type": "check_box", + "openmrs_entity": "concept", + "openmrs_entity_id": "160742AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Drugs taken home", + "combine_checkbox_option_values": "true", + "options": [ + { + "key": "ORS_Packs", + "openmrs_choice_id": "351AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "ORS Packs", + "value": false + }, + { + "key": "Zinc_pills", + "openmrs_choice_id": "86672AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Zinc (pills)", + "value": false + }, + { + "key": "Other_drugs", + "openmrs_choice_id": "5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "text": "Other drugs", + "value": false + } + ], + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please select drugs taken home" + } + }, + { + "key": "treatment_sick_child", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "name", + "hint": "Treatment due to non-diarrhea diagnosis", + "v_required": { + "value": "true", + "err": "Please add treatment to non-diarrhoea diagnosis " + } + }, + { + "key": "dtc_period", + "type": "edit_text", + "openmrs_entity": "concept", + "openmrs_entity_id": "1785AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "edit_type": "number", + "hint": "Time spent in DTC (mins)", + "relevance": { + "rules-engine": { + "ex-rules": { + "rules-file": "sick_child_followup_relevance.yml" + } + } + }, + "v_required": { + "value": "true", + "err": "Please indicate the amount of time of the stay in minutes" + } + }, + { + "key": "results_sick_child", + "type": "native_radio", + "openmrs_entity": "concept", + "openmrs_entity_id": "160433AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "label": "Outcome", + "options": [ + { + "key": "Discharged", + "openmrs_entity": "", + "openmrs_entity_id": "160433AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Discharged" + }, + { + "key": "Referred", + "openmrs_entity": "", + "openmrs_entity_id": "1692AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Referred" + }, + { + "key": "Admitted", + "openmrs_entity": "", + "openmrs_entity_id": "1648AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Admitted" + }, + { + "key": "Died", + "openmrs_entity": "", + "openmrs_entity_id": "1654AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "openmrs_entity_parent": "", + "text": "Died" + } + ], + "v_required": { + "value": "true", + "err": "Please select the outcome at the facility" + } + } + ] + } +} diff --git a/opensrp-chw-hf/src/main/assets/rule/anc_danger_signs_outcome_calculation.yml b/opensrp-chw-hf/src/main/assets/rule/anc_danger_signs_outcome_calculation.yml new file mode 100644 index 000000000..ed8363777 --- /dev/null +++ b/opensrp-chw-hf/src/main/assets/rule/anc_danger_signs_outcome_calculation.yml @@ -0,0 +1,14 @@ +--- +name: step1_anc_danger_signs_visitdate +description: Calculated anc_danger_signs_visitdate +priority: 1 +condition: "true" +actions: + - "calculation = helper.getDateToday()" +--- +name: step1_anc_key_info +description: ANC key info +priority: 1 +condition: "true" +actions: + - "calculation = 'Key information for health facility:\nLast menstrual period: ' + step1_lmp + '\nGestational age: ' + step1_gest_age + '\nEDD: ' + step1_edd" \ No newline at end of file diff --git a/opensrp-chw-hf/src/main/assets/rule/anc_danger_signs_outcome_relevance.yml b/opensrp-chw-hf/src/main/assets/rule/anc_danger_signs_outcome_relevance.yml new file mode 100644 index 000000000..d9ce81da4 --- /dev/null +++ b/opensrp-chw-hf/src/main/assets/rule/anc_danger_signs_outcome_relevance.yml @@ -0,0 +1,14 @@ +--- +name: step1_other_anc_danger_signs +description: Other danger sign +priority: 1 +condition: "step1_danger_signs_present.contains('Other')" +actions: + - "isRelevant = true" +--- +name: step1_managed_signs +description: How other conditions were managed +priority: 1 +condition: "step1_action_taken_anc_danger_signs.contains('Managed')" +actions: + - "isRelevant = true" \ No newline at end of file diff --git a/opensrp-chw-hf/src/main/assets/rule/sick_child_followup_calculation.yml b/opensrp-chw-hf/src/main/assets/rule/sick_child_followup_calculation.yml new file mode 100644 index 000000000..86a9b1f7e --- /dev/null +++ b/opensrp-chw-hf/src/main/assets/rule/sick_child_followup_calculation.yml @@ -0,0 +1,7 @@ +--- +name: step1_date_sickchild +description: Calculated date_sickchild +priority: 1 +condition: "true" +actions: + - "calculation = helper.getDateToday()" \ No newline at end of file diff --git a/opensrp-chw-hf/src/main/assets/rule/sick_child_followup_relevance.yml b/opensrp-chw-hf/src/main/assets/rule/sick_child_followup_relevance.yml new file mode 100644 index 000000000..09c14f7b6 --- /dev/null +++ b/opensrp-chw-hf/src/main/assets/rule/sick_child_followup_relevance.yml @@ -0,0 +1,70 @@ +--- +name: step1_diarrhea_time_sick_child +description: Diarrhoea duration +priority: 1 +condition: "step1_diarrhea_sickchild == 'Yes'" +actions: + - "isRelevant = true" +--- +name: step1_other_sympt_sick_child +description: Other symptoms related to diarrhoea +priority: 1 +condition: "step1_diarrhea_sickchild == 'Yes'" +actions: + - "isRelevant = true" +--- +name: step1_other_test_ordered_sickchild +description: Other symptoms related to diarrhoea +priority: 1 +condition: "step1_test_ordered_sickchild == 'Other_investigation'" +actions: + - "isRelevant = true" +--- +name: step1_test_results_sick_child +description: Investigation results +priority: 1 +condition: "step1_test_ordered_sickchild != 'None'" +actions: + - "isRelevant = true" +--- +name: step1_diarrhea_treat +description: Treatment for diarrhea +priority: 1 +condition: "step1_diarrhea_sickchild == 'Yes'" +actions: + - "isRelevant = true" +--- +name: step1_diarrhea_treat_ors +description: Amount of ORS solution +priority: 1 +condition: "step1_diarrhea_treat.contains('ORS_solution')" +actions: + - "isRelevant = true" +--- +name: step1_diarrhea_treat_rehydration +description: Amount of IV infusion +priority: 1 +condition: "step1_diarrhea_treat.contains('IV_infusion_drip')" +actions: + - "isRelevant = true" +--- +name: step1_diarrhea_treat_zinc +description: Amount of Zinc +priority: 1 +condition: "step1_diarrhea_treat.contains('Zinc')" +actions: + - "isRelevant = true" +--- +name: step1_diarrhea_treat_walkaway +description: Drugs taken home +priority: 1 +condition: "step1_diarrhea_sickchild == 'Yes'" +actions: + - "isRelevant = true" +--- +name: step1_dtc_period +description: Time spent in DTC (mins) +priority: 1 +condition: "step1_diarrhea_sickchild == 'Yes'" +actions: + - "isRelevant = true" \ No newline at end of file diff --git a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/AncMemberProfileActivity.java b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/AncMemberProfileActivity.java index 38016b406..cc0ef8513 100644 --- a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/AncMemberProfileActivity.java +++ b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/AncMemberProfileActivity.java @@ -199,11 +199,6 @@ private void initializeTasksRecyclerView() { referralRecyclerView.setLayoutManager(layoutManager); } - @Override - public void startFormActivity(JSONObject formJson) { - //Overridden but not used - } - @Override public void onPointerCaptureChanged(boolean hasCapture) { // implemented but not used. diff --git a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/ChildProfileActivity.java b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/ChildProfileActivity.java index 3e8bd18f6..e75c30ffc 100644 --- a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/ChildProfileActivity.java +++ b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/activity/ChildProfileActivity.java @@ -1,6 +1,7 @@ package org.smartregister.chw.hf.activity; import android.app.Activity; +import android.content.Intent; import android.view.Gravity; import android.view.Menu; import android.view.MenuItem; @@ -13,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView; import org.jetbrains.annotations.NotNull; +import org.json.JSONObject; import org.smartregister.chw.anc.domain.MemberObject; import org.smartregister.chw.core.activity.CoreChildHomeVisitActivity; import org.smartregister.chw.core.activity.CoreChildProfileActivity; @@ -30,9 +32,13 @@ import org.smartregister.chw.malaria.dao.MalariaDao; import org.smartregister.domain.Task; import org.smartregister.family.util.Constants; +import org.smartregister.family.util.JsonFormUtils; +import org.smartregister.family.util.Utils; import java.util.Set; +import timber.log.Timber; + public class ChildProfileActivity extends CoreChildProfileActivity { public CoreFamilyMemberFloatingMenu familyFloatingMenu; public RelativeLayout referralRow; @@ -126,7 +132,9 @@ public void setClientTasks(Set taskList) { public boolean onOptionsItemSelected(@NotNull MenuItem item) { switch (item.getItemId()) { case R.id.action_sick_child_follow_up: - displayShortToast(R.string.clicked_sick_child); + if (presenter != null) { + ((HfChildProfilePresenter) presenter).startSickChildForm(null); + } return true; case R.id.action_malaria_diagnosis: displayShortToast(R.string.clicked_malaria_diagnosis); @@ -212,4 +220,21 @@ protected void onResume() { referralRecyclerView.getAdapter().notifyDataSetChanged(); } } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == JsonFormUtils.REQUEST_CODE_GET_JSON) { + try { + String jsonString = data.getStringExtra(Constants.JSON_FORM_EXTRA.JSON); + JSONObject form = new JSONObject(jsonString); + String encounterType = form.getString(JsonFormUtils.ENCOUNTER_TYPE); + if (encounterType.equals(CoreConstants.EventType.SICK_CHILD_FOLLOW_UP)) { + ((HfChildProfilePresenter) presenter).createSickChildEvent(Utils.getAllSharedPreferences(), jsonString); + } + } catch (Exception ex) { + Timber.e(ex); + } + } + super.onActivityResult(requestCode, resultCode, data); + } } diff --git a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/interactor/HfChildProfileInteractor.java b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/interactor/HfChildProfileInteractor.java index f76cf5a2b..d2ea34f9a 100644 --- a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/interactor/HfChildProfileInteractor.java +++ b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/interactor/HfChildProfileInteractor.java @@ -5,6 +5,7 @@ import androidx.annotation.VisibleForTesting; import org.json.JSONObject; +import org.smartregister.chw.anc.util.NCUtils; import org.smartregister.chw.core.contract.CoreChildProfileContract; import org.smartregister.chw.core.interactor.CoreChildProfileInteractor; import org.smartregister.chw.core.model.ChildVisit; @@ -16,8 +17,10 @@ import org.smartregister.chw.core.utils.CoreJsonFormUtils; import org.smartregister.chw.core.utils.Utils; import org.smartregister.chw.hf.utils.HfChildUtils; +import org.smartregister.clientandeventmodel.Event; import org.smartregister.family.util.AppExecutors; import org.smartregister.family.util.DBConstants; +import org.smartregister.repository.AllSharedPreferences; import java.util.Date; import java.util.HashMap; @@ -119,6 +122,12 @@ public void processBackGroundEvent(final CoreChildProfileContract.InteractorCall appExecutors.diskIO().execute(runnable); } + @Override + public void createSickChildEvent(AllSharedPreferences allSharedPreferences, String jsonString) throws Exception { + Event baseEvent = org.smartregister.chw.anc.util.JsonFormUtils.processJsonForm(allSharedPreferences, org.smartregister.chw.core.utils.CoreReferralUtils.setEntityId(jsonString, getChildBaseEntityId()), CoreConstants.TABLE_NAME.SICK_CHILD_FOLLOW_UP); + NCUtils.processEvent(baseEvent.getBaseEntityId(), new JSONObject(org.smartregister.chw.anc.util.JsonFormUtils.gson.toJson(baseEvent))); + } + private void updateUpcomingServices(final CoreChildProfileContract.InteractorCallBack callback, Context context) { updateUpcomingServices(context) .subscribeOn(Schedulers.io()) diff --git a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/presenter/HfChildProfilePresenter.java b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/presenter/HfChildProfilePresenter.java index ef72b4814..819986db1 100644 --- a/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/presenter/HfChildProfilePresenter.java +++ b/opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/presenter/HfChildProfilePresenter.java @@ -4,15 +4,20 @@ import org.smartregister.chw.core.contract.CoreChildProfileContract; import org.smartregister.chw.core.presenter.CoreChildProfilePresenter; +import org.smartregister.chw.core.utils.CoreConstants; import org.smartregister.chw.hf.R; import org.smartregister.chw.hf.interactor.HfChildProfileInteractor; import org.smartregister.chw.hf.interactor.HfFamilyProfileInteractor; import org.smartregister.chw.hf.model.ChildRegisterModel; import org.smartregister.clientandeventmodel.Client; import org.smartregister.clientandeventmodel.Event; +import org.smartregister.commonregistry.CommonPersonObjectClient; +import org.smartregister.repository.AllSharedPreferences; import java.lang.ref.WeakReference; +import timber.log.Timber; + public class HfChildProfilePresenter extends CoreChildProfilePresenter { public HfChildProfilePresenter(CoreChildProfileContract.View childView, CoreChildProfileContract.Model model, String childBaseEntityId) { @@ -37,4 +42,20 @@ public void updateChildProfile(String jsonString) { getInteractor().saveRegistration(pair, jsonString, true, this); } + + @Override + public void startSickChildForm(CommonPersonObjectClient client) { + try { + getView().startFormActivity(getFormUtils().getFormJson(CoreConstants.JSON_FORM.getChildSickForm())); + } catch (Exception ex) { + Timber.e(ex); + } + } + + @Override + public void createSickChildEvent(AllSharedPreferences allSharedPreferences, String jsonString) throws Exception { + getInteractor().setChildBaseEntityId(getChildBaseEntityId()); + getInteractor().createSickChildEvent(allSharedPreferences, jsonString); + } + }