-
Notifications
You must be signed in to change notification settings - Fork 0
/
tiptop_ml_hhs_quality_report_moz_nhamatanda.Rmd
253 lines (202 loc) · 6.23 KB
/
tiptop_ml_hhs_quality_report_moz_nhamatanda.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
```{r parameters, include=FALSE}
source("tiptop_hhs_quality.R")
source("lang.R")
source("tokens.R")
# Report language
kReportLang <- "FR"
language <- kLang[[kReportLang]]
# Data retrieval: {api, file}
data_retrieval_mode = "api"
# API
api_url = redcap_api_url
api_token = hhs_endline_moz # TIPTOP HHS Endline mozambique
non_retrieved_records = c("cluster", "facility")
# File
file_prefix = "DATA/DATA_WITH_NO_DUPS/XXX"
file_content = "_DATA_WITH_NO_DUPS_"
file_date ="2021-06-15"
file_time ="10:33"
# Study area description
study_area_id = 1
country_name = "MOZAMBIQUE"
study_area_label = "Nhamatanda"
study_area_column = "nhamatanda"
sample_size = 822
partner.name = "CISM"
# sample_size * 5 (5 households to find one eligible woman)
household_to_be_visited = 4110
data_timestamp = dataTimestamp(data_retrieval_mode, file_date, file_time)
```
```{r title, include=FALSE}
#Languages
report.title <- paste(language$head.survey, '-', language$head.report, ':', country_name, '-', study_area_label)
```
---
title: "`r report.title`"
author: "Máximo Ramírez Robles"
date: `r data_timestamp`
output:
html_document: default
pdf_document: default
---
<style>
.main-container{
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.col-container{
overflow: auto;
position: relative;
}
.col-left{
float: left;
width: 50%;
}
.col-left-40{
float: left;
width: 40%;
}
.col-right{
float: right;
width: 50%;
}
.col-bottom{
position: absolute;
bottom: 0px;
}
.big-number{
font-size: 95px;
}
.medium-number{
font-size: 40px;
}
.text-center{
text-align: center;
}
.text-right{
text-align: right;
}
.text-left{
text-align: left;
}
.vertical-small-padding{
padding: 0 15px 0 15px;
}
.minnor-header{
font-size: 18px;
}
.text-color-medium-value{
color: #585859;
}
.text-color-big-value{
color: #31708f;
}
</style>
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE, fig.width = 18, fig.height = 7.5)
hhs_data = readData(data_retrieval_mode, file_prefix, file_content, file_date, file_time, api_url,
api_token, non_retrieved_records)
hhs_data = hhs_data[hhs_data$district == study_area_id, ]
hhs_data = hhs_data[!is.na(hhs_data$record_id), ]
# In this case, cluster values are scattered in multiple variables. So we need to collapse them
hhs_data$cluster_nhamatanda[!is.na(hhs_data$district) & hhs_data$district == 1] =
rowSums(hhs_data[!is.na(hhs_data$district) & hhs_data$district == 1, grepl("cluster_", names(hhs_data))], na.rm = T)
###
# Global variables
last_record_date = lastRecordDate(hhs_data)
number_of_records = numberOfRecords(hhs_data)
```
```{r out.width="30px", echo=FALSE}
knitr::include_graphics("github_icon.png")
```
[`r language$head.github`](https://github.com/maxramirez84/r_tiptop_baseline_hhs_data_quality_report)
## `r language$progress.title`
`r sprintf(language$progress.records, number_of_records)`
(`r sprintf(language$progress.last, last_record_date)`).
`r language$progress.partner` [`r partner.name`](http://manhica.org).
```{r recruited_women_area, echo=FALSE}
# Midline dataset adjustments
# ended_pregnancy variable was removed
hhs_data$diff_in_days = difftime(hhs_data$interview_date, hhs_data$end_last_pregnancy, units = "days")
hhs_data$diff_in_months = floor((hhs_data$diff_in_days / 365) * 12)
hhs_data$ended_pregnancy[hhs_data$diff_in_months > 6] = 0
hhs_data$ended_pregnancy[hhs_data$diff_in_months <= 6] = 1
consented = numberOfparticipantsWhoConsented(hhs_data)
recruitment = recruitmentRate(hhs_data, sample_size)
```
```{r remove_lat_lon, echo=FALSE}
#CHECK LAT LON AS NA
hhs_data$latitude <- NA
hhs_data$longitude <- NA
```
### `r language$progress.subtitle1`
<div class="col-left text-center">
`r language$progress.women` @ `r study_area_label`
<span class="big-number">`r recruitment`%</span>
`r consented` / `r sample_size`
</div>
<div class="col-right text-center">
</div>
```{r visited_households_area, echo=FALSE}
# visitedHouseholdsArea(hhs_data, household_to_be_visited, sample_size, study_area_label)
```
<p style="page-break-before: always">
```{r progress_area_1, echo=FALSE}
progressOfArea(hhs_data, study_area_column, study_area_label, interval = 10, required_visits_mean = 60, lang = language)
```
<p style="page-break-before: always">
## `r paste(language$profile.title)`
### `r sprintf(language$profile.subtitle1, study_area_label)`
```{r trial_profile_area_1, echo=FALSE, results="asis"}
trialProfileOfArea(hhs_data, study_area_column)
```
<p style="page-break-before: always">
## `r language$dups.title`
### `r sprintf(language$dups.subtitle1, study_area_label)`
```{r duplicates_summary_area_1, echo=FALSE, results="asis"}
duplicatesSummary(hhs_data, study_area_column)
```
### `r language$dups.subtitle2`
`r language$dups.desc1`
```{r duplicated_households, echo=FALSE}
printDuplicatedHouseholds(hhs_data, study_area_column, study_area_label)
```
### `r language$dups.subtitle3`
`r language$dups.desc2`
```{r duplicated_records, echo=FALSE}
printDuplicatedRecords(hhs_data, study_area_column, study_area_label)
```
<p style="page-break-before: always">
## `r language$indicators.title`
<span style="color: red"><b>`r language$indicators.impt`:</b></span>
`r language$indicators.desc`
### `r language$indicators.subtitle1`
<div class="col-container">
```{r sp_indicators, echo=FALSE}
ciptp_knowledge = cIPTpKnowledgeRate(hhs_data)
ciptp_administration = cIPTpAdministrationRate(hhs_data)
SPIndicators(hhs_data, study_area_label)
```
<div class="col-left text-center">
<div class="col-container">
<span class="minnor-header">`r sprintf(language$indicators.subtitle2, study_area_label,language$indicators.subtitle3)`
<div class="col-left col-bottom text-right vertical-small-padding text-color-medium-value">
<span class="medium-number">`r ciptp_knowledge`%</span><br/>
`r language$indicators.header1`
</div>
<div class="col-right text-left vertical-small-padding text-color-big-value">
<span class="big-number">`r ciptp_administration`%</span><br/>
`r language$indicators.header2`
</div>
</div>
<br/>
<div class="col-container">
</div>
</div>
</div>
### `r language$indicators.subtitle4`
```{r anc_indicators, echo=FALSE}
ANCIndicators(hhs_data, study_area_label)
```