Translates time period boundaries and dimension constraints into the SDMX
3.0 query parameter syntax. Time periods are expressed as
c[TIME_PERIOD]=ge:{start}+le:{end} and arbitrary dimension filters as
c[{DIM}]={value}.
Arguments
- start_time
Character string specifying the start period (e.g.,
"2020","2020-Q1","2020-01"). Translated to age:(greater or equal) constraint onTIME_PERIOD. IfNULL, no lower bound is applied.- end_time
Character string specifying the end period. Translated to a
le:(less or equal) constraint onTIME_PERIOD. IfNULL, no upper bound is applied.- dim_filters
Named list where names are SDMX dimension identifiers and values are the corresponding filter expressions. For example,
list(FREQ = "M", REF_AREA = "IT")producesc[FREQ]=Mandc[REF_AREA]=IT. Can beNULLfor no dimension filtering.
Value
Character vector of query parameter strings suitable for appending to a URL query string. Returns a zero-length character vector when no filters are specified.
Examples
if (FALSE) { # \dontrun{
# Time range only
build_sdmx3_filters(start_time = "2020", end_time = "2025")
# "c[TIME_PERIOD]=ge:2020+le:2025"
# Open-ended time range (no end)
build_sdmx3_filters(start_time = "2020")
# "c[TIME_PERIOD]=ge:2020"
# Dimension filters only
build_sdmx3_filters(dim_filters = list(FREQ = "M", REF_AREA = "IT"))
# c("c[FREQ]=M", "c[REF_AREA]=IT")
# Combined time and dimension filters
build_sdmx3_filters(start_time = "2020", end_time = "2025",
dim_filters = list(FREQ = "M"))
# c("c[TIME_PERIOD]=ge:2020+le:2025", "c[FREQ]=M")
# No filters
build_sdmx3_filters()
# character(0)
} # }