Skip to content

Commit

Permalink
Updated south africa region for cop23 opus (#855)
Browse files Browse the repository at this point in the history
* Updated south africa region for cop23 opus

* hotfix news

* updating d2 session object argument

* Linting

---------

Co-authored-by: Jordan <Jordan>
  • Loading branch information
JordanBalesBAO authored Jul 22, 2024
1 parent fa3eb7e commit 8fc4abf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Type: Package
Package: datapackr
Title: A Package that Packs and Unpacks all Data Packs and Target Setting
Tools
Version: 7.6.1
Date: 2024-07-17
Version: 7.6.2
Date: 2024-07-19
Authors@R: c(
person("Scott", "Jackson", , "sjackson@baosystems.com", role = c("aut", "cre")),
person("Jason", "Pickering", , "jason.p.pickering@gmail.com", role = c("aut", "rev")),
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
## New features
*

## Bug fixes
* Updated `checkMechanisms` to handle shifts in rationalization as it relates to 23 OPU's

## Minor improvements and fixes
*

# datapackr 7.6.1
## New features
*

## Bug fixes
* Updated dataset_levels to reflect org hierarchy change

Expand Down
7 changes: 5 additions & 2 deletions R/checkMechanisms.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ checkMechanisms <- function(d,

period_info <- datimvalidation::getPeriodFromISO(paste0(d$info$cop_year, "Oct"))


mechs_datim <- datapackr::getMechanismView(d2_session = d2_session,
update_stale_cache = TRUE,
cached_mechs_path = cached_mechs_path) %>%
# Fri Jul 19 15:04:49 2024 Due to Regionalization shifts between cop years affecting OPUs.
{ if (d$info$operating_unit$ou == "West Africa Region")
dplyr::mutate(., ou = replace(ou, ou == "West Africa Region 1" |
ou == "West Africa Region 2", "West Africa Region")) else .
} %>%
dplyr::filter(ou == d$info$operating_unit$ou) %>%
dplyr::filter(!is.na(startdate)) %>%
dplyr::filter(!is.na(enddate)) %>%
dplyr::filter(startdate <= period_info$startDate) %>%
dplyr::filter(enddate >= period_info$endDate) %>%
dplyr::pull(mechanism_code)


#Allow for the default mechanism
mechs_datim <- append("default", mechs_datim)

Expand Down

0 comments on commit 8fc4abf

Please sign in to comment.