Skip to content

Commit

Permalink
Merge branch 'tanzania-ministry-of-health-nacp' into merging/master-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
cozej4 authored Aug 23, 2022
2 parents 1b0d19a + 0e706f6 commit 15e3e72
Show file tree
Hide file tree
Showing 75 changed files with 2,519 additions and 238 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ subprojects {

ext.androidToolsBuildGradle = '4.0.1'
ext.androidBuildToolsVersion = '29.0.3'
ext.androidMinSdkVersion = 19
ext.androidMinSdkVersion = 21
ext.androidCompileSdkVersion = 30
ext.androidTargetSdkVersion = 30

Expand Down
8 changes: 8 additions & 0 deletions opensrp-chw/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
android:name=".activity.CBHSReportsActivity"
android:exported="false"
android:theme="@style/ChwTheme.NoActionBar" />
<activity
android:name=".activity.MotherChampionReportsViewActivity"
android:exported="false"
android:theme="@style/ChwTheme.NoActionBar" />
<activity
android:name=".activity.MotherChampionReportsActivity"
android:exported="false"
android:theme="@style/ChwTheme.NoActionBar" />
<activity
android:name=".activity.InAppReportsActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
indicators:
- key: "b-1"
description: "Idadi ya wateja wa PMTCT waliounganishwa kwenye kikundi/vikundi vya IGA and Ushauri Nasaha"
indicatorQuery: " SELECT count(DISTINCT emcf.entity_id) as count
from ec_mother_champion_followup emcf
WHERE linked_to_psychosocial_group = 'yes'
AND date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
date(substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 1, 4) ||
'-' ||
substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 6, 2) ||
'-' || '01')"
- key: "b-2"
description: "Idadi ya wateja wapya wa PMTCT waliofuatiliwa na mama vinara na kuanza kutumia dawa"
indicatorQuery: " SELECT count(DISTINCT emcf.entity_id) as count
from ec_mother_champion_followup emcf
WHERE visit_number = 0
AND date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
date(substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 1, 4) ||
'-' ||
substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 6, 2) ||
'-' || '01')"
- key: "b-3"
description: "Idadi ya wateja wa PMTCT waliopotea kwenye matumizi ya dawa (LTF) na kurudishwa/kufuatiliwa na mama vinara"
indicatorQuery: " SELECT count(DISTINCT epcf.entity_id) as count
from ec_pmtct_community_feedback epcf
WHERE date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
date(substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 1, 4) ||
'-' ||
substr(strftime('%Y-%m-%d', datetime(last_interacted_with / 1000, 'unixepoch', 'localtime')), 6, 2) ||
'-' || '01')"
- key: "b-4"
description: "Idadi ya vipindi alivyofundisha mama kinara/vinara kwa wateja wa PMTCT"
indicatorQuery: " SELECT count(DISTINCT id) as count
from ec_sbcc es
WHERE date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
date(substr(es.sbcc_date, 7, 4) || '-' || substr(es.sbcc_date, 4, 2) || '-' || '01')"
- key: "b-5"
description: "Idadi ya wateja wa PMTCT walioelimishwa na mama kinara/vinara"
indicatorQuery: " SELECT SUM(participants_number) as count
from ec_sbcc es
WHERE date((substr('%s', 1, 4) || '-' || substr('%s', 6, 2) || '-' || '01')) =
date(substr(es.sbcc_date, 7, 4) || '-' || substr(es.sbcc_date, 4, 2) || '-' || '01')"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;

import com.vijay.jsonwizard.constants.JsonFormConstants;
import com.vijay.jsonwizard.domain.Form;
Expand All @@ -23,6 +24,7 @@

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import timber.log.Timber;

