forked from impact-initiatives/impactR4PHU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
421 lines (321 loc) · 15.3 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
---
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# impactR4PHU <a href='https://www.impact-initiatives.org'><img src='man/figures/impactR4PHU.png' align="right" height="138" /></a>
<!-- badges: start -->
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
[![R-CMD-check](https://github.com/impact-initiatives/impactR4PHU/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/impact-initiatives/impactR4PHU/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/impact-initiatives/impactR4PHU/graph/badge.svg?token=BG57ECHOYX)](https://codecov.io/gh/impact-initiatives/impactR4PHU)
<!-- badges: end -->
## Overview
`impactR4PHU` is designed for creating quality check reports, cleaning, analysing and outputing results of core outcome indicators of Public Health Unit. This package will target mainly Food Security and Livelihoods, WASH, Nutrition and Health Sectors.
## Table of Contents
- [Installation](#installation)
- [Projects](#projects)
- [Data Quality](#data-quality)
- FSL
- Mortality
- IYCF
- [Cleaning](#cleaning)
- FSL
- Mortality
- [Descriptive Analysis](#descriptive-analysis)
- FSL
- Mortality
- [Standalone Functions](#standalone-functions)
- [FSL ADD INDICATORS](#fsl-add-indicators)
- [Nutrition ADD INDICATORS](#nutrition-add-indicators)
- [Checking Flags](#checking-flags)
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` {r, eval=FALSE}
# install.packages("devtools")
devtools::install_github("impact-initiatives/impactR4PHU")
```
## Projects
Upon installing the impactR4PHU package, you will be able to access pre-coded projects related to the various sectors of Public Health. These projects aims to support country missions and the research department to check/clean/and analyse indicatores related to Public Health sectors.
To access these projects, follow the following instructions.
![Go to File -> New Project...](./man/figures/projects_1.png)
![Select New Directory](./man/figures/projects_2.png)
![Scroll to find the respective projects](./man/figures/projects_3.png)
### Data Quality
The Data Quality and Plausibility Report serves as a crucial tool for assessing the reliability and accuracy of the data collection of all related public health indicators across different assessments. This comprehensive analysis is designed to identify and address potential issues within the data, ensuring that field teams are being informed on potential issues detected in the data collection.
The report provides a detailed examination of the datasets, employing a variety of metrics and methodologies to evaluate data quality and plausibility. This includes checks for completeness, consistency, and accuracy of the data collected. This report aims to uncover any discrepancies, outliers, or anomalies that may suggest data collection, entry errors, or underlying issues that could impact the integrity of the findings.
#### FSL Section
This section includes:
- Overall Plausibility Report / By Enumerator
- All the flags related to Food Security and Livelihoods (details shown for each flag in the section)
- Plots showing the distribution of the data.
#### Mortality Section
This section includes:
- Overall Plausibility Report / By Enumerator
- All the flags related to Mortality (details shown for each flag in the section)
- Number of deaths(overall and under 5)/joiners/leavers as well as person times.
- Plots showing the crude, under 5, and birth rates.
#### IYCF Section
This section includes:
- Overall Plausibility Report / By Enumerator
- All the flags related to IYCF (details shown for each flag in the section)
- Plots showing the distribution of the data.
#### What to do next?
Please check each flag and the <strong>ACTION</strong> related to it and act accordingly. Another output will be associated to this HTML, the Excel file of the flags that were fired and requires follow-up with the field team. Please check the README tab in the excel file. This file will again be generated with the full data during the cleaning of the dataset. So please do use this file during data collection and relate to it in the final one to be filled.
### Cleaning
The Data Cleaning Template serves as a crucial tool for assessing the data collection of all related public health indicators indicators across different assessments. This comprehensive tool is designed to identify and address potential issues within the data, ensuring that field teams are being followed up on potential issues detected in the data collection.
The report provides a detailed examination of the datasets, employing a variety of metrics and methodologies to evaluate data quality. This report aims to uncover any discrepancies, outliers, or anomalies that may suggest data collection, entry errors, or underlying issues that could impact the integrity of the findings.
#### FSL Section
<strong>Direct Checks</strong>
- All FCS columns are 0. FCS Score is equal to 0. All values are changed to NA.
- All FCS columns are 7. All values are changed to NA.
- All LCSI columns are not_applicable. All values are changed to NA.
- The LCSI strategy related to Displacement/Migration but HH is not a displaced group. Value of LCSI changed to NA.
- The LCSI strategy related to Agriculture but HH do not have income type related to agriculture. Value of LCSI changed to NA.
- The LCSI strategy related to Livestock but HH do not have income type related to livestock. Value of LCSI changed to NA.
<strong>Follow-Up Checks</strong>
- Check 1: rCSI Score is high while protein consumption is also reported as frequent.
- Check 2: HHs report using crisis or emergency strategies but not stress strategies or Emergency and no crisis.
- Check 3: HH that would have an acceptable FCS score and a high rCSI score.
#### Mortality Section (Individual Level)
<strong>Follow-Up Checks</strong>
- Check 1: Respondent reported more than 2 death in the HH.
- Check 2:Respondent reported sex of dead person male and a cause of death related to female only.
- Check 3:Respondent reported wrong dates leading to a negative person time.
#### Mortality Section (Household Level)
<strong>Follow-Up Checks</strong>
- Check 1: Respondent reported more than 2 death in the HH.
#### What to do next?
Please check the files in the output/ folder. The cleaning_logbook.xlsx already can contain some of the directly cleaned data. The followup_request.xlsm file represent the checks that needs to be followed up with the field team. Please follow the instruction in the READ_ME tab to know how to fill the file.
After filling the file, you can merge the [uuid/variable/old.value/new.value/issue] from the filled file with the cleaning_logbook.xlsx and add them to your cleaning scripts.
### Descriptive Analysis
The Descriptive Analysis is an analytical platform that presents a multitude of quantitative data tables. It encompasses a wide range of public health indicators collected through the assessment process, empowering users to examine and interpret complex datasets effectively. This tool is structured to support understanding the distribution of your data and support you writing your factsheets/outputs/reports, and create other visualizations.
#### FSL Section
As you saw in the output folder, you will have another excel file outputed from the analysis script.
- The Excel file includes 2 sheets. The first 2 are all the tables that you see in the different sections of this HTML output. You can navigate to respective tables through the first sheet "Table of Contents".
- Another output as well will include the IPC table.
#### Mortality Section
As you saw in the output folder, you will have another excel file outputed from the analysis script.
- The Excel file includes 2 sheets. The first 2 are all the tables that you see in the different sections of this HTML output. You can navigate to respective tables through the first sheet "Table of Contents".
## Standalone Functions (for both Analysis or Quality checks)
```{r include=T,eval=T}
library(impactR4PHU)
df <- impactR4PHU_data_template
```
### FSL ADD Indicators
#### Example:: Add Food Consumption Score (FCS)
``` {r eval=T,warning=F}
df_with_fcs <- df %>% add_fcs(
cutoffs = "normal",
fsl_fcs_cereal = "fsl_fcs_cereal",
fsl_fcs_legumes = "fsl_fcs_legumes",
fsl_fcs_veg = "fsl_fcs_veg",
fsl_fcs_fruit = "fsl_fcs_fruit",
fsl_fcs_meat = "fsl_fcs_meat",
fsl_fcs_dairy = "fsl_fcs_dairy",
fsl_fcs_sugar = "fsl_fcs_sugar",
fsl_fcs_oil = "fsl_fcs_oil"
)
```
#### Example:: Add Household Hunger Scale (HHS)
``` {r, eval=TRUE, warning=F}
df_with_hhs <- df_with_fcs %>% add_hhs(
fsl_hhs_nofoodhh = "fsl_hhs_nofoodhh",
fsl_hhs_nofoodhh_freq = "fsl_hhs_nofoodhh_freq",
fsl_hhs_sleephungry = "fsl_hhs_sleephungry",
fsl_hhs_sleephungry_freq = "fsl_hhs_sleephungry_freq",
fsl_hhs_alldaynight = "fsl_hhs_alldaynight",
fsl_hhs_alldaynight_freq = "fsl_hhs_alldaynight_freq",
yes_answer = "yes",
no_answer = "no",
rarely_answer = "rarely",
sometimes_answer = "sometimes",
often_answer = "often"
)
```
#### Example:: Add Livelihood Coping Strategy score (LCSI)
``` {r, eval=TRUE, warning=F}
df_with_lcsi <- df_with_hhs %>% add_lcsi(
fsl_lcsi_stress1 = "fsl_lcsi_stress1",
fsl_lcsi_stress2 = "fsl_lcsi_stress2",
fsl_lcsi_stress3 = "fsl_lcsi_stress3",
fsl_lcsi_stress4 = "fsl_lcsi_stress4",
fsl_lcsi_crisis1 = "fsl_lcsi_crisis1",
fsl_lcsi_crisis2 = "fsl_lcsi_crisis2",
fsl_lcsi_crisis3 = "fsl_lcsi_crisis3",
fsl_lcsi_emergency1 = "fsl_lcsi_emergency1",
fsl_lcsi_emergency2 = "fsl_lcsi_emergency2",
fsl_lcsi_emergency3 = "fsl_lcsi_emergency3",
yes_val = "yes",
no_val = "no_had_no_need",
exhausted_val = "no_exhausted",
not_applicable_val = "not_applicable"
)
```
#### Example:: Add Reduced Household Coping Strategy score (rCSI)
``` {r, eval=TRUE, warning=F}
df_with_rcsi <- df_with_lcsi %>% add_rcsi(
fsl_rcsi_lessquality = "fsl_rcsi_lessquality",
fsl_rcsi_borrow = "fsl_rcsi_borrow",
fsl_rcsi_mealsize = "fsl_rcsi_mealsize",
fsl_rcsi_mealadult = "fsl_rcsi_mealadult",
fsl_rcsi_mealnb = "fsl_rcsi_mealnb"
)
```
#### Example:: Add Household Dietary Diversity Score (HDDS)
``` {r, eval=TRUE, warning=F}
df_with_hdds <- df_with_rcsi %>% add_hdds(
fsl_hdds_cereals = "fsl_hdds_cereals",
fsl_hdds_tubers = "fsl_hdds_tubers",
fsl_hdds_veg = "fsl_hdds_veg",
fsl_hdds_fruit = "fsl_hdds_fruit",
fsl_hdds_meat = "fsl_hdds_meat",
fsl_hdds_eggs = "fsl_hdds_eggs",
fsl_hdds_fish = "fsl_hdds_fish",
fsl_hdds_legumes = "fsl_hdds_legumes",
fsl_hdds_dairy = "fsl_hdds_dairy",
fsl_hdds_oil = "fsl_hdds_oil",
fsl_hdds_sugar = "fsl_hdds_sugar",
fsl_hdds_condiments = "fsl_hdds_condiments"
)
```
#### Example:: Add Food Consumption Matrix (FCM) using FCS, RCSI, and HHS
**Notice that these functions are also pipable**
``` {r, eval=TRUE, warning=F}
df_with_fcm_1 <- df_with_hdds %>%
add_fcm_phase(
fcs_column_name = "fsl_fcs_cat",
rcsi_column_name = "fsl_rcsi_cat",
hhs_column_name = "fsl_hhs_cat_ipc",
fcs_categories_acceptable = "Acceptable",
fcs_categories_poor = "Poor",
fcs_categories_borderline = "Borderline",
rcsi_categories_low = "No to Low",
rcsi_categories_medium = "Medium",
rcsi_categories_high = "High",
hhs_categories_none = "None",
hhs_categories_little = "No or Little",
hhs_categories_moderate = "Moderate",
hhs_categories_severe = "Severe",
hhs_categories_very_severe = "Very Severe"
)
```
#### Example:: Add Food Consumption Matrix (FCM) using HDDS, RCSI, and HHS
**Notice that these functions are also pipable**
``` {r, eval=TRUE, warning=F}
df_with_fcm_2 <- df_with_hdds %>%
add_fcm_phase(
hdds_column_name = "fsl_hdds_cat",
rcsi_column_name = "fsl_rcsi_cat",
hhs_column_name = "fsl_hhs_cat_ipc",
hdds_categories_low = "Low",
hdds_categories_medium = "Medium",
hdds_categories_high = "High",
rcsi_categories_low = "No to Low",
rcsi_categories_medium = "Medium",
rcsi_categories_high = "High",
hhs_categories_none = "None",
hhs_categories_little = "No or Little",
hhs_categories_moderate = "Moderate",
hhs_categories_severe = "Severe",
hhs_categories_very_severe = "Very Severe"
)
```
#### Example:: Add Food Consumption Matrix (FCM) using FCS and HHS
**Notice that these functions are also pipable**
``` {r, eval=TRUE, warning=F}
df_with_fcm_3 <- df_with_hdds %>%
add_fcm_phase(
fcs_column_name = "fsl_fcs_cat",
hhs_column_name = "fsl_hhs_cat_ipc",
fcs_categories_acceptable = "Acceptable",
fcs_categories_poor = "Poor",
fcs_categories_borderline = "Borderline",
hhs_categories_none = "None",
hhs_categories_little = "No or Little",
hhs_categories_moderate = "Moderate",
hhs_categories_severe = "Severe",
hhs_categories_very_severe = "Very Severe"
)
```
#### Example:: Add Food Consumption Matrix (FCM) using HDDS and HHS
**Notice that these functions are also pipable**
``` {r, eval=TRUE, warning=F}
df_with_fcm_4 <- df_with_hdds %>%
add_fcm_phase(
hdds_column_name = "fsl_hdds_cat",
hhs_column_name = "fsl_hhs_cat_ipc",
hdds_categories_low = "Low",
hdds_categories_medium = "Medium",
hdds_categories_high = "High",
hhs_categories_none = "None",
hhs_categories_little = "No or Little",
hhs_categories_moderate = "Moderate",
hhs_categories_severe = "Severe",
hhs_categories_very_severe = "Very Severe"
)
```
#### Example:: Add FEWSNET Food Consumption-Livelihood Matrix (FCLCM)
**Notice that these functions are also pipable**
``` {r, eval=TRUE, warning=F}
df_with_fclcm <- df_with_fcm_1 %>% ## Taken from previous Example
add_fclcm_phase()
```
### NUTRITION ADD Indicators
```{r include=T,eval=T}
df_nut <- impactR4PHU_data_nut_template
```
#### Example:: Add MUAC
``` {r eval=T,warning=F}
df_with_muac <- df_nut %>%
add_muac()
```
#### Example:: Add MFAZ
``` {r eval=T,warning=F}
df_with_mfaz <- df_with_muac %>%
add_mfaz()
```
#### Example:: Add IYCF
``` {r eval=T,warning=F}
df_iycf <- impactR4PHU_iycf_template_data
df_with_iycf <- df_iycf %>%
add_iycf(uuid = "_submission__uuid",
age_months = "child_age_months_2")
```
### Checking Flags
```{r include=T,eval=T}
tool <- impactR4PHU_survey_template
```
#### Example:: Check Food Security and Livelihoods Flags
``` {r, eval=TRUE, warning=F}
fsl_flags <- df_with_fclcm %>%
check_fsl_flags(tool.survey = tool)
```
#### Example:: Check Anthropometric Flags
``` {r, eval=TRUE, warning=F}
anthro_flags <- df_with_mfaz %>%
check_anthro_flags(loop_index = "loop_index")
```
#### Example:: Check WASH Flags
``` {r, eval=TRUE, warning=F}
container_df <- impactR4PHU_data_wash_template
wash_flags <- df %>%
check_wash_flags(data_container_loop = container_df)
```
#### Example:: Check Health Flags (to add more flags related to WGSS)
``` {r, eval=TRUE, warning=F}
msna_data <- impactR4PHU_MSNA_template_data
health_flags <- check_health_flags(
.dataset = msna_data
)
```
#### Example:: Check IYCF Flags
``` {r, eval=TRUE, warning=F}
iycf_flags <- check_iycf_flags(
.dataset = df_with_iycf,
age_months = "child_age_months_2",
uuid = "_submission__uuid"
)
```
## Code of Conduct
Please note that the impactR4PHU project is released with a [Contributor Code of Conduct](https://impact-initiatives.github.io/impactR4PHU/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.