rsdmx icon indicating copy to clipboard operation
rsdmx copied to clipboard

Allow requesting codelists for an endpoint directly

Open aboddie opened this issue 5 months ago • 0 comments

The primary goal of this pull request is to allow requesting a codelist directly, as follows:

cl_responce <- readSDMX(providerId = 'IMF_DATA',
                        resource = 'codelist',
                        resourceId = 'CL_INDEX_TYPE',
                        agencyId = 'IMF',
                        version = '2.6.0')

cl_df <- as.data.frame(cl_responce)

to do this handlers and formatters were updated in R/SDMXREST21RequestBuilder-methods.R to allow for codelists and readSDMX was updated to use codelist handler and formatter.

In addition:

  • a codelist can now be converted to a dataframe, previously only selecting a codelist via the codelists object was allowed for conversion to a data frame.
response <- readSDMX(providerId = 'IMF_DATA',
                     resource = 'datastructure',
                     resourceId = 'DSD_QNEA')

CL_DIRECTLY_referenced <- as.data.frame(response@codelists@codelists[[4]])
  • a codelist can now be selected from a codelists object by codelistAgencyID and codelistVersion in addition to codelistId
CL_IMPROVED_SEARCH <- as.data.frame(response@codelists, 
                                    codelistId='CL_INDEX_TYPE', 
                                    codelistAgencyID='IMF',
                                    codelistVersion= '2.6.0')
  • Warnings around finding a codelist in the codelists object improved.
CL_IMPROVED_WARNINGS <- as.data.frame(response@codelists, 
                                    codelistId='CL_INDEX_TYPE')

aboddie avatar Aug 01 '25 17:08 aboddie