Expand Down Expand Up @@ -84,6 +86,25 @@ public void onDestroy() {
@Override
public void initializeActions(LinkedHashMap<String, BaseAncHomeVisitAction> map) {
actionList.clear();
super.initializeActions(map);
//Necessary evil to rearrange the actions according to a specific arrangement
if (map.containsKey(getString(R.string.anc_home_visit_danger_signs))) {
BaseAncHomeVisitAction dangerSignsAction = map.get(getString(R.string.anc_home_visit_danger_signs));
actionList.put(getString(R.string.anc_home_visit_danger_signs), dangerSignsAction);
}
//====================End of Necessary evil ====================================

for (Map.Entry<String, BaseAncHomeVisitAction> entry : map.entrySet()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
actionList.putIfAbsent(entry.getKey(), entry.getValue());
} else {
actionList.put(entry.getKey(), entry.getValue());
}
}

if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
displayProgressBar(false);
redrawVisitUI();
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package org.smartregister.chw.activity;

import static android.view.View.GONE;
import static com.vijay.jsonwizard.utils.FormUtils.fields;
import static com.vijay.jsonwizard.utils.FormUtils.getFieldJSONObject;
import static org.smartregister.chw.core.utils.Utils.passToolbarTitle;
import static org.smartregister.chw.util.Constants.PartnerRegistrationConstants.INTENT_BASE_ENTITY_ID;
import static org.smartregister.chw.util.Constants.PartnerRegistrationConstants.INTENT_FORM_SUBMISSION_ID;
import static org.smartregister.chw.util.Constants.PartnerRegistrationConstants.REFERRAL_FORM_SUBMISSION_ID;
import static org.smartregister.chw.util.Constants.PartnerRegistrationConstants.ReferralFormId;
import static org.smartregister.chw.util.NotificationsUtil.handleNotificationRowClick;
import static org.smartregister.chw.util.NotificationsUtil.handleReceivedNotifications;
import static org.smartregister.util.JsonFormUtils.STEP1;
import static org.smartregister.util.JsonFormUtils.VALUE;

import android.app.Activity;
import android.content.ContentValues;
Expand Down Expand Up @@ -127,6 +131,9 @@ public void setupViews() {
JSONObject formJsonObject = null;
try {
formJsonObject = (new FormUtils()).getFormJsonFromRepositoryOrAssets(this, CoreConstants.JSON_FORM.getAncPartnerCommunityFollowupFeedback());
AllSharedPreferences preferences = ChwApplication.getInstance().getContext().allSharedPreferences();
JSONObject chwName = getFieldJSONObject(fields(formJsonObject, STEP1), "chw_name");
chwName.put(VALUE, preferences.getANMPreferredName(preferences.fetchRegisteredANM()));
startFormActivity(formJsonObject);
} catch (JSONException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class CBHSReportsActivity extends SecuredActivity implements View.OnClick
protected ConstraintLayout monthlyReport;
protected AppBarLayout appBarLayout;
Menu menu;
private String reportPeriod = ReportUtils.getDefaultReportPeriod();
protected String reportPeriod = ReportUtils.getDefaultReportPeriod();

@Override
protected void onCreation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.smartregister.chw.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.vijay.jsonwizard.constants.JsonFormConstants;
Expand All @@ -20,7 +19,6 @@
import org.smartregister.chw.schedulers.ChwScheduleTaskExecutor;
import org.smartregister.family.util.Constants;
import org.smartregister.family.util.JsonFormUtils;
import org.smartregister.util.LangUtils;

import java.util.Date;

Expand Down Expand Up @@ -80,11 +78,4 @@ public void startFormActivity(JSONObject jsonForm) {
startActivityForResult(intent, JsonFormUtils.REQUEST_CODE_GET_JSON);
}

@Override
protected void attachBaseContext(Context base) {
// get language from prefs
String lang = LangUtils.getLanguage(base.getApplicationContext());
super.attachBaseContext(LangUtils.setAppLocale(base, lang));
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.smartregister.chw.core.adapter.NotificationListAdapter;
import org.smartregister.chw.core.contract.FamilyProfileExtendedContract;
import org.smartregister.chw.core.dao.AncDao;
import org.smartregister.chw.core.dao.PNCDao;
import org.smartregister.chw.core.listener.OnClickFloatingMenu;
import org.smartregister.chw.core.listener.OnRetrieveNotifications;
import org.smartregister.chw.core.task.RunnableTask;
Expand Down Expand Up @@ -478,7 +479,7 @@ public void onReceivedNotifications(List<Pair<String, String>> notifications) {
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(org.smartregister.chw.core.R.menu.hiv_profile_menu, menu);
menu.findItem(R.id.action_anc_registration).setVisible(isClientEligibleForAnc(getHivMemberObject()) && !AncDao.isANCMember(getHivMemberObject().getBaseEntityId()));
menu.findItem(R.id.action_pregnancy_out_come).setVisible(isClientEligibleForAnc(getHivMemberObject()));
menu.findItem(R.id.action_pregnancy_out_come).setVisible(isClientEligibleForAnc(getHivMemberObject()) && !PNCDao.isPNCMember(getHivMemberObject().getBaseEntityId()));
menu.findItem(R.id.action_location_info).setVisible(UpdateDetailsUtil.isIndependentClient(getHivMemberObject().getBaseEntityId()));
// flavor.updateTbMenuItems(getHivMemberObject().getBaseEntityId(), menu);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class InAppReportsActivity extends SecuredActivity implements View.OnClic
protected CustomFontTextView toolBarTextView;
protected AppBarLayout appBarLayout;
protected ConstraintLayout cbhsReportsLayout;
protected ConstraintLayout motherChampionReportsLayout;

@Override
protected void onCreation() {
Expand All @@ -40,7 +41,8 @@ protected void onResumption() {

public void setUpViews() {
cbhsReportsLayout = findViewById(R.id.cbhs_summary);

motherChampionReportsLayout = findViewById(R.id.mother_champion_reports);
motherChampionReportsLayout.setOnClickListener(this);
cbhsReportsLayout.setOnClickListener(this);
}

Expand Down Expand Up @@ -78,6 +80,10 @@ public void onClick(View v) {
Intent intent = new Intent(this, CBHSReportsActivity.class);
startActivity(intent);
}
if(id == R.id.mother_champion_reports){
Intent intent = new Intent(this, MotherChampionReportsActivity.class);
startActivity(intent);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.smartregister.chw.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
Expand Down Expand Up @@ -115,6 +116,27 @@ public void setStartingActivity(String startingActivity) {
this.startingActivity = startingActivity;
}

@Override
protected void updateProblemDisplay() {
clientReferralProblem.setText(getReferralClinic(Utils.getValue(commonPersonObjectClient.getColumnmaps(), "REFERRAL_CLINIC", false),this));
}

private String getReferralClinic(String key, Context context){
switch (key.toLowerCase()){
case "ctc":
return context.getString(R.string.ltfu_clinic_ctc);
case "pwid":
return context.getString(R.string.ltfu_clinic_pwid);
case "prep":
return context.getString(R.string.ltfu_clinic_prep);
case "pmtct":
return context.getString(R.string.ltfu_clinic_pmtct);
case "tb":
return context.getString(R.string.ltfu_clinic_tb);
default:
return key.toUpperCase();
}
}

public String getBaseEntityId() {
return baseEntityId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.smartregister.chw.activity;

import static com.vijay.jsonwizard.utils.FormUtils.fields;
import static com.vijay.jsonwizard.utils.FormUtils.getFieldJSONObject;
import static org.smartregister.util.JsonFormUtils.STEP1;
import static org.smartregister.util.JsonFormUtils.VALUE;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
Expand All @@ -9,6 +14,8 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.vijay.jsonwizard.constants.JsonFormConstants;
import com.vijay.jsonwizard.domain.Form;
import com.vijay.jsonwizard.utils.FormUtils;
Expand All @@ -17,6 +24,7 @@
import org.json.JSONObject;
import org.smartregister.chw.BuildConfig;
import org.smartregister.chw.R;
import org.smartregister.chw.application.ChwApplication;
import org.smartregister.chw.core.activity.CoreFamilyProfileActivity;
import org.smartregister.chw.core.activity.CorePmtctProfileActivity;
import org.smartregister.chw.core.interactor.CorePmtctProfileInteractor;
Expand All @@ -42,7 +50,6 @@
import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import timber.log.Timber;

public class MotherChampionProfileActivity extends CorePmtctProfileActivity {
Expand Down Expand Up @@ -74,6 +81,13 @@ public void onClick(View view) {
JSONObject formJsonObject = null;
try {
formJsonObject = (new FormUtils()).getFormJsonFromRepositoryOrAssets(this, org.smartregister.chw.util.Constants.JsonForm.getMotherChampionFollowupForm());
AllSharedPreferences preferences = ChwApplication.getInstance().getContext().allSharedPreferences();
JSONObject chwName = getFieldJSONObject(fields(formJsonObject, STEP1), "chw_name");
chwName.put(VALUE, preferences.getANMPreferredName(preferences.fetchRegisteredANM()));

JSONObject visitNumber = getFieldJSONObject(fields(formJsonObject, STEP1), "visit_number");
visitNumber.put(VALUE, MotherChampionDao.getVisitNumber(memberObject.getBaseEntityId()));

} catch (JSONException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -263,6 +277,11 @@ public void initializeFloatingMenu() {
addContentView(basePmtctFloatingMenu, linearLayoutParams);
}

@Override
public void refreshMedicalHistory(boolean hasHistory) {
rlLastVisit.setVisibility(View.GONE);
}

private void addPmtctReferralTypes() {
if (BuildConfig.USE_UNIFIED_REFERRAL_APPROACH) {
referralTypeModels.add(new ReferralTypeModel(getString(R.string.pmtct_referral),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.smartregister.chw.activity;

import android.view.View;
import android.widget.TextView;

import org.smartregister.chw.R;

public class MotherChampionReportsActivity extends CBHSReportsActivity {
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.cbhs_monthly_summary) {
MotherChampionReportsViewActivity.startMe(this, "mother-champion-report", reportPeriod);
}
}

@Override
public void setUpToolbar() {
super.setUpToolbar();
TextView title = findViewById(R.id.toolbar_title);
title.setText(R.string.mother_champion_reports);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.smartregister.chw.activity;

import android.app.Activity;
import android.content.Intent;

import org.smartregister.chw.R;
import org.smartregister.chw.util.Constants;

public class MotherChampionReportsViewActivity extends ChwReportsViewActivity {
public static void startMe(Activity activity, String reportPath, String reportDate) {
Intent intent = new Intent(activity, MotherChampionReportsViewActivity.class);
intent.putExtra(ARG_REPORT_PATH, reportPath);
intent.putExtra(ARG_REPORT_DATE, reportDate);
intent.putExtra(ARG_REPORT_TITLE, R.string.mother_champion_reports);
intent.putExtra(ARG_REPORT_TYPE, Constants.ReportConstants.ReportTypes.MOTHER_CHAMPION_REPORT);
activity.startActivity(intent);
}
}
Loading

0 comments on commit 15e3e72

Please sign in to comment.