Closed achafetz closed 2 years ago
Test script
remotes::install_github("USAID-OHA-SI/gophr", "09ada4c")
library(tidyverse)
library(glamr)
library(glue)
library(glitr)
library(extrafont)
library(scales)
library(gophr)
ref_id <- "1bdf4c4e"
get_metadata(caption_note = "Created by: The Dream Team @ USAID/OHA")
metadata
df <- si_path() %>%
return_latest("OU_IM") %>%
read_msd()
cntry <- "Rwanda"
df_viz <- df %>%
filter(operatingunit == cntry,
fiscal_year == metadata$curr_fy,
indicator == "TX_NEW",
standardizeddisaggregate == "Total Numerator")
df_viz <- df_viz %>%
group_by(fiscal_year, indicator, mech_code) %>%
summarise(across(c(targets, starts_with("qtr")), sum, na.rm = TRUE),
.groups = "drop")
df_viz <- reshape_msd(df_viz, "quarters")
df_viz %>%
ggplot(aes(period, results_cumulative)) +
geom_col() +
geom_text(data = . %>% filter(., period == metadata$curr_pd),
aes(label = label_comma()(results_cumulative)),
vjust = -.5, family = "Source Sans Pro", color = matterhorn) +
scale_y_continuous(label = comma) +
facet_wrap(~fct_reorder2(mech_code, period, targets)) +
labs(title = glue("Upward trend in TX_NEW results thru {metadata$curr_qtr} quarters") %>% toupper,
subtitle = glue("{cntry} | FY{str_sub(metadata$curr_fy, 3, 4)} cumulative mechanism results"),
x = NULL, y = NULL,
caption = glue("{metadata$caption}")) +
si_style_ygrid()
Resolution to #17