Skip to content

Commit

Permalink
Merge pull request #78 from nutriverse/v0.3.1.9000
Browse files Browse the repository at this point in the history
V0.3.1.9000
  • Loading branch information
ernestguevarra authored Oct 17, 2019
2 parents 3d150f1 + 54f365d commit e234b16
Show file tree
Hide file tree
Showing 13 changed files with 202 additions and 33 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Fourth release of `zscorer`. In this release:

* updated MUAC for age to allow for calculation for children up to 19 years old based on article by Jay Berkeley and colleagues.

* updated Shiny app

* updated documentation to reflect editions and additions

# zscorer 0.3.0
Expand Down
14 changes: 14 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,20 @@ head(zScores, 20)
Applying the `getAllWGS()` function results in a data frame of calculated `z-scores`
for all children in the cohort or sample for all the anthropometric indices.

## Shiny app

To use the included Shiny app, run the following command in R:

```{r, echo = TRUE, eval = FALSE}
run_zscorer()
```

This will initiate the Shiny app using the installed web browser in your current device as shown below:

```{r, echo = FALSE, eval = TRUE}
knitr::include_graphics("man/figures/zscorerApp.png")
```

## References

[^1]: World Health Organization (WHO). (2006). WHO Child Growth Standards: Length/height-for-age, weight-for-age, weight-for-length, weight-for-height and body mass index-for-age: Methods and development. [https://doi.org/10.1037/e569412006-008](https://doi.org/10.1037/e569412006-008)
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,19 @@ Applying the `getAllWGS()` function results in a data frame of
calculated `z-scores` for all children in the cohort or sample for all
the anthropometric indices.

## Shiny app

To use the included Shiny app, run the following command in R:

``` r
run_zscorer()
```

This will initiate the Shiny app using the installed web browser in your
current device as shown below:

![](man/figures/zscorerApp.png)<!-- -->

## References

1. World Health Organization (WHO). (2006). WHO Child Growth Standards:
Expand Down
2 changes: 2 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Fourth release of `zscorer`. In this release:

* updated MUAC for age to allow for calculation for children up to 19 years old based on article by Jay Berkeley and colleagues.

* updated Shiny app

* updated documentation to reflect editions and additions

## Test environments
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/anthropometry.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/calculate_zscore.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/legacy_functions.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added docs/reference/figures/zscorerApp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 57 additions & 7 deletions inst/zscorer/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,65 @@ function(input, output, session) {
##
observeEvent(input$calculate1, {
## For single calculations
if(input$dataType == 1) {
if(input$dataType == 1 & !is.null(input$weight1) & !is.null(input$height1)) {
##
req(input$weight1, input$age1, input$height1)
zScore <- getAllWGS(sex = as.numeric(input$sex1), weight = input$weight1,
height = input$height1, age = input$age1, index = "all")
req(input$sex1, input$weight1, input$age1, input$height1)

age <- input$age1 * (365.25 / 12)

waz <- getWGSR(sex = input$sex1, firstPart = input$weight1, secondPart = age, index = "wfa")
haz <- getWGSR(sex = input$sex1, firstPart = input$height1, secondPart = age, index = "hfa")
whz <- getWGSR(sex = input$sex1, firstPart = input$weight1, secondPart = input$height1, index = "wfh")
bfaz <- getWGSR(sex = input$sex1, firstPart = input$weight1, secondPart = input$height1, thirdPart = age, index = "bfa")

output$waz <- renderText({ waz })
output$haz <- renderText({ haz })
output$whz <- renderText({ whz })
output$bfaz <- renderText({ bfaz })
}
##
if(input$dataType == 1 & !is.null(input$muac1)) {
##
req(input$sex1, input$muac1, input$age1)

age <- input$age1 * (365.25 / 12)

mfaz <- getWGSR(sex = input$sex1, firstPart = input$muac1, secondPart = age, index = "mfa")

output$mfaz <- renderText({ mfaz })
}
##
if(input$dataType == 1 & !is.null(input$hc1)) {
##
req(input$sex1, input$hc1, input$age1)

age <- input$age1 * (365.25 / 12)

hcz <- getWGSR(sex = input$sex1, firstPart = input$hc1, secondPart = age, index = "hfa")

output$hcz <- renderText({ hcz })
}
##
if(input$dataType == 1 & !is.null(input$ss1)) {
##
req(input$sex1, input$ss1, input$age1)

age <- input$age1 * (365.25 / 12)

ssaz <- getWGSR(sex = input$sex1, firstPart = input$ss1, secondPart = age, index = "ssa")

output$ssaz <- renderText({ ssaz })
}
##
if(input$dataType == 1 & !is.null(input$ts1)) {
##
output$waz <- renderText({ zScore[ , "waz"] })
output$haz <- renderText({ zScore[ , "haz"] })
output$whz <- renderText({ zScore[ , "whz"] })
req(input$sex1, input$ts1, input$age1)

age <- input$age1 * (365.25 / 12)

ssaz <- getWGSR(sex = input$sex1, firstPart = input$ts1, secondPart = age, index = "tsa")

output$ssaz <- renderText({ tsaz })
}
})
##
Expand Down
125 changes: 102 additions & 23 deletions inst/zscorer/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ navbarPage(title = "zscorer", id = "chosenTab", theme = shinytheme("sandstone"),
uiOutput(outputId = "weight1"),
## Height input
uiOutput(outputId = "height1"),
## MUAC input
uiOutput(outputId = "muac1"),
## Head circumference input
uiOutput(outputId = "hc1"),
## Subscapular skinfold input
uiOutput(outputId = "ss1"),
## Triceps skinfold
uiOutput(outputId = "ts1"),
## Anthropometric index input
conditionalPanel("input.dataType == 2",
uiOutput(outputId = "index1")
Expand Down Expand Up @@ -51,18 +59,54 @@ navbarPage(title = "zscorer", id = "chosenTab", theme = shinytheme("sandstone"),
tabsetPanel(id = "dataType", selected = 1,
tabPanel(title = "Single", value = 1,
conditionalPanel("input.calculate1",
column(width = 4,
wellPanel(h4("Weight-for-age z-score"),
hr(),
uiOutput(outputId = "waz"))),
column(width = 4,
wellPanel(h4("Height-for-age z-score"),
hr(),
uiOutput(outputId = "haz"))),
column(width = 4,
wellPanel(h4("Weight-for-height z-score"),
hr(),
uiOutput(outputId = "whz")))
column(width = 3,
wellPanel(h5("Weight-for-age z-score"),
hr(),
uiOutput(outputId = "waz")
)
),
column(width = 3,
wellPanel(h5("Height-for-age z-score"),
hr(),
uiOutput(outputId = "haz")
)
),
column(width = 3,
wellPanel(h5("Weight-for-height z-score"),
hr(),
uiOutput(outputId = "whz")
)
),
column(width = 3,
wellPanel(h5("BMI-for-age z-score"),
hr(),
uiOutput(outputId = "bfaz")
)
),
column(width = 3,
wellPanel(h5("MUAC-for-age z-score"),
hr(),
uiOutput(outputId = "mfaz")
)
),
column(width = 3,
wellPanel(h5("Head circumference-for-age z-score"),
hr(),
uiOutput(outputId = "hcz")
)
),
column(width = 3,
wellPanel(h5("Subscapular skinfold-for-age z-score"),
hr(),
uiOutput(outputId = "ssaz")
)
),
column(width = 3,
wellPanel(h5("Triceps skinfold-for-age z-score"),
hr(),
uiOutput(outputId = "tsaz")
)
)
)
),
tabPanel(title = "Cohort", value = 2,
Expand All @@ -87,16 +131,42 @@ navbarPage(title = "zscorer", id = "chosenTab", theme = shinytheme("sandstone"),
),
mainPanel(width = 9,
HTML("
<a id='HEAD1'></a><h3>zscorer: Weight-for-age, height-for-age and weight-for-height z-score
calculator</h3>
<a id='HEAD1'></a><h3>zscorer: Weight-for-age, height-for-age, weight-for-height,
BMI-for-age, head circumference-for-age, arm circumference-for-age, subscapular
skinfold-for-age and triceps skinfold-for-age z-score calculator</h3>
<br/>
<p><code>zscorer</code> facilitates the calculation of <strong>z-scores</strong>
(i.e. the number of standard deviations from the mean) for the three key
anthropometric indices used to assess early childhood growth: <em>weight-for-age (WFA)</em>,
<em>height-for-age (HFA)</em> and <em>weight-for-height (WFH)</em>. <code>zscorer</code>
refers to the results of the <strong>WHO Multicentre Growth Reference Study</strong>
as standard for calculating the <strong>z-scores</strong> hence it comes
packaged with this reference data.</p>
(i.e. the number of standard deviations from the mean) and adds them to survey data:</p>
<ul>
<li><b>Weight-for-length (wfl)</b> z-scores for children with lengths between 45 and 110 cm
<li><b>Weight-for-height (wfh)</b> z-scores for children with heights between 65 and 120 cm
<li><b>Length-for-age (lfa)</b> z-scores for children aged less than 24 months
<li><b>Height-for-age (hfa)</b> z-scores for children aged between 24 and 228 months
<li><b>Weight-for-age (wfa)</b> z-scores for children aged between zero and 120 months
<li><b>Body mass index-for-age (bfa)</b> z-scores for children aged between zero and 228 months
<li><b>MUAC-for-age (mfa)</b> z-scores for children aged between 3 and 228 months
<li><b>Triceps skinfold-for-age (tsa)</b> z-scores for children aged between 3 and 60 months
<li><b>Sub-scapular skinfold-for-age (ssa)</b> z-scores for children aged between 3 and 60 months
<li><b>Head circumference-for-age (hca)</b> z-scores for children aged between zero and 60 months
</ul>
<p>The <code>z-scores</code> are calculated using the <b>WHO Child Growth Standards</b> for
children aged between zero and 60 months or the **WHO Growth References** for school-aged
children and adolescents. MUAC-for-age (mfa) z-scores for children aged between 60 and 228
months are calculated using the MUAC-for-age growth reference developed by Mramba et al. (2017)
using data from the USA and Africa. This reference has been validated with African school-age
children and adolescents. The <code>zscorer</code> comes packaged with the WHO Growth References
data and the MUAC-for-age reference data.
<p><code>zscorer</code> can be used to calculate the appropriate <strong>z-score</strong>
for the corresponding anthropometric index for a single child to assess growth and
Expand All @@ -109,8 +179,15 @@ navbarPage(title = "zscorer", id = "chosenTab", theme = shinytheme("sandstone"),
<a id='HEAD2'></a><h3>Installation</h3>
<p>You can install <code>zscorer</code> from GitHub with:</p>
<blockquote>
<code># install.packages('devtools')<br/>
devtools::install_github('nutriverse/zscorer')<br/>
<code># install.packages('remotes')<br/>
remotes::install_github('nutriverse/zscorer')<br/>
# load package<br/>
library(zscorer)</code>
</blockquote>
<p>or from CRAN with:</p>
<blockquote>
<code>install.packages('zscorer')<br/>
# load package<br/>
library(zscorer)</code>
</blockquote>
Expand All @@ -128,7 +205,8 @@ navbarPage(title = "zscorer", id = "chosenTab", theme = shinytheme("sandstone"),
<p>The R scripts on which this package was based on were written by Mark
Myatt and Ernest Guevarra on the 20th of December 2012.</p>
<p>Additional scripts that expand on previously written scripts to
enhance utility and functionality, has been written by Ernest Guevarra</p>
enhance utility and functionality, has been written by Mark Myatt and
Ernest Guevarra</p>
<p>Ernest Guevarra has packaged these scripts into an R standard format
and is the maintainer of this package</p>
<p>The <code>zscorer</code> Shiny app built into the package was created
Expand All @@ -138,6 +216,7 @@ navbarPage(title = "zscorer", id = "chosenTab", theme = shinytheme("sandstone"),
<a id='HEAD5'></a><h3>License</h3>
<p>This package and the built in Shiny app is licensed under the AGPL-3
License.</p>
<br/>
")
)
)
Expand Down
Binary file added man/figures/zscorerApp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e234b16

Please sign in to comment.