Closed achafetz closed 5 years ago
@noahbartlett, I think the "good" zone (light green) should be a 25% +/- 10% -> 15%-35%
If a country has an achievement of 14.6% in Q1, that is rounded to 15% on the visual, but colored yellow because technically it is below 15%. @noahbartlett, since the viz doesn't go to decimal places (and I am in no way advocating to add them), I think we have 2 options: (a) round the percents before applying colors or alternatively (b) to extend the color limits (eg green = 14.5 - 34.5).
R code for check
library(tidyverse)
library(ICPIutilities)
library(knitr)
library(scales)
options(dplyr.print_min = Inf)
df_ouim <- read_rds("~/ICPI/Data/MER_Structured_Dataset_OU_IM_FY17-19_20190215_v1_1.rds")
# Global.01 Data Quality Check --------------------------------------------
#indicators
ind_sel <- c("HTS_TST_POS", "PMTCT_STAT","TX_NEW", "VMMC_CIRC")
#1. check achievement for select indicators
df_ach <- df_ouim %>%
filter(indicator %in% ind_sel,
standardizeddisaggregate == "Total Numerator") %>%
add_cumulative()
df_ach %>%
group_by(operatingunit, indicator) %>%
summarise_at(vars(fy2019cum, fy2019_targets), ~ sum(., na.rm = TRUE)) %>%
ungroup() %>%
mutate(ach = fy2019cum/fy2019_targets) %>%
filter(fy2019_targets > 0) %>%
arrange(indicator, desc(ach)) %>%
mutate(ach = percent(ach, accuracy = 1)) %>%
select(indicator, everything()) %>%
kable(format.args = list(big.mark = ",", zero.print = FALSE))
#2. check achievement for select agencies for select indicators
df_ach %>%
filter(fundingagency == "USAID",
indicator == "HTS_TST_POS") %>%
group_by(operatingunit, indicator) %>%
summarise_at(vars(fy2019cum, fy2019_targets), ~ sum(., na.rm = TRUE)) %>%
ungroup() %>%
mutate(ach = fy2019cum/fy2019_targets) %>%
filter(fy2019_targets > 0) %>%
arrange(indicator, desc(ach)) %>%
mutate(ach = percent(ach, accuracy = 1)) %>%
select(indicator, everything()) %>%
kable(format.args = list(big.mark = ",", zero.print = FALSE))
#3. check achievement for select indicator for select year
df_ach %>%
filter(indicator == "HTS_TST_POS") %>%
group_by(operatingunit, indicator) %>%
summarise_at(vars(fy2018apr, fy2018_targets), sum, na.rm = TRUE) %>%
ungroup() %>%
mutate(ach = fy2018apr/fy2018_targets) %>%
filter(fy2018_targets > 0) %>%
arrange(indicator, desc(ach)) %>%
mutate(ach = percent(ach, accuracy = 1)) %>%
select(indicator, everything()) %>%
kable(format.args = list(big.mark = ",", zero.print = FALSE))
Fixed rounding issue: now numbers are rounded before color coded. Numbers that are below 15% but round up to 15% will now be color coded to light green to match the label of 15%.
Fixed color coding issue: light green is now 15-35% instead of 15-30%.
Outstanding issues:
Filters
QC checks