Skip to content

Commit

Permalink
Merge a38b1b8 into c46a79b
Browse files Browse the repository at this point in the history
  • Loading branch information
ellykits committed Aug 27, 2020
2 parents c46a79b + a38b1b8 commit 1cdcc42
Show file tree
Hide file tree
Showing 25 changed files with 589 additions and 208 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The app is easy to use and has five important screens

![Record Weight Screenshot](https://user-images.githubusercontent.com/31766075/30361164-1c9a2d64-985e-11e7-8852-099b6d55f577.png)
![Record Past Weight Screenshot](https://user-images.githubusercontent.com/31766075/30361167-1ca12718-985e-11e7-9863-bb4a89efa134.png)
- **Weight Graph Button** which displays a dialog with the age respective z-scores over the patients lifetime on a graph. The specific values are also displayed below the graph with the patient's age respective age.
- **Weight Graph Button** which displays a dialog with the patient's *weight-for-age*, *height-for-age* and *weight-for-height* z-scores plotted in a line graph, (depending on the provided app configurations in the properties file). The specific values are also displayed below the graph. See below screenshot for a *weigh-for-age* graph. <br>
![Weight Graph Screenshot](https://user-images.githubusercontent.com/31766075/30361166-1ca12f92-985e-11e7-97b7-2ab3ed8bebe6.png)


Expand All @@ -70,6 +70,14 @@ The app is easy to use and has five important screens

![Edit Weight Screenshot](https://user-images.githubusercontent.com/31766075/30361163-1c99caf4-985e-11e7-8e3e-f985dff40a7a.png)

## Configuring charts
By default the library displays the **Weight-For-Age** graph but for the other 2 charts, that is the **Height-For-Age** and **Weight-For-Height** charts, you MUST
provide configurations in the `app.properties` file. Use the following configs to achieve this:

```
monitor.height=true
monitor.weight.for.height=true
```

# Developer Documentation

Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ subprojects {
google()
jcenter()
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }
maven { url "http://nexus.motechproject.org/content/repositories/drishti" }
maven { url "http://nexus.motechproject.org/content/repositories/snapshots" }
maven { url "http://acra.googlecode.com/svn/repository/releases" }
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "http://cloudant.github.io/cloudant-sync-eap/repository" }
mavenLocal()
maven { url 'https://dl.bintray.com/ibm-watson-health/ibm-fhir-server-releases'}
}

// Improve build server performance by allowing disabling of pre-dexing
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.1.22-SNAPSHOT
VERSION_NAME=1.1.23-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Growth Monitoring Application
Expand Down
19 changes: 9 additions & 10 deletions opensrp-growth-monitoring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ android {
versionName project.VERSION_NAME
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}

buildTypes {
Expand Down Expand Up @@ -88,12 +89,12 @@ allprojects {

dependencies {

implementation('org.smartregister:opensrp-client-core:1.10.1-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-core:1.15.4-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
}

implementation('org.smartregister:opensrp-client-native-form:1.7.32-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-native-form:1.14.1-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'recyclerview-v7'
exclude group: 'com.google.code.gson', module: 'gson'
Expand All @@ -103,32 +104,31 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'

implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.4'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.lecho:hellocharts-android:v1.5.8'

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'


def robolectricVersion = '3.8'
def robolectricVersion = '4.3.1'
testImplementation("org.robolectric:robolectric:$robolectricVersion") {
exclude group: 'com.google.auto.service', module: 'auto-service'
}
testImplementation "org.robolectric:shadows-multidex:$robolectricVersion"
testImplementation "org.robolectric:shadows-support-v4:3.1"
testImplementation "org.robolectric:shadows-support-v4:3.3.2"

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.+') {
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'junit', module: 'junit'
}

// PowerMock
def powerMockVersion = '1.7.4'
def powerMockVersion = '2.0.7'
testImplementation "org.powermock:powermock-module-junit4:$powerMockVersion"
testImplementation "org.powermock:powermock-module-junit4-rule:$powerMockVersion"
testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion"
testImplementation("org.powermock:powermock-classloading-xstream:$powerMockVersion")
testImplementation "org.powermock:powermock-classloading-xstream:$powerMockVersion"
testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3'
testImplementation group: 'org.skyscreamer', name: 'jsonassert', version: '1.2.3'

Expand Down Expand Up @@ -159,5 +159,4 @@ coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/merged.xml"
}


apply from: '../maven.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,5 @@ public String getTeamId() {
public void setTeamId(String teamId) {
this.teamId = teamId;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.smartregister.growthmonitoring.domain;

import org.smartregister.growthmonitoring.GrowthMonitoringLibrary;

import java.util.List;

public class WeightForHeightZScore extends WeightZScore {

public static Float MAX_REPRESENTED_HEIGHT = 120f;
public static Float MIN_REPRESENTED_HEIGHT = 65f;

public static double getZScore(String gender, double weight, double height) {
double zScore = 0.0;
List<ZScore> zScoreValues = GrowthMonitoringLibrary.getInstance().weightForHeightRepository().findZScoreVariables(gender, height);
if (zScoreValues.size() > 0) {
zScore = zScoreValues.get(0).getZ(weight);
}
return zScore;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.smartregister.growthmonitoring.domain;

public class WeightHeight implements Comparable<WeightHeight> {

private Weight weight;
private Height height;

public WeightHeight(Weight weight, Height height) {
this.weight = weight;
this.height = height;
}

public Weight getWeight() {
return weight;
}

public void setWeight(Weight weight) {
this.weight = weight;
}

public Height getHeight() {
return height;
}

public void setHeight(Height height) {
this.height = height;
}

@Override
public int compareTo(WeightHeight weightHeight) {
return this.weight.getDate().compareTo(weightHeight.weight.getDate());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ public View onCreateView(final LayoutInflater inflater, final ViewGroup containe
HeightMonitoringFragment.createInstance(dobString, gender, getHeights()));
}

AppProperties appProperties = GrowthMonitoringLibrary.getInstance().getAppProperties();

if (appProperties.hasProperty(AppProperties.KEY.MONITOR_WEIGHT_FOR_HEIGHT) &&
appProperties.getPropertyBoolean(AppProperties.KEY.MONITOR_WEIGHT_FOR_HEIGHT)) {
adapter.addFragment(String.format(getString(R.string.weight_for_height), getString(genderStringRes).toUpperCase()),
WeightForHeightMonitoringFragment.createInstance(gender, dobString, getWeights(), getHeights()));
}

viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
import lecho.lib.hellocharts.model.LineChartData;
import lecho.lib.hellocharts.model.PointValue;
import lecho.lib.hellocharts.view.LineChartView;
import timber.log.Timber;

public class HeightMonitoringFragment extends Fragment {
public static final String TAG = HeightMonitoringFragment.class.getName();
private List<Height> heights;
private Calendar maxRecordingDate = null;
private Calendar minRecordingDate = null;
Expand Down Expand Up @@ -73,7 +73,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
refreshGrowthChart(heightTabView, getGender(), dob);
refreshPreviousHeightsTable(heightTabView, getGender(), dob);
} catch (Exception e) {
Log.e(TAG, Log.getStackTraceString(e));
Timber.e(Log.getStackTraceString(e));
}

return heightTabView;
Expand Down

0 comments on commit 1cdcc42

Please sign in to comment.