This function is used to extract meta data as a list from the source file of a MER Structured Dataset, MER NAT_SUBNAT Structured Dataset, Financial Structure Dataset, HRH Structured Dataset, or DATIM Genie export. It creates a list object, metadata, in the global environment containing the source, current fiscal year, current period, current quarter, as well as a caption.

get_metadata(path, type, caption_note)

Arguments

path

path to the folder containing MSDs or specific MSD file (default relies on glamr::si_path() if available)

type

PSD type: "OU_IM", PSNU_IM", "NAT_SUBNAT", "Financial"; default = "OU_IM_FY2*"

caption_note

additional information to include in a viz caption footer

Value

list of meta data information about the source dataset

See also

Other metadata: extract_metadata(), source_info()

Examples

if (FALSE) {
 meta <- get_metadata() #works if you have stored path to the MSD folder via glamr::set_paths()
 meta$curr_fy }

if (FALSE) {
library(tidyverse)
library(glamr)
library(gophr)
library(glue)

ref_id <- "1bdf4c4e"

meta <- get_metadata(caption_note = "Created by: The Dream Team")

cntry <- "Saturn"

df <- si_path() %>%
  return_latest("OU_IM") %>%
  read_msd()

df_viz <- df %>%
  filter(operatingunit == cntry,
         fiscal_year == meta$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 == meta$curr_pd),
            aes(label = results_cumulative),
            vjust = -.5) +
  facet_wrap(~fct_reorder2(mech_code, period, targets)) +
  labs(title = glue("Upward trend in TX_NEW results thru {meta$curr_qtr} quarters") %>% toupper,
       subtitle = glue("{cntry} | {meta$curr_fy_lab} cumulative mechanism results"),
       x = NULL, y = NULL,
       caption = glue("{meta$caption}")) }