Closed achafetz closed 6 years ago
Need to align indicators. Check if the light green are the same and then rename.
Current headers also need to be aligned. Need to write a function to add columns where they don't exist. (Not including WEEKLY REPORTING).
crosswalk to standardized indicator names
#standardize indicator names
df_long <- df_long %>%
dplyr::mutate(indicator = dplyr::case_when(
indicator == "Direct HTS_POS" ~ "HTS_TST_POS",
indicator == "Proxy TX_NEW" ~ "TX_NEW",
indicator == "IPT Initiation" ~ "IPT",
indicator %in% c("Early Missed Appointment", "EarlyMissed") ~ "APPT_EARLY_MISSED",
indicator == "Proxy HTS_POS" ~ "HTS_TST_POS_PROXY",
indicator == "Direct HTS_TST_ART" ~ "HTS_TST_ART",
indicator == "Unconfirmed Loss to Follow Up" ~ "LTFU_UNCONFIRMED",
indicator == "Waiting for ART" ~ "ART_WAITING")
)
add columns if missing
#add missing columns if they don't already exist (differences between USAID and CDC)
cols <- c("province", "provincial_lead", "site_lead", "10x10_facility", "weekly_reporting", "indicator")
for (c in cols) {
if(!c %in% colnames(df))
{
df <- df %>%
dplyr::mutate(!!c := as.character(NA))
}
}
#rename 10x10 facility column (CDC)
df <- dplyr::rename(df, tenxten_facility = `10x10_facility`)
Mapping from Mavis
adjust code to work with CDC workbooks as well