globalVariables(".data")
#' Gets numbers for this reporting period
#' @param xbrl_table obejct created from to_one_table
#' @importFrom magrittr "%>%"
#' @importFrom utils tail
#' @export
get_this_period_dk <- function(xbrl_table){
get_last_elem <- function(str, pattern){
tail(stringi::stri_split_fixed(str, pattern) %>% unlist(), n = 1)
}
#first lets find the reporting period
reporting_period_start_date <- (xbrl_table %>%
dplyr::filter(.data$fact == "ReportingPeriodStartDate"))[[1, "value"]]
reporting_period_end_date <- (xbrl_table %>%
dplyr::filter(.data$fact == "ReportingPeriodEndDate"))[[1, "value"]]
res <- xbrl_table %>%
dplyr::filter(
(.data$end_date == reporting_period_end_date &
.data$start_date == reporting_period_start_date) |
.data$instant == reporting_period_end_date
) %>%
dplyr::filter(
is.na(.data$explicitMember_dimension),
is.na(.data$typedMember_dimension)
) %>%
dplyr::mutate(
ns_abb = purrr::map_chr(.data$ns, get_last_elem, pattern = "/"),
fact = paste(.data$ns_abb, .data$fact, sep = ":")
) %>%
dplyr::select(
.data$fact
, .data$value
) %>%
dplyr::distinct()
return(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.