R/this_reporting_period_de.R

globalVariables(".data")
#' Gets numbers for this reporting period
#' @param xbrl_table obejct created from to_one_table
#' @importFrom magrittr "%>%"
#' @export
get_this_period_de <- function(xbrl_table){
  
  #first lets find the reporting period
  reporting_period_end_date <- (xbrl_table %>% 
                                  dplyr::filter(.data$fact == "genInfo.report.id.accordingTo.yearEnd"))[[1, "value"]] 
  
  
  res <- xbrl_table %>%
    dplyr::filter(
      .data$end_date == reporting_period_end_date |
      .data$instant == reporting_period_end_date
    ) %>%
    dplyr::filter(
      is.na(.data$explicitMember_dimension),
      is.na(.data$typedMember_dimension)
    ) %>%
    dplyr::select(
      .data$fact
      , .data$value
    ) %>%
    dplyr::distinct()
  
  return(res)
}
soetang/xbrlr documentation built on May 26, 2019, 7:01 p.m.