-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
368 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
^ipccheckr\.Rproj$ | ||
^\.Rproj\.user$ | ||
^LICENSE\.md$ | ||
^README\.Rmd$ | ||
^\.github$ | ||
^codecov\.yml$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macos-latest, r: 'release'} | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true | ||
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
name: Commands | ||
|
||
jobs: | ||
document: | ||
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} | ||
name: document | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/pr-fetch@v2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::roxygen2 | ||
needs: pr-document | ||
|
||
- name: Document | ||
run: roxygen2::roxygenise() | ||
shell: Rscript {0} | ||
|
||
- name: commit | ||
run: | | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
git add man/\* NAMESPACE | ||
git commit -m 'Document' | ||
- uses: r-lib/actions/pr-push@v2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
style: | ||
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} | ||
name: style | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/pr-fetch@v2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
|
||
- name: Install dependencies | ||
run: install.packages("styler") | ||
shell: Rscript {0} | ||
|
||
- name: Style | ||
run: styler::style_pkg() | ||
shell: Rscript {0} | ||
|
||
- name: commit | ||
run: | | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
git add \*.R | ||
git commit -m 'Style' | ||
- uses: r-lib/actions/pr-push@v2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: test-coverage | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::covr | ||
needs: coverage | ||
|
||
- name: Test coverage | ||
run: | | ||
covr::codecov( | ||
quiet = FALSE, | ||
clean = FALSE, | ||
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | ||
) | ||
shell: Rscript {0} | ||
|
||
- name: Show testthat output | ||
if: always() | ||
run: | | ||
## -------------------------------------------------------------------- | ||
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
shell: bash | ||
|
||
- name: Upload test results | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-test-failures | ||
path: ${{ runner.temp }}/package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
output: github_document | ||
--- | ||
|
||
<!-- README.md is generated from README.Rmd. Please edit that file --> | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>", | ||
fig.path = "man/figures/README-" | ||
) | ||
library(ipccheckr) | ||
``` | ||
|
||
# `ipccheckr`::Toolkit for Performing IPC Acute Malnutrition-related Data Checks | ||
|
||
<!-- badges: start --> | ||
[](https://github.com/tomaszaba/ipccheckr/actions/workflows/R-CMD-check.yaml) | ||
[](https://app.codecov.io/gh/tomaszaba/ipccheckr?branch=main) | ||
<!-- badges: end --> | ||
|
||
The goal of ipccheckr is to ... | ||
|
||
## Installation | ||
|
||
`ipccheckr` is not yet on CRAN but you can install the development version from [GitHub](https://github.com/) with: | ||
|
||
``` r | ||
# install.packages("devtools") | ||
devtools::install_github("tomaszaba/ipccheckr") | ||
``` | ||
|
||
Then load to in memory with | ||
```{r example} | ||
library(ipccheckr) | ||
## basic example code | ||
``` | ||
|
||
## What does `ipccheckr` do? | ||
|
||
Please note that `ipccheckr` is still highly experimental and is undergoing a lot of development. Hence, any functionalities described below have a high likelihood of changing interface or approach as we aim for a stable working version. | ||
|
||
As of now, `ipccheckr` provides utility functions to be used in different, but interdependent, data analysis workflow, as described below: | ||
|
||
### Sampling and sample size | ||
|
||
`ipccheckr` provides useful utility functions for verifying if the minimum sampling and sample size requirements for surveys, screenings and community-based sentinel sites were met. | ||
|
||
### The _de facto_ quality checks | ||
|
||
For data that passes the above described checks, `ipccheckr` provides utility functions for performing the _de facto_ quality checks according to the source of data and the type of method used to measure the condition, either weight-for-height or mid upper-arm circumference (MUAC). For the latter, the array of utility functions goes from crude MUAC to muac-for-age zscore (MFAZ), based on IPC parameters that are mostly supported by the SMART methodology. | ||
|
||
### Prevalence calculations | ||
|
||
Useful set of functions for calculating acute malnutrition prevalence based on WHZ, with its respective descriptive statistics such as design effect, Green’s Index to tell if acute malnutrition cases are randomly distributed or clumped together, calculated prevalence when SD is >1.2, including the recalculated prevalence of SAM and MAM | ||
|
||
For MUAC, as known and extensively documented in the literature, MUAC is biased towards younger children (6-24 months), so that in an imbalanced sample size, composed of too many younger children compared to older children (24-59 months), the prevalence is likely to be overestimated and in such situations, the observed prevalence should be corrected to the expected population distribution, where applicable. `ipccheckr` provides utilities to address this situation in a dynamic and automated way, where applicable. | ||
|
||
### Visualization of checks results | ||
|
||
`ipccheckr` provides useful utility functions that produces presentable output results in a table, that is, summarized for each survey area, save-able in Excel spreadsheet and use plots to visualize the distribution of some test results and prevalence. | ||
|
||
## Useful workflow with `ipccheckr` | ||
|
||
The proposed `ipccheckr` workflow is presented below: | ||
|
||
_To be updated with a diagram_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
|
||
<!-- README.md is generated from README.Rmd. Please edit that file --> | ||
|
||
# `ipccheckr`::Toolkit for Performing IPC Acute Malnutrition-related Data Checks | ||
|
||
<!-- badges: start --> | ||
|
||
[](https://github.com/tomaszaba/ipccheckr/actions/workflows/R-CMD-check.yaml) | ||
[](https://app.codecov.io/gh/tomaszaba/ipccheckr?branch=main) | ||
<!-- badges: end --> | ||
|
||
The goal of ipccheckr is to … | ||
|
||
## Installation | ||
|
||
`ipccheckr` is not yet on CRAN but you can install the development | ||
version from [GitHub](https://github.com/) with: | ||
|
||
``` r | ||
# install.packages("devtools") | ||
devtools::install_github("tomaszaba/ipccheckr") | ||
``` | ||
|
||
Then load to in memory with | ||
|
||
``` r | ||
library(ipccheckr) | ||
## basic example code | ||
``` | ||
|
||
## What does `ipccheckr` do? | ||
|
||
Please note that `ipccheckr` is still highly experimental and is | ||
undergoing a lot of development. Hence, any functionalities described | ||
below have a high likelihood of changing interface or approach as we aim | ||
for a stable working version. | ||
|
||
As of now, `ipccheckr` provides utility functions to be used in | ||
different, but interdependent, data analysis workflow, as described | ||
below: | ||
|
||
### Sampling and sample size | ||
|
||
`ipccheckr` provides useful utility functions for verifying if the | ||
minimum sampling and sample size requirements for surveys, screenings | ||
and community-based sentinel sites were met. | ||
|
||
### The *de facto* quality checks | ||
|
||
For data that passes the above described checks, `ipccheckr` provides | ||
utility functions for performing the *de facto* quality checks according | ||
to the source of data and the type of method used to measure the | ||
condition, either weight-for-height or mid upper-arm circumference | ||
(MUAC). For the latter, the array of utility functions goes from crude | ||
MUAC to muac-for-age zscore (MFAZ), based on IPC parameters that are | ||
mostly supported by the SMART methodology. | ||
|
||
### Prevalence calculations | ||
|
||
Useful set of functions for calculating acute malnutrition prevalence | ||
based on WHZ, with its respective descriptive statistics such as design | ||
effect, Green’s Index to tell if acute malnutrition cases are randomly | ||
distributed or clumped together, calculated prevalence when SD is \>1.2, | ||
including the recalculated prevalence of SAM and MAM | ||
|
||
For MUAC, as known and extensively documented in the literature, MUAC is | ||
biased towards younger children (6-24 months), so that in an imbalanced | ||
sample size, composed of too many younger children compared to older | ||
children (24-59 months), the prevalence is likely to be overestimated | ||
and in such situations, the observed prevalence should be corrected to | ||
the expected population distribution, where applicable. `ipccheckr` | ||
provides utilities to address this situation in a dynamic and automated | ||
way, where applicable. | ||
|
||
### Visualization of checks results | ||
|
||
`ipccheckr` provides useful utility functions that produces presentable | ||
output results in a table, that is, summarized for each survey area, | ||
save-able in Excel spreadsheet and use plots to visualize the | ||
distribution of some test results and prevalence. | ||
|
||
## Useful workflow with `ipccheckr` | ||
|
||
The proposed `ipccheckr` workflow is presented below: | ||
|
||
*To be updated with a diagram* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
comment: false | ||
|
||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true | ||
patch: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview | ||
# * https://testthat.r-lib.org/articles/special-files.html | ||
|
||
library(testthat) | ||
library(ipccheckr) | ||
|
||
test_check("ipccheckr") |