USAID-OHA-SI / OHA-Tableau-Dashboard-QA-QC

This repository will be used to track the QA/QC process for OHA Tableau Dashboards
0 stars 1 forks source link

FY19Q1 QC | OU 02: Agency Contribution #62

Closed achafetz closed 5 years ago

achafetz commented 5 years ago

Outstanding issues:

Filters

QC checks

  1. check all agency distributions for all indicators in tab :heavy_check_mark:
  2. check another year for all indicators in tab :heavy_check_mark:
  3. check another country for all indicators in tab :heavy_check_mark:
achafetz commented 5 years ago

R review script

library(tidyverse)
library(ICPIutilities)
library(knitr)
options(dplyr.print_min = Inf)

df_ouim <- read_rds("~/ICPI/Data/MER_Structured_Dataset_OU_IM_FY18-19_20190215_v1_1.rds")
#df_psnuim <- read_rds("~/ICPI/Data/MER_Structured_Dataset_PSNU_IM_FY18-19_20190215_v1_1.rds")

# OU.02 Data Quality Check ------------------------------------------------

#indicators
ind_sel <- c("HTS_TST", "HTS_TST_POS", "KP_PREV","OVC_SERV", "PMTCT_ART", "PMTCT_STAT",
             "PrEP_NEW", "TB_ART", "TB_STAT", "TX_CURR", "TX_NEW", "VMMC_CIRC")
#ZMB data
df_zmb <- df_ouim %>% 
  filter(operatingunit == "Zambia", 
         indicator %in% ind_sel, 
         standardizeddisaggregate == "Total Numerator",
         fundingagency!= "Dedup") %>% 
  add_cumulative() %>% 
  rename_official() %>% 
  mutate(indicator = factor(indicator, ind_sel))

#1. check all agency distributions for all indicators in tab
df_zmb %>% 
  group_by(indicator, fundingagency) %>% 
  summarise_at(vars(fy2019cum), ~ sum(., na.rm = TRUE)) %>%
  mutate(share = round(fy2019cum / sum(fy2019cum), 2)*100) %>% 
  ungroup() %>% 
  select(-fy2019cum) %>% 
  spread(fundingagency, share)

#2. check another year for all indicators in tab  
df_zmb %>% 
  group_by(indicator, fundingagency) %>% 
  summarise_at(vars(fy2018apr), ~ sum(., na.rm = TRUE)) %>%
  mutate(share = round(fy2018apr / sum(fy2018apr), 2)*100) %>% 
  ungroup() %>% 
  select(-fy2018apr) %>% 
  spread(fundingagency, share) 

#3. check another country for all indicators in tab
df_ouim %>% 
  filter(operatingunit == "Malawi", 
         indicator %in% ind_sel,
         standardizeddisaggregate == "Total Numerator",
         fundingagency!= "Dedup") %>% 
  add_cumulative() %>% 
  rename_official() %>% 
  mutate(indicator = factor(indicator, ind_sel)) %>% 
  group_by(indicator, fundingagency) %>% 
  summarise_at(vars(fy2019cum), ~ sum(., na.rm = TRUE)) %>%
  mutate(share = round(fy2019cum / sum(fy2019cum), 2)*100) %>% 
  ungroup() %>% 
  select(-fy2019cum) %>% 
  spread(fundingagency, share)