Skip to content

Commit

Permalink
rev
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard-Legoupil committed Feb 23, 2024
1 parent ebcb4a4 commit 6a79e1a
Show file tree
Hide file tree
Showing 43 changed files with 825 additions and 127 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/pkgdown.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ Imports:
forcats,
ggplot2,
glue,
here,
knitr,
magrittr,
refugees,
rmarkdown,
scales,
showtext,
stats,
Expand All @@ -29,9 +31,9 @@ Imports:
systemfonts,
tidyr,
tidyselect,
unhcrdown,
unhcrthemes
Suggests:
rmarkdown,
testthat
VignetteBuilder:
knitr
Expand Down
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ export(show_partnership)
export(show_sectors)
export(show_sectors_rbm)
export(show_top_donors)
export(template_prez)
import(dplyr)
import(ggplot2)
import(refugees)
import(scales)
import(tidyselect)
import(unhcrthemes)
importFrom(dplyr,filter)
importFrom(dplyr,pull)
importFrom(dplyr,select)
importFrom(here,here)
importFrom(magrittr,"%>%")
importFrom(rmarkdown,render)
importFrom(stats,reorder)
importFrom(unhcrdown,pptx_slides)
19 changes: 11 additions & 8 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@

## iati_budget ##########
#' @title dataBudget
#' @description Display budget by operation
#' @format A data frame
#' @description Display budget by operation
#' @format A data frame with 12 variables:
#' \describe{
#' \item{\code{iati_identifier}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_type}}{double COLUMN_DESCRIPTION}
#' \item{\code{budget_status}}{double COLUMN_DESCRIPTION}
#' \item{\code{budget_type}}{double COLUMN_DESCRIPTION}
#' \item{\code{budget_status}}{double COLUMN_DESCRIPTION}
#' \item{\code{budget_period_start}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_period_end}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_currency}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_value_date}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_value}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_value}}{double COLUMN_DESCRIPTION}
#' \item{\code{budget_type_name}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_type_description}}{character budget_type_description}
#' \item{\code{budget_status_name}}{character budget_status_name}}
#' \item{\code{budget_status_description}}{character budget_status_description}
#' \item{\code{budget_type_description}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_status_name}}{character COLUMN_DESCRIPTION}
#' \item{\code{budget_status_description}}{character COLUMN_DESCRIPTION}
#'}
#' @source \url{https://iatistandard.org/en/iati-standard/203/}
#' @examples
Expand All @@ -106,6 +106,9 @@
"dataBudget"






## iati_result ##########

