Skip to content

Commit

Permalink
Use Formatter to default IMF references
Browse files Browse the repository at this point in the history
  • Loading branch information
aboddie authored Dec 21, 2024
2 parents 5ab0e33 + cbf250b commit 29c1eec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 4 additions & 1 deletion R/SDMXServiceProvider-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ setSDMXServiceProviders <- function(){ # nocov start
builder = SDMXREST21RequestBuilder(
regUrl = "https://api.imf.org/external/sdmx/2.1",
repoUrl = "https://api.imf.org/external/sdmx/2.1",
compliant = TRUE)
compliant = TRUE,
formatter$datastructure = function(obj){
if(is.null(obj@references)) obj@references = "descendants"
return(obj)})
)

#OECD
Expand Down
7 changes: 0 additions & 7 deletions R/readSDMX.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,6 @@ readSDMX <- function(file = NULL, isURL = TRUE, isRData = FALSE,
references = references,
compliant = provider@builder@compliant
)

#allow IMF requests to use descendants instead of children
if(providerId == "IMF_DATA"){
if(is.null(references)){
requestParams@references <- "descendants"
}
}

#formatting requestParams
requestFormatter <- provider@builder@formatter
Expand Down

0 comments on commit 29c1eec

Please sign in to comment.