-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.Rmd
314 lines (272 loc) · 15.5 KB
/
index.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
---
title: "Medstar APS"
output: html_document
# flexdashboard::flex_dashboard:
# vertical_layout: scroll
# orientation: columns
---
```{r setup, message=FALSE, warning=FALSE, results='hide', include=FALSE}
library(flexdashboard)
library(viridis)
library(ggplot2)
library(dplyr)
library(naniar)
library(freqtables)
library(purrr)
library(haven)
```
```{r sourcecode, message=FALSE, warning=FALSE, results='hide', include=FALSE}
source_rmd = function(file, ...) {
tmp_file = tempfile(fileext=".R")
on.exit(unlink(tmp_file), add = TRUE)
knitr::purl(file, output=tmp_file)
source(file = tmp_file, ...)
}
```
```{r sourcecode_dashboards, message=FALSE, results='hide', include=FALSE}
# source_rmd("dashboard_01_import.Rmd")
# source_rmd("dashboard_02_merge.Rmd")
```
```{r freq_tables_function, message=FALSE, warning=FALSE, results='hide', include=FALSE }
freq_tables <- function(.data, .col) {
.data %>%
freq_table({{.col}}) %>%
arrange(desc(n)) %>%
freq_format("n (percent %)", digits = 1) %>%
select(var, cat, formatted_stats)
}
```
Dashboard for Data Quality Checks
===========================================
Sections {.tabset}
-------------------------------------------
### Consent
```{r consentindex, echo=FALSE}
consent_stats <- map(
.x = set_names(c("consent_created_by", "consent_timestamp", "consent_status",
"consent_record_month", "consent_record_year",
"consent_interview_month", "consent_interview_year")),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
consent_stats
```
### Sociodemographics
```{r socioindex, echo=FALSE}
socio_socio_stats <- map(
.x = set_names(c("sociodemographic_created_by", "sociodemographic_status",
"sode_people", "sode_hispanic","sode_military",
"sode_unwanted", "sode_sexual", "hsi_contact",
"x_record_month", "x_record_year", "sogi_identity",
"sode_marital", "sode_race", "sode_school", "sode_employed",
"sode_income", "sogi_orientation")),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
socio_socio_stats
```
```{r sociographindex, echo=FALSE}
# age <- merged_consented$sode_age_years
hist(merged_consented$sode_age_years,
main = "Distribution of Age",
xlab = "Age",
col = "chocolate")
```
### APS Investigations
```{r apsindex, echo=FALSE}
aps_stats <- map_df(
.x = set_names(c("aps_investigation_created_by",
"aps_investigation_status", "aps_report", "aps_times",
"aps_recent", "x_record_month", "x_record_year",
"xc_lead_panel_summary_count", "aps_first")),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
aps_stats
```
### Clutter scale
```{r homeinspectionindex, echo=FALSE}
clutter_stats <- map_df(
.x = set_names(c("clutter_scale_created_by", "clutter_living", "look_kitchen",
"clutter_kitchen", "look_bedroom", "clutter_bedroom",
"look_living", "clutter_living_photo",
"clutter_kitchen_photo", "clutter_bedroom_photo",
"clutter_scale_status")),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
clutter_stats
```
### General Health
```{r generalhealthindex, echo=FALSE}
genhealth_pen_stats <- map_df(
.x = set_names(c("general_health_created_by", "health_bp_systolic",
"health_heart", "health_oxygen","health_temp",
"health_pain", "health_bp_diastolic",
"outcomes_health_general", "outcomes_health_vigorous",
"outcomes_health_moderate", "outcomes_health_uphill",
"outcomes_health_bend", "outcomes_health_block",
"outcomes_health_bathe", "outcomes4_weeks_pain",
"outcomes_month_social", "outcomes_month_nervous",
"outcomes_month_calm", "outcomes_month_blue",
"outcomes_month_happy", "outcomes_month_dumps", "outcomes_tf_ill",
"outcomes_tf_anybody", "outcomes_tf_bad", "outcomes_tf_health",
"depres_satisfied", "depres_hopeless", "depres_better",
"depres_activities", "depres_empty", "depres_bored",
"depres_spirits", "depres_afraid", "depres_happy",
"depres_helpless", "depres_home", "depres_memory",
"depres_alive", "depres_worthless", "depres_energy",
"nesarc_drink", "nesarc_months","peg_pain", "peg_enjoyment",
"peg_activity")),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
genhealth_pen_stats
```
### Gift Card
```{r giftcardindex, echo=FALSE}
gift_card_stats <- map_df(
.x = set_names(c("gift_card_created_by", "gift_card_status",
"x_interviewer_name", "gift_card_i_d",
"x_qualtrics", "x_record_month", "x_record_year",
"xc_peg", "xc_mo_feelings", "xc_mo_outcomes_tf",
"xc_depres_scale","xc_finance_person",
"xc_physical_person", "xc_sexual_person",
"xc_aps_reported", "xc_interview_month", "xc_interview_year",
"xc_interview_month_year_abbr", "xc_mo_health", "xc_auditc",
"xc_neglect_person", "xc_aps_report", "xc_neglect_person")),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
# not working:
# xc_eai_general_assessment, xc_eai_abuse_indicators,
# xc_eai_neglect_indicators, xc_eai_exploitation_indicators,
# xc_eai_abandonment_indicators, xc_eai_environmental, xc_emotional_incident_person
# not included: x_randomizer, xc_u_r_l, xc_case_i_d, xc_detect, xcsummary
gift_card_stats
```
### Observational Measures
```{r observationalindex, echo=FALSE}
observational_stats <- map_df(
.x = set_names(c("observational_measures_created_by", "clothes", "hygiene",
"poor_hygiene", "nutrition", "malnutrition", "skin_integrity",
"hair", "nails", "bruising", "fractures", "stages_healing", "abuse_statement",
"contracture", "decubitus", "dehydration", "diarrhea", "depression",
"impaction", "urine_burn", "obvious_disease", "inappropriate_medication",
"repetitive_hosp_admission", "neglect_statement", "money_misuse",
"evidence", "goods_for_services", "inability_account_money",
"exploitation_statement", "caretaker_withdrawn_care", "left_alone_unsafe",
"abandonment_statement", "yard_sidewalk", "roof", "windows",
"walls", "odor", "kitchen_cleanliness", "bathroom_cleanliness",
"bedroom_cleanliness", "living_room_cleanliness", "structural_problems",
"pets", "utilities", "unusual_odor", "disarray_hoarding", "health_safety_concern",
"caregiver_lack_knowledge", "caregiver_unengaged", "caregiver_frustrated",
"caregiver_anxious", "isolated_home", "depressed", "poor_personal_hygiene",
"inadequately_clothed", "difficulty_medications", "unmet_needs",
"report_elder_abuse", "hoarding_medications",
"observational_measures_status", "interior_condition",
"clutter", "neglect_comments", "exploitation_comments",
"abandonment_comments", "exterior_condition",
"summary_evidence_abuse", "summary_evidence_neglect",
"summary_evidence_exploitation",
"summary_evidence_abandonment", "general_assessment_comments",
"lacerations", "sexual_abuse", "abuse_indicators_comments",
"x_record_month", "x_record_year",
"aps_reported", "aps_reported_confirmation_number",
"aps_reported_method", "xc_case_i_d", "at_physical",
"at_phys_why", "at_sexual", "at_sex_why", "at_emotional",
"at_emot_why", "at_neglect", "at_neg_why", "at_abandon",
"at_aban_why", "at_financial", "at_fina_why", "at_self",
"at_self_why", "xc_lead_panel_summary_count",
"xc_lead_panel_summary_comment_count",
"xc_lead_panel_summary", "c_detect_status")),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
observational_stats
```
### Self-Report
```{r selfreportindex, echo=FALSE}
self_report_neglect_stats <- map_df(
.x = set_names(c("self_report_created_by", "self_report_status",
"neglect_go", "neglect_go_reliable", "neglect_food",
"neglect_food_help", "neglect_food_reliable", "neglect_house",
"neglect_house_help", "neglect_house_reliable", "neglect_clean",
"neglect_ready", "finance_person_permission",
"finance_person_decisions", "finance_copies", "finance_person_forged",
"finance_person_tricked", "finance_person_stolen",
"finance_stranger_permission", "finance_stranger_forged",
"finance_stranger_tricked", "emotional_yelled",
"emotional_embarrassed", "emotional_harassed",
"emotional_harassed_age", "emotional_refused",
"emotional_incident_reported", "emotional_person_live",
"emotional_person_alcohol", "emotional_person_counseling",
"emotional_person_police", "emotional_person_job",
"emotional_person_help", "emotional_person_no_live",
"physical_hit", "physical_hit_age", "physical_restrain",
"physical_hurt", "physical_incident60", "physical_incident_reported",
"physical_incident_person", "physical_person", "physical_person_live",
"physical_person_alcohol", "physical_person_counseling",
"physical_person_police", "physical_person_job",
"physical_person_help", "physical_person_no_live",
"sexual_harm", "sexual_touched", "sexual_touched_age",
"sexual_forced", "sexual_forced_age", "sexual_picture",
"sexual_picture_times", "sexual_picture_age",
"sexual_incident60", "sexual_incident_reported",
"sexual_incident_person", "sexual_person", "sexual_person_live",
"sexual_person_alcohol", "sexual_person_police",
"sexual_person_job", "sexual_person_help",
"sexual_person_no_live", "emotional_yelled_times_times",
"emotional_yelled_age_years", "emotional_embarrassed_times_times",
"emotional_embarrassed_age_years", "emotional_harassed_times_times",
"emotional_harassed_age_years", "emotional_refused_times_times",
"emotional_refused_age_years", "emotional_incident60",
"physical_hit_times_times", "physical_hit_age_years",
"physical_restrain_times_times", "physical_restrain_age_years",
"physical_hurt_times_times", "physical_hurt_age_years",
"sexual_harm_times_times", "sexual_harm_age_years",
"sexual_touched_times_times", "sexual_touched_age_years",
"sexual_forced_times_times", "sexual_forced_age_years",
"sexual_picture_times_times", "sexual_picture_age_years",
"finance_stranger_permission_times_times",
"finance_stranger_permission_age",
"finance_stranger_permission_age_years",
"finance_stranger_forged_times", "finance_stranger_forged_times_times",
"finance_stranger_forged_age", "finance_stranger_forged_age_years",
"finance_stranger_tricked_times", "finance_stranger_tricked_times_times",
"finance_stranger_tricked_age", "finance_stranger_tricked_age_years",
"xc_emotional_list", "xc_physical_list", "xc_sexual_list",
"finance_person_permission65","finance_person_permission_last_time",
"finance_person_forged65", "finance_person_forged_last_time",
"finance_person_tricked65", "finance_person_tricked_last_time",
"finance_person_stolen65", "finance_person_stolen_last_time",
"finance_stranger_permission65", "finance_stranger_permission_last_time",
"finance_stranger_forged65", "finance_stranger_forged_last_time",
"finance_stranger_tricked65", "finance_stranger_tricked_last_time",
"emotional_yelled65", "emotional_yelled_last_time",
"emotional_embarrassed65", "emotional_embarrassed_last_time",
"emotional_harassed65", "emotional_harassed_last_time",
"emotional_refused65", "emotional_refused_last_time",
"emotional_incident_reported_v2", "emotional_person_live_then",
"emotional_person_live_now", "physical_hit65",
"physical_hit_last_time", "physical_restrain65",
"physical_restrain_last_time", "physical_hurt65",
"physical_hurt_last_time", "physical_incident_reported_v2",
"physical_incident_person_v2", "physical_person_live_then",
"physical_person_live_now", "sexual_harm65",
"sexual_harm_last_time", "sexual_touched65",
"sexual_touched_last_time", "sexual_forced65",
"sexual_forced_last_time", "sexual_picture65",
"sexual_picture_last_time", "sexual_incident_reported_v2",
"sexual_incident_person_v2","sexual_person_live_then",
"sexual_person_live_now", "report_influence",
"xc_lead_panel_summary_count", "neglect_go_help",
"neglect_clean_help", "neglect_clean_reliable",
"neglect_ready", "neglect_ready_help", "neglect_ready_reliable",
"neglect_bills", "neglect_bills_help", "neglect_bills_reliable",
"neglect_person", "neglect_statement", "neglect_comments",
"finance_help", "finance_person", "emotional_yelled_times",
"emotional_yelled_age", "emotional_embarrassed_age",
"emotional_embarrassed_times", "emotional_harassed_times",
"emotional_refused_times", "emotional_refused_age",
"emotional_incident_person", "emotional_person_friends",
"physical_hit_times", "physical_restrain_times",
"physical_restrain_age", "physical_hurt_times",
"physical_hurt_age", "physical_person_friends",
"sexual_harm_times", "sexual_harm_age", "sexual_touched_times",
"sexual_forced_times", "sexual_person_counseling",
"sexual_person_friends", "finance_stranger_permission_times",
"fear_future", "fear_afraid", "fear_grateful", "fear_forward",
"fear_important", "emotional_incident_person_v2",
"report_private", "neglect_comments", "fear_afraid_response",
"fear_future_response", "fear_grateful_response",
"fear_forward_response", "fear_important_response" )),
.f = ~ freq_tables(merged_consented, !!sym(.x)))
self_report_neglect_stats
```