Expand Down
24 changes: 12 additions & 12 deletions R/show_indicators_time.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' How much indicators evolve over time against thresholds?
#'
#' @param year A numeric value corresponding to the first year of focus until the most recent year within the dataset.
#' @param ctr_name A character vector corresponding to the name of the country.
#' @param programme_lab A character vector corresponding to the name of the programme.
#' @param iati_identifier_ops A character vector corresponding to the name of the operation.
#' @param ctr_name A character vector corresponding to the name of the country.
#' @param result_type_name either "Impact" "Outcome" "Output" - default is "Outcome"
#' @param type "deviation" showing difference between target and actual - or
#' "progress" showing difference between baseline and actual
Expand All @@ -27,27 +27,27 @@
#' result_type_name = "Outcome",
#' type = "deviation"
#' )
#' show_indicators_time(year = 2022,
#' show_indicators_time(year = 2020,
#' ctr_name = "Brazil",
#' result_type_name = "Impact",
#' type = "deviation"
#' )
#' show_indicators_time(year = 2019,
#' show_indicators_time(year = 2020,
#' ctr_name = "Brazil",
#' result_type_name = "Output",
#' type = "deviation"
#' )
#' show_indicators_time(year = 2022,
#' show_indicators_time(year = 2020,
#' ctr_name = "Brazil",
#' result_type_name = "Outcome",
#' type = "progress"
#' )
#' show_indicators_time(year = 2022,
#' show_indicators_time(year = 2020,
#' ctr_name = "Brazil",
#' result_type_name = "Impact",
#' type = "progress"
#' )
#' show_indicators_time(year = 2019,
#' show_indicators_time(year = 2020,
#' ctr_name = "Brazil",
#' result_type_name = "Output",
#' type = "progress"
Expand Down Expand Up @@ -229,9 +229,9 @@ show_indicators_time <- function(year,
title = stringr::str_wrap(
paste0( result_type_name, " Indicators ",
programme_lab, ctr_name,iati_identifier_ops ) ,
100),
subtitle = stringr::str_wrap( paste0(
"Progress comparison between \"Actual\" reported value and their \"baseline\" (in %)" ) ,
100),
subtitle = stringr::str_wrap( paste0(
"Deviation between reported \"Actual\" value and programmatic \"Target\" (in %)" ) ,
110),
caption = stringr::str_wrap(
"Data Source: UNHCR IATI (International Aid Transparency Initiative)" ,
Expand Down Expand Up @@ -270,7 +270,7 @@ show_indicators_time <- function(year,
shape = 17,
size = 3) +
ggplot2::stat_summary(fun.data=mean_sdl, #mult=1,
geom="pointrange", color="grey", size = 1) +
geom="pointrange", color="grey", size = .3) +
geom_hline(yintercept= 0, color="red") +
# ggplot2::scale_color_viridis_d(option = "inferno", na.value = "grey50") +
ggplot2::scale_colour_brewer(palette = "Paired") +
Expand All @@ -291,8 +291,8 @@ show_indicators_time <- function(year,
paste0( result_type_name, " Indicators ",
programme_lab, ctr_name,iati_identifier_ops ) ,
100),
subtitle = stringr::str_wrap( paste0(
"Deviation between reported \"Actual\" value and programmatic \"Target\" (in %)" ) ,
subtitle = stringr::str_wrap( paste0(
"Progress comparison between \"Actual\" reported value and their \"baseline\" (in %)" ) ,
110),
caption = stringr::str_wrap(
"Data Source: UNHCR IATI (International Aid Transparency Initiative)" ,
Expand Down
2 changes: 1 addition & 1 deletion R/show_sectors_rbm.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ show_sectors_rbm <- function(year,

ggplot2::geom_bar(stat = "identity", fill = "#0072BC") +
ggplot2::coord_flip()+
ggplot2::facet_wrap( ggplot2::vars(year2)) +
ggplot2::facet_wrap( ggplot2::vars(year2), labeller = labeller(year2 = ggplot2::label_wrap_gen(5))) +
ggplot2::scale_fill_viridis_d(option = "inferno", na.value = "grey50") +
ggplot2::scale_y_continuous(expand = ggplot2::expansion(mult = c(0, .1)), labels = scales::label_number(scale_cut = scales::cut_short_scale())) +
ggplot2::labs(title = "Share of Budget per Sectors (%)",
Expand Down
62 changes: 62 additions & 0 deletions R/template_prez.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# WARNING - Generated by {fusen} from dev/dev_unhcr_programme.Rmd: do not edit by hand


# usethis::use_rmarkdown_template(
# template_name = "iati_prez",
# template_dir = NULL,
# template_description = "UNHCR IATI",
# template_create_dir = TRUE
# )


#' Generate a summary powerpoint
#'
#' @param year A numeric value corresponding to the first year of focus until the most recent year within the dataset.
#' @param ctr_name A character vector corresponding to the name of the country.
#' @param folder folder within your project where to put the generated report.
#' Folder will be created if it does not exist
#'
#' @importFrom unhcrdown pptx_slides
#' @importFrom dplyr filter select pull
#' @importFrom rmarkdown render
#' @importFrom here here
#'
#' @return nothing the file for the report is generated
#'
#' @export
#'
#' @examples
#'
#' ## generate for one country
#' # iati::template_prez(year = 2022,
#' # ctr_name = "Brazil",
#' # folder = "dev/Prez")
#'
#' # ## Generate for all operation specific region
#' # region <- "The Americas"
#' #
#' # countries <- iati::dataActivity |>
#' # dplyr::filter( unhcr_region == region) |>
#' # dplyr::select(ctr_name) |>
#' # dplyr::distinct() |>
#' # dplyr::pull()
#' #
#' # for ( ctr in countries) {
#' # cat(paste0(ctr, "\n"))
#' # iati::template_prez(year = 2022,
#' # ctr_name = ctr,
#' # folder = "dev/Prez") }
template_prez <- function(year = 2022,
ctr_name,
folder = "Prez") {

## Create the outfolder if it does not exist
output_dir <- paste0(getwd(),"/",folder)
if (!dir.exists(output_dir)) {dir.create(output_dir)}

rmarkdown::render(
system.file("rmarkdown/templates/iati_prez/skeleton/skeleton.Rmd", package = "iati"),
output_file = here::here(folder, paste0('iati_prez-', ctr_name, '-', year, '.pptx') ),
params = list(ctr_name = ctr_name,
year = year) )
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pak::pkg_install("unhcr-americas/iati")

Extracting information from IATI can assist governments to plan and manage their budgets; parliamentarians and citizens to better hold governments accountable; community-based organisations to influence how resources are used; and journalists, researchers and activists to investigate the use and impact of the resources.

Information from Global Focus is translated monthly into the IATI open data standard and published using UNHCR’s IATI identifier: XM-DAC-41121. An overview of the publication process is accessible through [IATI Dashboard](http://dashboard.iatistandard.org/publisher/unhcr.html). Every UNHCR operation world-wide is reported on for each year from 2016. This includes financial information (budget, contributions, disbursements and expenditure), office locations, and results at various levels of activity. Activities for 2019 and onwards are be published as soon as possible after they become available. This current package is updated a much as possible....
Information from Global Focus is translated into the IATI open data standard and published using UNHCR’s IATI identifier: XM-DAC-41121. An overview of the publication process is accessible through [IATI Dashboard](http://dashboard.iatistandard.org/publisher/unhcr.html). Every UNHCR operation world-wide is reported on for each year from 2016. This includes financial information (budget, contributions, disbursements and expenditure), office locations, and results at various levels of activity. Activities for 2019 and onwards are be published as soon as possible after they become available. This current package is updated a much as possible....

### What is IATI?

Expand Down
8 changes: 6 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ reference:
contents:
- starts_with("mapping")
- title: Reference
desc: UNHCR Geographci Referential
desc: UNHCR Geographic Referential
contents:
- starts_with("reference")
- starts_with("reference")
- title: Template
desc: Powerpoint Report
contents:
- starts_with("template")
Binary file modified data/dataBudget.RData
Binary file not shown.
Loading

0 comments on commit 6a79e1a

Please sign in to comment.