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.03: Quarterly Trends #63

Closed achafetz closed 5 years ago

achafetz commented 5 years ago

Outstanding issues:

Filters

QC checks

  1. check quarterly trend for select indicators :heavy_check_mark:
  2. check quarterly trend for select agencies for select indicator :heavy_check_mark:
  3. check quarterly trend for select partner for select indicator :heavy_check_mark:
  4. check psnu level for selected indicators and districts :heavy_check_mark:
  5. check quarterly trend for another country for selected indicator :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_FY17-19_20190215_v1_1.rds")
df_psnuim <- read_rds("~/ICPI/Data/MER_Structured_Dataset_PSNU_IM_FY17-19_20190215_v1_1.rds")

# OU.03 Data Quality Check ------------------------------------------------

#indicators
ind_sel <- c("HTS_TST", "OVC_SERV", "TX_NEW", "VMMC_CIRC")

#ZMB data
df_zmb <- df_ouim %>% 
  filter(operatingunit == "Zambia",
         indicator %in% ind_sel, 
         standardizeddisaggregate == "Total Numerator") %>% 
  mutate(fundingagency = ifelse(fundingagency %in% c("USAID", "HHS/CDC", "DOD"), fundingagency, "Others"))

#1. check quarterly trend for select indicators
df_zmb %>% 
  group_by(indicator) %>% 
  summarise_at(vars(contains("q")), ~ sum(., na.rm = TRUE)) %>% 
  ungroup() %>% 
  arrange(indicator) %>% 
  select(indicator, everything()) %>% 
  kable(format.args = list(big.mark = ",", zero.print = FALSE))

#2. check quarterly trend for select agencies for select indicator
df_zmb %>% 
  group_by(fundingagency, indicator) %>% 
  summarise_at(vars(contains("q")), ~ sum(., na.rm = TRUE)) %>% 
  ungroup() %>% 
  arrange(indicator, fundingagency) %>% 
  select(fundingagency, indicator, everything()) %>% 
  kable(format.args = list(big.mark = ",", zero.print = FALSE))

#3. check quarterly trend for select partner for select indicator
df_zmb %>% 
  filter(primepartner %in% c("John Snow Inc (JSI)", "IntraHealth International, Inc")) %>% 
  group_by(indicator, primepartner) %>% 
  summarise_at(vars(contains("q")), ~ sum(., na.rm = TRUE)) %>% 
  ungroup() %>% 
  arrange(indicator) %>% 
  select(indicator, everything()) %>% 
  kable(format.args = list(big.mark = ",", zero.print = FALSE))

#4. check psnu level for selected indicators and districts
df_zmb_psnuim <- df_psnuim %>% 
  filter(operatingunit == "Zambia", standardizeddisaggregate == "Total Numerator")

df_zmb_psnuim %>% 
  filter(psnu %in% c("Lusaka Urban District", "Chibombo District"),
         indicator %in% ind_sel) %>% 
  group_by(psnu, indicator) %>% 
  summarise_at(vars(contains("q")), ~ sum(., na.rm = TRUE)) %>% 
  ungroup() %>% 
  arrange(psnu, indicator) %>% 
  select(indicator, everything()) %>% 
  kable(format.args = list(big.mark = ",", zero.print = FALSE))

#5. check quarterly trend for another country for selected indicator
df_ouim %>% 
  filter(operatingunit == "Malawi", 
         indicator %in% ind_sel,
         standardizeddisaggregate == "Total Numerator") %>% 
  group_by(indicator) %>% 
  summarise_at(vars(contains("q")), ~ sum(., na.rm = TRUE)) %>% 
  ungroup() %>% 
  arrange(indicator) %>% 
  select(indicator, everything()) %>% 
  kable(format.args = list(big.mark = ",", zero.print = FALSE))
noahbartlett commented 5 years ago

The agency filter was excluding rather than including.

Fixed.