# RISE consents for Suva, Fiji
# DATA SOURCES
# 1. HOUSE NUMBERING AND CONSENT (up to 13 June 2019)
# 2. O3/4 BASELINE SURVEY (20 June 2019 - 4 Aug 2019)
# 3. O3 CHILD SAMPLING (26 SEPT- 2019 2019) CONSENT DATA - EMBEDDED IN SURVEY
# HOUSEHOLD CONSENT ITEMS
# consent1_1 a) Participation in the 5-year research program, which will include an engineering intervention either during the research program (intervention group - tranche 1) or 2 years later at the end of the study ('control' group - tranche 2).
# consent1_3 c) My household taking part in surveys to be administered 3-monthly at my home over the period 2018 - 2022.
# CHILD CONSENT ITEMS
# consent items:
# consent3_1 a) Up to quarterly collection of faecal samples from my child and subsequent analysis of samples.
# consent3_2 b) Collection of venous blood samples once per year and subsequent analysis of samples.
# consent3_3 c) Yearly measurement of height and weight.
# consent3_4 d) The faecal and blood samples provided during this research, and associated data, may be used by named researchers in this program in future research programs.
# consent3_5 e) Researchers accessing local health centre records for vaccination, medical presentations and growth measurements since the birth of my child.
# 1. LIST FROM CONSENT AND HOUSE NUMBERS PLUS BASELINE DATA
# COMBINED CONSENT LISTS FROM CONSENT AND BASELINE -
# last saved on 24 SEPT 2019
# setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/4. reports")
# setwd("Z:/Data Files/Data Files Objective 3/Reports/Child Sampling/Data Input")
#
# consent1 <- read_csv (file = "consent.fj.import.csv") #833
# child_consent1 <- read_csv (file = "child.consent.fj.import.csv") #454
# 2. T1 O3 CHILD SAMPLING (26 SEPT - 7 Nov 2019)
#hhd consent
consent <- child %>%
select (settlement_barcode, extract_house_no, today, hhd_id_no:hhd_consent_yes) %>%
filter (consent_form1_yn == 1) #yes, someone home to do hhd consent; 3 extra
#child consent
childnames.merge <- child %>%
select (settlement_barcode, extract_house_no, hhd_id, today, child_name1:height_yn1) %>%
filter (consent_new2==1 | consent_new3==1) #yes, a new consent
childnames.merge$child.name <- sub ("\\(.*", "", childnames.merge$child_name) #pull out child name with no age
childnames.merge$child.name <- trimws(childnames.merge$child.name) #removes the extra space at the end
childnames.merge$guardian_form3 <- sub ("\\(.*", "", childnames.merge$guardian_form3)
childnames.merge$guardian_form3 <- trimws(childnames.merge$guardian_form3) #removes the extra space at the end
#111 extra child consents
# FIX ALL DATES *****************************
fix_date <- function(x_date){
x_date <- ifelse(!is.na(ymd_hms(x_date)), ymd_hms(x_date),
ifelse(!is.na(dmy_hms(x_date)), dmy_hms(x_date), mdy_hms(x_date))) # Check the format and return the correct integer-date
x_date <- as.POSIXct(x_date, origin = "1970-01-01", tz = "UTC") # Convert the integer-date to a consistent format
}
#############################################
#############################################
#HOUSEHOLD CONSENTS - COMBINE ALL CONSENTS
# 1. new consents collected during child sampling (26 SEpt - 7 Nov 2019)
consent_house_new <- consent %>% #3
select (settlement_barcode, extract_house_no, hhd_head_name,
signed_form1, consent1_1, consent1_3, today) %>%
rename (settlement = settlement_barcode,
house.no = extract_house_no,
hhd_id = hhd_head_name,
signed.yn = signed_form1,
study = consent1_1,
surveys = consent1_3,
date = today) %>%
arrange (settlement, house.no, hhd_id, date) %>%
mutate (signed.yn = ifelse(is.na(signed.yn), NA, recode (signed.yn, '0' = "no", '1' = "yes")),
study = ifelse(is.na(study), NA, recode (study, '0' = "no", '1' = "yes")),
surveys = ifelse(is.na(surveys), NA, recode (surveys, '0' = "no", '1' = "yes"))) %>%
filter (!is.na(hhd_id)) %>% #3 additional consents - will only work when there is data in there
group_by(settlement, house.no, hhd_id) %>%
mutate (no = row_number() ) %>% #remove 1 duplicate
filter (no ==1) %>%
select (-no) #2
# 3. FINAL HHD CONSENT LIST - need to collapse and use most recent
consent_list_all <- bind_rows (consent1, consent_house_new) %>% #833+2
filter (!is.na(hhd_id)) #835 -
rm(consent_house_new, consent1, consent)
#check for duplicates
test <- consent_list_all %>%
mutate (id = paste0(settlement, house.no, hhd_id))
test[duplicated(test$id),]
#why were 2 surveys and consents done for Muanivatu #26 on 25 Oct (same day) ?
#2 children being done at the same time in the same house; delete one consent - fixed
rm(test)
#############################################
#############################################
#CHILD CONSENT - PULL ALL CONSENTS TOGETHER
# consent.childname$dob <- dmy (consent.childname$dob) - not needed
#child consents - new
child.consent.items <- childnames.merge %>%
select (settlement_barcode, extract_house_no, hhd_id, guardian_form3,
child.name, child_gender, child_dob,
signed_form3, consent3_1, consent3_2, consent3_3, consent3_4, consent3_5, today) %>%
rename (settlement = settlement_barcode,
house.no = extract_house_no,
guardian.name = guardian_form3,
gender = child_gender,
dob = child_dob,
signed.yn = signed_form3,
feces = consent3_1,
blood = consent3_2,
height.weight = consent3_3,
samples.analysed = consent3_4,
health.records = consent3_5,
date = today) %>%
mutate (signed.yn = recode (signed.yn, '0' = "no", '1' = "yes"))
#111 additional consents
#3. COMBINE ALL CONSENTS
child_consent_list_all <- bind_rows (child_consent1, child.consent.items) %>% #454 + 111
arrange (settlement, house.no, child.name, desc(date)) %>%
group_by(settlement, house.no, child.name) %>%
mutate (no = row_number()) %>% #13 duplicate surveys; checked - all have same dob
filter (no==1) #keep most recent consent form; n=552
rm(child_consent1, child.consent.items, childnames.merge)
test <- child_consent_list_all %>%
mutate (id = paste0(settlement, house.no, child.name))
x <- test[duplicated(test$id),] #0 duplicates
rm(test, x)
#keep only most recent consent
consent_list_all <- consent_list_all %>% #835
group_by(settlement, house.no, hhd_id) %>%
slice (which.max(date)) #833
child_consent_list_all <- child_consent_list_all %>% #552
group_by(settlement, house.no, child.name) %>%
slice (which.max(date)) #552
#CHECK
test <- child_consent_list_all %>% #456 consents now
mutate (id = paste0(settlement, house.no, child.name))
x <- test[duplicated(test$id),] #0 left all fixed
rm(test, x)
test <- consent_list_all %>%
mutate (id = paste0(settlement, house.no, hhd_id))
test[duplicated(test$id),] #all fixed
rm(test)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.