Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/malaria pre uat issues #1233

Open
wants to merge 5 commits into
base: tanzania-ministry-of-health-nacp
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
{
"field": "eventType",
"field_value": "Malaria Confirmation",
"field_value": "Malaria Follow-up HF",
"closes_case": [
"ec_malaria_confirmation"
]
Expand Down
12 changes: 6 additions & 6 deletions opensrp-chw-hf/src/main/assets/ec_client_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@
"type": "Event",
"json_mapping": {
"field": "obs.fieldCode",
"concept": "162869AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "date_chw_malaria_test"
}
},
{
Expand All @@ -2338,15 +2338,15 @@
"type": "Event",
"json_mapping": {
"field": "obs.fieldCode",
"concept": "1731AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "fever_duration"
}
},
{
"column_name": "malaria_results",
"type": "Event",
"json_mapping": {
"field": "obs.fieldCode",
"concept": "1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "malaria_results"
}
},
{
Expand All @@ -2362,15 +2362,15 @@
"type": "Event",
"json_mapping": {
"field": "obs.fieldCode",
"concept": "163724AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "malaria_test_date"
}
},
{
"column_name": "malaria",
"type": "Event",
"json_mapping": {
"field": "obs.fieldCode",
"concept": "163725AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "malaria"
}
},
{
Expand Down Expand Up @@ -2410,7 +2410,7 @@
"type": "Event",
"json_mapping": {
"field": "obs.fieldCode",
"concept": "1379AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "malaria_edu_chw"
}
},
{
Expand Down
48 changes: 38 additions & 10 deletions opensrp-chw-hf/src/main/assets/json.form/malaria_follow_up_hf.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,43 @@
{
"key": "weight_malaria_hf",
"type": "edit_text",
"openmrs_entity": "",
"hint": "Weight (kg)",
"openmrs_entity": "concept",
"openmrs_entity_id": "weight_malaria_hf",
"openmrs_entity_parent": "",
"edit_type": "number",
"hint": "Weight (kg)",
"v_required": {
"v_numeric": {
"value": "true",
"err": "Please enter weight"
"err": "Please enter the height"
},
"v_max": {
"value": "300",
"err": "The weight must be equal or less than 300 (KG)"
},
"v_max_length": {
"value": "3",
"is_fixed_size": "true",
"err": "Please enter a valid weight."
}
},
{
"key": "height_malaria_hf",
"type": "edit_text",
"openmrs_entity": "",
"hint": "Height (cm)",
"openmrs_entity": "concept",
"openmrs_entity_id": "height_malaria_hf",
"openmrs_entity_parent": "",
"edit_type": "number",
"hint": "Height (cm)",
"v_required": {
"v_numeric": {
"value": "true",
"err": "Please enter height"
"err": "Please enter the height"
},
"v_max": {
"value": "200",
"err": "The height must be equal or less than 200 (CM)"
},
"v_max_length": {
"value": "3",
"is_fixed_size": "true",
"err": "Please enter a valid height."
}
},
{
Expand Down Expand Up @@ -209,6 +225,12 @@
"v_required": {
"value": "true",
"err": "Please select test results"
},
"relevance": {
"step1:test_malaria_hf": {
"type": "string",
"ex": "notEqualTo(., \"mRDT_not_done\")"
}
}
},
{
Expand Down Expand Up @@ -259,6 +281,12 @@
"v_required": {
"value": "true",
"err": "Please select diagnosis"
},
"relevance": {
"step1:test_malaria_hf": {
"type": "string",
"ex": "notEqualTo(., \"mRDT_not_done\")"
}
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,19 @@ name: step1_date_malaria_visit_hf
description: Calculated date_malaria_visit_hf
priority: 1
condition: "true"
actions:
- "calculation = helper.getDateTimeToday()"
---
name: step1_malaria_results
description: Calculated malaria_results
priority: 1
condition: "step_1_test_results_malaria_hf == 'mRDT_positive' || step_1_test_malaria_hf == 'Malaria_parasite_seen'"
actions:
- "calculation = 'positive'"
---
name: step1_malaria_test_date
description: Calculated malaria_test_date
priority: 1
condition: "step_1_test_results_malaria_hf == 'mRDT_positive' || step_1_test_malaria_hf == 'Malaria_parasite_seen'"
actions:
- "calculation = helper.getDateTimeToday()"
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.smartregister.chw.hf.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;

import androidx.annotation.NonNull;
Expand All @@ -12,6 +13,7 @@
import org.smartregister.chw.core.activity.CoreAllClientsRegisterActivity;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.chw.hf.R;
import org.smartregister.chw.hf.custom_view.FacilityMenu;
import org.smartregister.chw.hf.fragment.AdvancedSearchFragment;
import org.smartregister.chw.hf.fragment.AllClientsRegisterFragment;
import org.smartregister.chw.hf.model.HfAllClientsRegisterModel;
Expand All @@ -28,6 +30,11 @@
import timber.log.Timber;

public class AllClientsRegisterActivity extends CoreAllClientsRegisterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacilityMenu.getInstance(this, null, null);
}

@Override
protected BaseRegisterFragment getRegisterFragment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.chw.hf.R;
import org.smartregister.chw.hf.custom_view.FacilityMenu;
import org.smartregister.chw.hf.fragment.CdpReceiveFromOrganizationsRegisterFragment;
import org.smartregister.chw.hf.fragment.OrdersRegisterFragment;
import org.smartregister.chw.hf.fragment.RequestOrdersRegisterFragment;
Expand Down Expand Up @@ -43,7 +44,7 @@ protected Fragment[] getOtherFragments() {
@Override
protected void onResumption() {
super.onResumption();
NavigationMenu menu = NavigationMenu.getInstance(this, null, null);
NavigationMenu menu = FacilityMenu.getInstance(this, null, null);
if (menu != null) {
menu.getNavigationAdapter().setSelectedView(CoreConstants.DrawerMenu.CDP_HF);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.chw.hf.R;
import org.smartregister.chw.hf.custom_view.FacilityMenu;
import org.smartregister.chw.hf.fragment.KvpRegisterFragment;
import org.smartregister.chw.kvp.util.Constants;
import org.smartregister.view.fragment.BaseRegisterFragment;
Expand Down Expand Up @@ -58,7 +59,7 @@ protected BaseRegisterFragment getRegisterFragment() {
@Override
protected void onResumption() {
super.onResumption();
NavigationMenu menu = NavigationMenu.getInstance(this, null, null);
NavigationMenu menu = FacilityMenu.getInstance(this, null, null);
if (menu != null) {
menu.getNavigationAdapter().setSelectedView(CoreConstants.DrawerMenu.KVP);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.hf.custom_view.FacilityMenu;
import org.smartregister.chw.hf.presenter.IssueReferralActivityPresenter;
import org.smartregister.chw.referral.activity.BaseIssueReferralActivity;
import org.smartregister.chw.referral.contract.BaseIssueReferralContract;
Expand Down Expand Up @@ -44,7 +45,7 @@ public static void startGeneralReferralFormActivityForResults(Activity activity,
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
NavigationMenu.getInstance(this, null, null);
FacilityMenu.getInstance(this, null, null);
}

// @Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.smartregister.chw.hf.activity;

import static org.smartregister.chw.core.utils.CoreConstants.JSON_FORM.getMalariaFollowUpHfForm;
import static org.smartregister.chw.core.utils.Utils.passToolbarTitle;
import static org.smartregister.chw.hf.utils.Constants.JsonForm.getHeiNumberRegistration;
import static org.smartregister.chw.malaria.util.Constants.ACTIVITY_PAYLOAD.BASE_ENTITY_ID;

import android.app.Activity;
Expand All @@ -9,6 +11,7 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
Expand Down Expand Up @@ -48,7 +51,8 @@ public static void startMalariaActivity(Activity activity, String baseEntityId)
@Override
protected void onCreation() {
super.onCreation();
findViewById(R.id.record_visit_malaria).setVisibility(View.GONE);
findViewById(R.id.record_visit_malaria).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.textview_record_malaria)).setText(R.string.malaria_diagnosis);
this.setOnMemberTypeLoadedListener(memberType -> {
switch (memberType.getMemberType()) {
case CoreConstants.TABLE_NAME.ANC_MEMBER:
Expand Down Expand Up @@ -90,6 +94,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
String encounterType = form.getString(JsonFormUtils.ENCOUNTER_TYPE);
if (encounterType.equals(CoreConstants.EventType.MALARIA_FOLLOW_UP_HF)) {
getPresenter().createHfMalariaFollowupEvent(Utils.getAllSharedPreferences(), jsonString, memberObject.getBaseEntityId());
finish();
}
} catch (Exception ex) {
Timber.e(ex);
Expand Down Expand Up @@ -196,4 +201,15 @@ public void updateReferralTasks(Set<Task> taskList) {
public void setCommonPersonObjectClient(CommonPersonObjectClient commonPersonObjectClient) {
this.commonPersonObjectClient = commonPersonObjectClient;
}

@Override
public void onClick(View view) {
super.onClick(view);
if (view.getId() == R.id.textview_record_malaria) {

JSONObject jsonForm = org.smartregister.chw.core.utils.FormUtils.getFormUtils().getFormJson(getMalariaFollowUpHfForm());
startFormActivity(jsonForm);
// MalariaFollowUpVisitActivityHelper.startMalariaFollowUpActivity(this, baseEntityId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.smartregister.chw.core.activity.CoreKvpRegisterActivity;
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.chw.hf.custom_view.FacilityMenu;
import org.smartregister.chw.hf.fragment.PrEPRegisterFragment;
import org.smartregister.chw.kvp.util.Constants;
import org.smartregister.view.fragment.BaseRegisterFragment;
Expand All @@ -31,7 +32,7 @@ protected BaseRegisterFragment getRegisterFragment() {
@Override
protected void onResumption() {
super.onResumption();
NavigationMenu menu = NavigationMenu.getInstance(this, null, null);
NavigationMenu menu = FacilityMenu.getInstance(this, null, null);
if (menu != null) {
menu.getNavigationAdapter().setSelectedView(CoreConstants.DrawerMenu.PrEP);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.hf.custom_view.FacilityMenu;
import org.smartregister.chw.hf.presenter.IssueReferralActivityPresenter;
import org.smartregister.chw.referral.activity.BaseIssueReferralActivity;
import org.smartregister.chw.referral.contract.BaseIssueReferralContract;
Expand Down Expand Up @@ -45,7 +46,7 @@ public static void startGeneralReferralFormActivityForResults(Activity activity,
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
NavigationMenu.getInstance(this, null, null);
FacilityMenu.getInstance(this, null, null);
}

// @Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,46 @@
package org.smartregister.chw.hf.custom_view;

import android.app.Activity;
import android.content.res.Configuration;
import android.view.View;

import androidx.appcompat.widget.Toolbar;

import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.hf.presenter.HfNavigationPresenter;
import org.smartregister.receiver.SyncStatusBroadcastReceiver;
import java.lang.ref.WeakReference;

import timber.log.Timber;

public class FacilityMenu extends NavigationMenu {

public static NavigationMenu getInstance(Activity activity, View parentView, Toolbar myToolbar) {
try {
SyncStatusBroadcastReceiver.getInstance().removeSyncStatusListener(instance);
activityWeakReference = new WeakReference<>(activity);
int orientation = activity.getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
if (instance == null) {
instance = new FacilityMenu();
}
if (!(instance instanceof FacilityMenu)) {
instance = new FacilityMenu();
}

SyncStatusBroadcastReceiver.getInstance().addSyncStatusListener(instance);
((FacilityMenu) instance).init(activity, parentView, myToolbar);
return instance;
} else {
return null;
}
} catch (OutOfMemoryError e) {
Timber.e(e);
}

return null;
}

@Override
protected void init(Activity activity, View myParentView, Toolbar myToolbar) {
try {
Expand Down
Loading