Appsilon / data.validator

validate your data and create nice reports straight from R
https://appsilon.github.io/data.validator/
Other
145 stars 14 forks source link

render_semantic_report_ui prevents side scrolling for DT tables #85

Open nick-youngblut opened 1 year ago

nick-youngblut commented 1 year ago

Guidelines

Project Version

0.2.0

Platform and OS Version

macOS 13.3

Existing Issues

No response

What happened?

Once the validation report is rendered in a shiny app, the user cannot side scroll for DT tables with many columns. It appears that rendering of the report fixes the webpage size and prevents any side scrolling. This occurs even if the DT table and report are on different tab panels.

Steps to reproduce

Relevant server.R code:

library(shiny)
library(data.validator)
library(DT)

server = function(input, output, session) {
  # skipped lines...

  report = reactive({
    req(tbl())
    report = data_validation_report()
    validate(tbl(), name = "Verifying samples table") %>%
      validate_if(is_uniq(Sample_ID), 
                  description = "Sample ID column is unique") %>%
      validate_cols(not_na, 
                    description = "No NA values") %>%
      add_results(report)
    return(report)
  })
  ## render report
  output$validation = renderUI({
    req(report())
    render_semantic_report_ui(get_results(report()))
  })
}

Relevant ui.R code:

library(shiny)
library(data.validator)
library(DT)

ui = fluidPage(
  tabsetPanel(
    tabPanel('Data Input',
      fileInput("samples_file", "Samples file", 
              accept=c(".csv", ".tsv", ".xlsx")),
      actionButton("submit_button", "Submit"),
    ),
    tabPanel('Samples table',
      dataTableOutput('samples_table')
    ),
    tabPanel('Table validation',
      uiOutput("validation")
    )
  )
)

Expected behavior

I would like to render the validation report but still be able to side scroll through all columns in the DT table that is rendered in the app.

Attachments

No response

Screenshots or Videos

No response

Additional Information

No response