This repository is a template for a
docker-containerised,
{targets}-based,
{renv}-enabled
R workflow for analytics of
Trócaire’s Community-based Management of
Acute Malnutrition (CMAM) programme in Somalia.
Malnutrition in Somalia is among the highest globally, with around 903,000 children affected, including 150,000 who are severely malnourished. Trócaire addresses this by screening and treating children under five, providing nutrition supplements, and promoting better feeding and hygiene practices among pregnant and nursing mothers. They also train caregivers to identify and refer malnourished children for timely treatment.
This repository contains workflows that process and analyse Trócaire’s community-based management of acute malnutrition (CMAM) routine programme data.
The project repository is structured as follows:
trocaire-cmam-analytics
|-- .git-crypt/
|-- .github/
|-- auth/
|-- data/
|-- data-raw/
|-- outputs/
|-- R/
|-- renv
|-- reports
|-- _targets.R
|-- .env
|-- .gitattributes
|-- .Rprofile
|-- packages.R
|-- renv.lock
-
.git-crypt/containsgit-cryptsoftware specific files to manage encryption of specific files and folders in the repository. -
.githubcontains project testing and automated deployment of outputs workflows via continuous integration and continuous deployment (CI/CD) using Github Actions. -
authcontains encrypted authentication keys used in this project. -
data/contains intermediate and final data outputs produced by the workflow. -
data-raw/contains raw datasets, usually either downloaded from source or added manually, that are used in the project. -
outputs/contains compiled reports and figures produced by the workflow. -
R/contains functions developed/created specifically for use in this workflow. -
renv/containsrenvpackage specific files and directories used by the package for maintaining R package dependencies within the project. The directoryrenv/library, is a library that contains all packages currently used by the project. This directory, and all files and sub-directories within it, are all generated and managed by therenvpackage. Users should not change/edit these manually. -
reports/contains literate code for R Markdown and/or Quarto reports rendered in the workflow. -
_targets.Rfile defines the steps in the workflow’s data ingest, data processing, data analysis, and reporting pipeline. -
.envis an encrypted file that contains environment variables used in this project. -
.gitattributesfile contains information used bygit-cryptto determine which files and/or folders in the repository to encrypt. -
.Rprofilefile is a project R profile generated when initiatingrenvfor the first time. This file is run automatically every time R is run within this project, andrenvuses it to configure the R session to use therenvproject library. -
packages.Rfile lists out all R package dependencies required by the workflow. -
renv.lockfile is therenvlockfile which records enough metadata about every package used in this project that it can be re-installed on a new machine. This file is generated by therenvpackage and should not be changed/edited manually.
This project was built using R 4.5.1. To manage R versions, it is
recommended to use rig - an R
installation manager - to be able to install multiple versions of R and
switch between them as needed.
This project uses the {renv} framework to record R package
dependencies and versions. Packages and versions used are recorded in
renv.lock and code used to manage dependencies is in the renv
directory and other files in the root project directory.
On starting an R session in the working directory of this repository, first run
renv::restore()to install R package dependencies.
This project uses encrypted environment variables and authentication
keys for data retrieval managed using
git-crypt. Collaborators will
need to install git-crypt and
then provide their GPG key to the authors to be added as an authorised
user within the repository. To get a GPG key, download and install
GPG and then generate your GPG key
pair. Then provide your
GPG key id to the authors.
Once given permission into the project and GPG key id added to the
repository, update your local version of the repository by doing a git pull and then unlock the encrypted files/folders of the repository by
running the following command in Terminal from within the project
directory:
git-crypt unlockThe encrypted components of the repository will now be decrypted and accessible for running the workflow (described below).
The current workflow has the following steps:
graph LR
style Graph fill:#FFFFFF00,stroke:#000000;
subgraph Graph
direction LR
xe1cb52acd9cb733d(["otp_admissions_by_sex_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
xc5234a98b2b6e9c0(["otp_admissions_by_sex_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x211a3b39dfafa3b3(["otp_admissions_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x7278532b2bc29c60(["otp_admissions_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x11cedfe9795e0456(["sc_admissions_by_sex_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
xe8b2466bc3ec193d(["sc_admissions_by_sex_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x51516c5a51bc6f72(["sc_admissions_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
xd02d1bbb0c19e187(["sc_admissions_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x15baf61e9ffb2262(["tsfp_u5_admissions_by_sex_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x7b12cae56451f5ec(["tsfp_u5_admissions_by_sex_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x7b6f17b702e81898(["tsfp_u5_admissions_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x6bc4301a20d74330(["tsfp_u5_admissions_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
xefcb70fd373e934d["trocaire_cmam_data_raw"]:::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
xbd3f23f4f80bc001(["tsfp_plw_admissions_by_sex_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
xa4028d0478a08c4a(["tsfp_plw_admissions_by_sex_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x77f2fe6f084dca2c(["tsfp_plw_admissions_yearly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
xc8e187d255805f46(["tsfp_plw_admissions_monthly"]):::completed --> xf69487b7eb1bdf74(["data_review_report"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xe1cb52acd9cb733d(["otp_admissions_by_sex_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xc5234a98b2b6e9c0(["otp_admissions_by_sex_yearly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x211a3b39dfafa3b3(["otp_admissions_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x7278532b2bc29c60(["otp_admissions_yearly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x11cedfe9795e0456(["sc_admissions_by_sex_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xe8b2466bc3ec193d(["sc_admissions_by_sex_yearly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x51516c5a51bc6f72(["sc_admissions_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xd02d1bbb0c19e187(["sc_admissions_yearly"]):::completed
xefcb70fd373e934d["trocaire_cmam_data_raw"]:::completed --> x49ad837c8662aacd(["trocaire_cmam_data"]):::completed
xab2ef7d5cf8c2a5a["trocaire_data_files"]:::completed --> xefcb70fd373e934d["trocaire_cmam_data_raw"]:::completed
x768c673cc9e63582(["trocaire_data_files_list"]):::completed --> x2de3516cf4485518(["trocaire_data_file_names"]):::completed
x2de3516cf4485518(["trocaire_data_file_names"]):::completed --> xab2ef7d5cf8c2a5a["trocaire_data_files"]:::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xbd3f23f4f80bc001(["tsfp_plw_admissions_by_sex_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xa4028d0478a08c4a(["tsfp_plw_admissions_by_sex_yearly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> xc8e187d255805f46(["tsfp_plw_admissions_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x77f2fe6f084dca2c(["tsfp_plw_admissions_yearly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x15baf61e9ffb2262(["tsfp_u5_admissions_by_sex_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x7b12cae56451f5ec(["tsfp_u5_admissions_by_sex_yearly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x7b6f17b702e81898(["tsfp_u5_admissions_monthly"]):::completed
x49ad837c8662aacd(["trocaire_cmam_data"]):::completed --> x6bc4301a20d74330(["tsfp_u5_admissions_yearly"]):::completed
end
To run the workflow, issue the following command in R from within the project directory
targets::tar_make()or issue the following command in Terminal from within the project directory
Rscript -e "targets::tar_make()"- Bisharo Europe Maalim
- Proochista Ariana
- Ernest Guevarra
All code in this workflow is released under a GPL-3.0 license. All text and reports in this workflow is released under a CC-BY-4.0 license. Data from Trócaire’s CMAM programme is owned by Trócaire and is restricted to those who have been given permission. All other data is released under a CC0 license.

