BristolMyersSquibb / blockr

Composable, extensible no-code UI
https://bristolmyerssquibb.github.io/blockr/
GNU General Public License v3.0
36 stars 3 forks source link

Strip result attributes #410

Open JohnCoene opened 3 months ago

JohnCoene commented 3 months ago

We need to strip the result attributes from blocks and stacks before saving.

JohnCoene commented 2 months ago

Here's what I get wrt stack sizes. I suspect it's because of the result attribute.

library(blockr)
library(blockr.cardinal)

obj_size <- function(x) {
  print(object.size(to_json(x)), units = "Kb")
}

stack1 <- new_stack()
stack2 <- new_stack(
  data = new_dataset_block(selected = "iris")
)
stack3 <- new_stack(
  data = new_random_cdisc_data_block(selected = "cadae"),
  table = new_cardinal06_block(
    arm_var = "ARM",
    id_var = "USUBJID",
    saffl_var = "SAFFL"
  ),
  title = "Cardinal 06"
)

# cardinal 07
stack4 <- new_stack(
  data = new_random_cdisc_data_block(selected = "cadae"),
  table = new_cardinal07_block(
    arm_var = "ARM",
    id_var = "USUBJID",
    saffl_var = "SAFFL",
    na_level = "MISSING"
  ),
  title = "Cardinal 07"
)

# cardinal 09
stack5 <- new_stack(
  data = new_random_cdisc_data_block(selected = "cadae"),
  table = new_cardinal09_block(
    arm_var = "ARM",
    id_var = "USUBJID",
    saffl_var = "SAFFL",
    pref_var = "AEDECOD"
  ),
  title = "Cardinal 09"
)

obj_size(stack1)
obj_size(stack2)
obj_size(stack3)
obj_size(stack4)
obj_size(stack5)

Returns

0.6 Kb
10.5 Kb
17.3 Kb
18.1 Kb
20.3 Kb